vshymanskyy / TinyGSM

A small Arduino library for GSM modules, that just works
GNU Lesser General Public License v3.0
1.91k stars 713 forks source link

Error while extending the library (derived class) #108

Closed de666 closed 6 years ago

de666 commented 6 years ago

I'm trying to extend the library trough a derived class but the compiler gives me an error and I can't figure out how to solve. This is the code:

#define TINY_GSM_MODEM_M590

// Set serial for debug console (to the Serial Monitor, speed 115200)
#define SerialMon Serial

// or Software Serial on Uno, Nano
#include <SoftwareSerial.h>
SoftwareSerial SerialAT(2, 3); // RX, TX

//#define DUMP_AT_COMMANDS
#define TINY_GSM_DEBUG SerialMon

#include <TinyGsmClient.h>

class M590 : public TinyGsm {
  public:
    void do_nothing(){
      }
};

#ifdef DUMP_AT_COMMANDS
  #include <StreamDebugger.h>
  StreamDebugger debugger(SerialAT, SerialMon);
//  TinyGsm modem(debugger);
  M590 modem(debugger);
#else
//  TinyGsm modem(SerialAT);
  M590 modem(SerialAT);
#endif

void setup() {
  // Set console baud rate
  SerialMon.begin(9600);
  delay(10);

  // Set GSM module baud rate
  TinyGsmAutoBaud(SerialAT);
  delay(3000);
}

void loop() {
  while (true) {
    modem.maintain();
  }
}

Which gives me this error:

no known conversion for argument 1 from 'SoftwareSerial' to 'M590&&'

exit status 1
no matching function for call to 'M590::M590(SoftwareSerial&)'

I know it is not really an issue but I think it would help other pepole to extend the library with new functionalities. What is the best way to do that? Thankyou

vshymanskyy commented 6 years ago

https://gitter.im/tinygsm/Developers :) I don't get what you're trying to achieve... you can modify the library files, or use low-level AT command API directly...