SodaqMoja / SodaqOne-UniversalTracker-v2

6 stars 15 forks source link

How to integrate with RockBlock? #6

Closed divyabudihal closed 3 years ago

divyabudihal commented 7 years ago

Hi guys!

I am trying to use this universal tracker with the Iridium Rockblock. I have tried the the BasicSend and SendReceive examples with the SODAQ One v2, and they work perfectly. However, when I try to insert this same functionality into the transmit() function in the Universal Tracker, it hangs at the isbd.sendReceiveSBDBinary function.

In the global variables I added: int sleep_pin = 10; IridiumSBD isbd(Serial, sleep_pin);

In the setup loop I added: Serial.begin(19200);

if (DEBUG)
{
    isbd.attachConsole(SerialUSB);
    isbd.attachDiags(SerialUSB);
}

In the transmit function I added: if (SENDRECEIVE) {

    debugPrintln("SENDRECEIVE");
    debugPrintln("Will wake up Rockblock");
    isbd.begin();
    debugPrintln("Done waking up Rockblock");

    isbd.useMSSTMWorkaround(false);
    isbd.setPowerProfile(1);
    isbd.setMinimumSignalQuality(1);
    int signalQuality = -1; //placeholder for signalQuality

    isbd.setPowerProfile(1); //low power application

    int err = isbd.getSignalQuality(signalQuality);

    if (err != 0)
    {
        debugPrint("SignalQuality failed: error ");
        debugPrintln(err);
        return;
    }

    debugPrint("Signal quality is ");
    debugPrintln(signalQuality);

    // uint8_t buffer[200] = 
    // { latitude, longitude, altitude };

    /*TODO:
     *create data packets with different op codes
        -each data packet needs to have a time stamp and op code
     *create a trasmit buffer that has a size of 50 bytes
        -time stamp = time stamp of first data insertion
     *every time you insert data, check if there is enough room in the buffer to insert it
     *if there is not enough room in the transmit buffer to add data, flush data
     *if there the time since last data insertion is greater than or equal to 255 seconds, flush data
     *use delta encoding for data time stamps
    */

    uint8_t buffer[200];

    size_t bufferSize = sizeof(sendBuffer);
    err = isbd.sendReceiveSBDBinary(buffer, 20, sendBuffer, bufferSize);

    if (err != 0)
    {
        debugPrint("sendReceiveSBDText failed: error ");
        debugPrintln(err);
        return;
    }

    debugPrint("Inbound buffer size is ");
    debugPrintln(bufferSize);
    for (int i=0; i<bufferSize; ++i)
    {
        SerialUSB.write(buffer[i]);
        debugPrint("(");
        SerialUSB.print(buffer[i], HEX);
        debugPrint(") ");
    }
    debugPrint("Messages left: ");
    debugPrintln(isbd.getWaitingMessageCount());

    isbd.sleep();
}

I have attached a file that shows the output log of when I run this on my SODAQ. Even though in this case the signal quality is 0, I had these same issues when the signal quality was higher.

I would really appreciate some assistance! I do not know what is going wrong.

log.txt

SodaqMoja commented 3 years ago

Hello Divya Sorry for taking so long to react. I want to point you to https://forum.sodaq.com/ There you'll have a much greater chance to get an answer for questions like this.