Go Down

Topic: [SOLVED]GSM moden library conflict? (Read 5003 times) previous topic - next topic

dgelectron

Sep 11, 2013, 05:41 pm Last Edit: Sep 20, 2013, 09:32 am by dgelectron Reason: 1
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:

Quote
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!

JB_AU

With the absence of code or pertinent details, comes the absence of answers!
Amateurs built the ark, Professionals built the Titanic

PeterH


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).

JB_AU

#3
Sep 11, 2013, 08:17 pm Last Edit: Sep 11, 2013, 08:37 pm by JB_AU Reason: 1
Quote
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
Quote
typedef enum{ IDLE, PRESSED, HOLD, RELEASED } KeyState;

GSM3MobileAccessProvider.h Line 37
Quote
enum GSM3_NetworkStatus_t { ERROR, IDLE, CONNECTING, GSM_READY, GPRS_READY, TRANSPARENT_CONNECTED};
Amateurs built the ark, Professionals built the Titanic

mstanley


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.

dgelectron

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!!

dgelectron

#6
Sep 16, 2013, 10:15 am Last Edit: Sep 16, 2013, 10:18 am by dgelectron Reason: 1
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:

Quote

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.

Quote
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  



dgelectron

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!!

PaulS

Quote
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 art of getting good answers lies in asking good questions.

dgelectron

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

http://arduino.cc/en/Main/ArduinoGSMShield

PaulS

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.
The art of getting good answers lies in asking good questions.

dgelectron

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  :smiley-eek-blue:
Thanks all for your help!!

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

Regards.

PaulS

Quote
It's up to me to do that??

Yes. Just add [SOLVED] to the thread title.
The art of getting good answers lies in asking good questions.

dgelectron


msavooo



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

Go Up