no member named 'getSignal'

Discussion about software developed by Freematics, including Freematics Builder and Freematics Emulator GUI
Post Reply
marketing.ecowindow
Posts: 1
Joined: Thu Feb 15, 2024 7:29 pm

no member named 'getSignal'

Post by marketing.ecowindow »

I have an error while launching my code in Freematics Builder:

error: 'class HTTPClientSIM7600' has no member named 'getSignal'

Code: Select all

#include <FreematicsPlus.h>

//#include <lib/FreematicsPlus.h>

// testing URL: https://hub.freematics.com/test
#define SERVER_HOST "hub.freematics.com"
#define SERVER_PORT 443
#define SERVER_PATH "/test"
#define CELL_APN "Hologram"
#define CONN_TIMEOUT 5000

FreematicsESP32 sys;
HTTPClientSIM7600 net;
int errors = 0;

bool init_net()
{
    Serial.print("Init cellular module...");
    if (net.begin(&sys)) {
      Serial.print(net.deviceName());
      Serial.println(" OK");
    } else {
      Serial.println("NO");
      return false;
    }
    Serial.print("IMEI:");
    Serial.println(net.IMEI);

    if (net.checkSIM()) {
      Serial.println("SIM Card OK");
    } else {
      Serial.println("No SIM Card");
    }
    Serial.print("Registering on network...");
    if (net.setup(CELL_APN)) {
      Serial.println("OK");
    } else {
      Serial.println("NO");
      return false;
    }
    String op = net.getOperatorName();
    if (op.length()) {
      Serial.print("Operator:");
      Serial.println(op);
    }
    Serial.print("Obtaining IP address...");
    String ip = net.getIP();
    if (ip) {
      Serial.println(ip);
    } else {
      Serial.println("N/A");
    }
    int signal = net.getSignal();
    if (signal) {
      Serial.print("RSSI:");
      Serial.print(signal);
      Serial.println("dBm");
    }
    Serial.print("Init HTTPS stack...");
    if (net.open()) {
      Serial.println("OK");
    } else {
      Serial.println("NO");
    }
    return true;
}
void setup()
{
  Serial.begin(115200);
  // use following for Freematics ONE+
  sys.begin();
  // use following for Freematics Esprit or other ESP32 dev board
  //sys.xbBegin(115200, 16, 17);

  // initialize cellular module
  while (!init_net());
}

void loop()
{
  if (errors > 10) {
    // re-initialize cellular module
    net.end();
    if (init_net()) {
      Serial.println("OK");
      errors = 0;
    } else {
      Serial.println("NO");
      delay(3000);
      return;
    }
  }
//Lets test SMS (my added code)
if (net.state() != HTTP_CONNECTED) {
    Serial.print("Connecting...");
    if (net.open(SERVER_HOST, SERVER_PORT)) {
      Serial.println("OK");
    } else {
      Serial.println(net.open(SERVER_HOST));
      net.close();
      errors++;
      return;
    }
  }

  // send HTTP request
  Serial.print("Sending request...");
  if (!net.send(METHOD_GET, SERVER_PATH, true)) {
    Serial.println("failed");
    net.close();
    errors++;
    return;
  } else {
    Serial.println("OK");
  }

  // receive HTTP response
  Serial.print("Receiving...");
  char *response;
  int bytes;
  response = net.receive(&bytes);
  if (response) {
    Serial.println("OK");
    Serial.println("-----HTTP RESPONSE-----");
    Serial.println(response);
    Serial.println("-----------------------");
    errors = 0;
  } else {
    Serial.println("failed");
    net.close();
    errors++;
  }

  Serial.println("Waiting 5 seconds...");
  delay(5000);
}
Post Reply