[SOLVED]GSM moden library conflict?

Hi guys.

I just get the new arduino gsm moden and when I try to integrate the gsm code in a program of my own I get this error:

C:\Documents and Settings\german\Escritorio\arduino-1.0.1\libraries\Keypad/utility/Key.h:46: error: conflicting declaration 'IDLE'
C:\Documents and Settings\german\Escritorio\arduino-1.0.1\libraries\GSM/GSM3MobileAccessProvider.h:37: error: 'IDLE' has a previous declaration as 'GSM3_NetworkStatus_t IDLE'

It seems to be a conflict between libraries Keypad and GSM...
Any idea how to solve it?

Thanks!

With the absence of code or pertinent details, comes the absence of answers!

dgelectron:
It seems to be a conflict between libraries Keypad and GSM...
Any idea how to solve it?

It does seem to be a conflict, but it seems to be a simple name clash rather than something more fundamental.

The C++ solution would probably be to put the libraries in separate namespaces.

The easy and crude solution would be to divide the parts of your code that need to access the keypad library into separate functions implemented in a separate file that does not include the GSM library. I'd expect to need to do a bit of work to overcome the half-baked mucking about that the IDE does with your sketch before it compiles it - probably it would be sufficient to include the keypad header file in your main sketch .INO file (so the IDE recognises that it is required by your sketch) but put a #ifdef 0 / #endif around that so it didn't actually get included in the compilation (which would then provoke the error you're trying to fix).

It does seem to be a conflict, but it seems to be a simple name clash rather than something more fundamental.

/utilty/key.h Line 46

typedef enum{ IDLE, PRESSED, HOLD, RELEASED } KeyState;

GSM3MobileAccessProvider.h Line 37

enum GSM3_NetworkStatus_t { ERROR, IDLE, CONNECTING, GSM_READY, GPRS_READY, TRANSPARENT_CONNECTED};

dgelectron:
It seems to be a conflict between libraries Keypad and GSM...
Any idea how to solve it?

I made a first attempt at including a namespace in the keypad library which I just attached below. I did this while at work so I haven't had a chance to test it out. If you want to use the attached copy of the keypad library then you will need to change the KeyState variables (IDLE, PRESSED, HOLD, or RELEASED) in your sketch to m_key::IDLE, m_key::PRESSED, m_key::HOLD, and m_key::RELEASED.

Keypad.zip (18.4 KB)

Hi PeterH and mstanley.

Thanks a lot for your responses and your time. I was out all the weekend so i'm going to start trying the solutions you told me. I´ll be back to post my results. Many thanks again!!

I try at first mstanley solution.
I just downloaded your library and put it in the place of the old one. The error doesnt come around any more, but i have a new one:

iCONTROL_V11.cpp:2101:14: error: empty character constant

I don't have any KeyState variables declared in my sketch so I cant change their names as you told me...

This is what I have declared in the sketch related to keypad librarie.

const byte ROWS = 4; //4 filas
const byte COLS = 3; //3 columnas
char keys[ROWS][COLS] = {
{ '1','2','3' }
,
{ '4','5','6' }
,
{ '7','8','9' }
,
{ '*','0','#' }
};
byte rowPins[ROWS] = { 7, 6, 5, 4}; // reserva de memoria en bytes, conectar a los pines de filas del teclado
byte colPins[COLS] = { 10, 9, 8}; // reserva de memoria en bytes, conectar a los pines de columnas del teclado
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
keypad.setHoldTime(50); // Tiempo de pulsado de boton. Default is 1000mS
keypad.setDebounceTime(20); // Tiempo de rebote de bootn. Default is 50mS

ok the empty character error is resolved. that was my mistake, a beginner one.
So, i dont have any compilation problems. The problems is that when I connect the GSM shield from Arduino and Telefonico to the Arduino Mega my keypad doesn't respond. I use the keypad to enter some pin codes and now it doesn´t work!!

The problems is that when I connect the GSM shield from Arduino and Telefonico to the Arduino Mega my keypad doesn't respond.

The GSM Shield? you say that like there is just one. Guess again.

The one developed between arduino anda telefonica. There is just one developed between these two companys.

The link you provided shows the pins that the shield uses - pins 2, 3, and 7.

If you reuse those pins for the keypad, as you do pin 7, do not be surprised when one or the other of the devices does not work.

I tried with different pins for the keypad and it works. I guess is not possible to make the shield use another pin for the reset so...i will have to make changes in all the keypads :fearful:
Thanks all for your help!!

This topic could be mark as solved. It's up to me to do that??

Regards.

It's up to me to do that??

Yes. Just add [SOLVED] to the thread title.

Done.
Thanks!

mstanley:

dgelectron:
It seems to be a conflict between libraries Keypad and GSM...
Any idea how to solve it?

I made a first attempt at including a namespace in the keypad library which I just attached below. I did this while at work so I haven't had a chance to test it out. If you want to use the attached copy of the keypad library then you will need to change the KeyState variables (IDLE, PRESSED, HOLD, or RELEASED) in your sketch to m_key::IDLE, m_key::PRESSED, m_key::HOLD, and m_key::RELEASED.

it works fine with me now, could you please how you make change to the keypad.h file

Hey everyone, I meet the same problem.
I downloaded the new keypad library and replaced the old one.
But it seemed not work for me, I meet the compile the problem.
The compiling error is

FV1.ino: In function 'void keypadEvent(KeypadEvent)':
FV1.ino:211:10: error: 'PRESSED' was not declared in this scope
FV1.ino:211:10: note: suggested alternative:
In file included from C:\Users\130028T\Desktop\arduino-1.6.3-windows\arduino-1.6.3\libraries\Keypad/Keypad.h:36:0,
from FV1.ino:12:
C:\Users\130028T\Desktop\arduino-1.6.3-windows\arduino-1.6.3\libraries\Keypad/utility/Key.h:48:22: note: 'PRESSED'
typedef enum{ IDLE, PRESSED, HOLD, RELEASED } KeyState;
^
Error compiling.

Could anyone kindly offer me the instructions about how to "change the KeyState variables (IDLE, PRESSED, HOLD, or RELEASED) in your sketch to m_key::IDLE, m_key::PRESSED, m_key::HOLD, and m_key::RELEASED."???

Thank you in advance!

Could anyone kindly offer me the instructions

Edit Key.h. Change the enum values to keyPRESSED, keyRELEASED, etc.

Change PRESSED to keyPRESSED, in the sketch. Change the other constants, as needed.