Sigfox - more messages


#1

Hello, how to send more data (messages) in one time?
I know, that is possible to send 12 byte. But I need send 24 byte one per hour.

In example for Sigfox (\sdk_examples\sigfox) is:

if (event == BC_TAG_TEMPERATURE_EVENT_UPDATE)
{
    if (bc_module_sigfox_is_ready(&sigfox_module))
    {
        // Read temperature
        bc_tag_temperature_get_temperature_celsius(self, &temperature);

        uint8_t buffer[5];

        // First byte 0x02 says we are sending temperature
        buffer[0] = 0x02;
        // Variable temperature is converted from float to uint32_t
        // and then shifted. The decimal part is lost.
        // If you need decimal part, first multiply float by * 100 and then do the casting to uint32_t
        buffer[1] = (uint32_t) temperature;
        buffer[2] = (uint32_t) temperature >> 8;
        buffer[3] = (uint32_t) temperature >> 16;
        buffer[4] = (uint32_t) temperature >> 24;

        bc_module_sigfox_send_rf_frame(&sigfox_module, buffer, sizeof(buffer));

And I would like something as

uint8_t buffer1[12], buffer2[12];
bc_module_sigfox_send_rf_frame(&sigfox_module, buffer1, sizeof(buffer1));
bc_module_sigfox_send_rf_frame(&sigfox_module, buffer2, sizeof(buffer2));

Any idea? When I tested it, it’s not working.
Thank you for any help.


#2

It is possible, however you cannot call the functions bc_module_sigfox_send_rf_frame twice in the task. There is not any FIFO. You have to call it once and then for example in the sigfox event handler you will send second frame.

You have to create some flag or counter so in the EVENT handler you know that ther is not other frame to send. Otherwise the second send frame will call again event handler and it creates infinite loop.

So you call send rf frame once and then the event loop will look something like this:

void sigfox_module_event_handler(bc_module_sigfox_t *self, bc_module_sigfox_event_t event, void *event_param)
{
    (void) self;
    (void) event_param;

    // If event is end of transmission...
    else if (event == BC_MODULE_SIGFOX_EVENT_SEND_RF_FRAME_DONE)
    {
        if( <condition to stop the infinite sending loop> )
        {
            bc_module_sigfox_send_rf_frame(&sigfox_module, buffer, sizeof(buffer));
        }
    }
}

The best solution could be create some state machine with 3 states: WAITING, SEND 1st FRAME, SEND 2nd FRAME.