Get IOT Status

Applicable Devices : RFD40 Premium, RFD40 Premium Plus, RFD90

Overview

Retrieves the IoT status of an RFID reader, using srfidRequestIOTStatus, and receives IoT status events after subscribing with srfidSubsribeForEvents.

Details

The "srfidRequestIOTStatus:" attempts to retrieve the IoT status of an RFID reader.


- (SRFID_RESULT)requestIOTStatus:(NSString **)responseMessage
{
    SRFID_RESULT srfid_result = SRFID_RESULT_FAILURE;

    for(int i = 0; i < 3; i++)
    {
        srfid_result = [apiInstance srfidRequestIOTStatus:readerID];
        if ((srfid_result != SRFID_RESULT_RESPONSE_TIMEOUT) && (srfid_result != SRFID_RESULT_FAILURE)) {
            break;
        }
    }

    if (srfid_result == SRFID_RESULT_SUCCESS)
    {
        NSLog(@"Get iot status success");

    }
    else if(srfid_result == SRFID_RESULT_FAILURE || srfid_result == SRFID_RESULT_RESPONSE_TIMEOUT)
    {
      NSLog(@"Timeout or Failure");


    }
    return srfid_result;
}

The code [apiInstance srfidSubsribeForEvents:(SRFID_EVENT_MASK_IOT_STATUS)]; subscribes the application to IoT status events through the RFID SDK, enabling it to receive updates when such events occur.


//Event subcribe:
[apiInstance srfidSubsribeForEvents:(SRFID_EVENT_MASK_IOT_STATUS)];

The srfidEventIOTSatusNotity: method receives the IoT status event and logs its details.


//Event:

- (void)srfidEventIOTSatusNotity:(int)readerID aIOTStatusEvent:(srfidIOTStatusEvent*)iotStatusEvent
{
    NSLog(@"\nIOTStatusEvent: cause = (%@) eptype = (%@) epname = (%@) status = (%@) reason = (%@)\n", [iotStatusEvent getCause], [iotStatusEvent getEpType], [iotStatusEvent getEpName], [iotStatusEvent getStatus], [iotStatusEvent getReason]);

}