Skip to content

Connecting to another location other than HQ?  #13

Open
@ghost

Description

Hi I am trying to set up a new GSTcpClient which reuses the GSModule created by the Wifi backpack. I am unable to connect to an address in my local network.

void connectToServer() {
  GSModule *gsPtr;
  gsPtr = &pinoccio::WifiModule::instance.bp()->gs;

  GSTcpClient client = GSTcpClient(*gsPtr);
  IPAddress ip;
  char* url = SERVER_LOCATION;

  if (!gsPtr->parseIpAddress(&ip, url)) {
    ip = gsPtr->dnsLookup(url);

    if (ip == INADDR_NONE) {
      Serial.print(F("Failed to resolve "));
      Serial.print(url);
      Serial.println(F(", reassociating to retry"));
      return;
    }
  }

  if (!client.connect(ip, 8000)) {
    Serial.println(F("HQ connection failed, reassociating to retry"));
    pinoccio::WifiModule::instance.bp()->associate();
    return;
  }

  client.print("Hello");   // Should print a raw GET or POST request
  client.flush();

  return;
}

I've dug into what's causing the error and I can pinpoint to the following:

  1. client.connect(ip, 8000) (line 75) is returning false
  2. GSModule::cid_t cid = gs.connectTcp(ip, port) is setting cid to INVALID_CID.
  3. Turning verbose logging from the GS Chipset is resulting in the following output:
>>= AT+NCMAUTO=0,0,0,1
<<= 0
>>= AT+WD
<<= 0
>>= AT+NCMAUTOCONF=11,0
<<= 0
>>= AT+NCMAUTO=0,1,0,1
<<= 0

Anyone here knows what's the root of this problem?

My code can be found at https://github.com/vicngtor/OyoroiPinoccio/blob/master/Test/TcpCall/TcpCall.ino

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions