Python API reference GuideΒΆ

Warning

This is a legacy Python DA module API reference guide. While the DA apps written using the legacy DA module will continue to work in the newer firmware, please note that this is not actively maintained.

The name of the Python module required to write DA app in python is ziotc. An instance of the ZIOTC class must be created and methods can be accessed using the ZIOTC class.

  • class ziotc.ZIOTC

    • reg_pass_through_callback

      reg_pass_through_callback(<callback_func>)
      

      Registers the passthrough callback function with the ziotc module.

      callback_func:

      Type: def callback_func(msg):

      Description: callback function that gets called when a message intended to the userapp is sent via the ZIOTC management interface using the set_reqToUserapp command. The function gets a string argument msg that contains the message sent to the application using set_reqToUserapp command. The application can respond back to the command by returning a string from the callback method.

    • reg_new_msg_callback

      reg_new_msg_callback(<callback_func>)
      

      Registers a callback function with the ziotc module that gets called on every new message from radio control.

      callback_func:

      Type: def callback_func(msg_type, msg):

      Description: callback function that gets called when an event has occured. the event can be either a data event or a GPI event. The function is passed two arguments msg_type that contains the information on the type of event and msg contains the event data.

      The msg_type parameter can have values 0 for data events and 6 for GPI events.

    • send_next_msg

      send_next_msg(msg_type, msg)
      

      Sends a message to the Reader Gateway. The msg_type parameter indicates what kind of message is being sent out. The following values for type are supported. The msg field is the actual message that is sent out.

      ZIOTC_MSG_TYPE_DATA = 3 indicates the message is a data event and must be sent to the data interface. This is used to send data out of the reader after processing on the DA app is complete. ZIOTC_MSG_TYPE_CTRL = 4 indicates the message is a management event and must be sent on the management event interface. This can be used to send asynchronous events originating from the app (Ex: heartbeats for app). ZIOTC_MSG_TYPE_GPO = 5 indicates the message is a GPO/LED control message to be processed by the reader to control the GPO/LED as specified in the message field.

      In case the type field is set to ZIOTC_MSG_TYPE_GPO, then the message can contain an object to control GPO/LED as below.

      {
          "type": "LED",
          "led": 3,
          "color": "AMBER",
          "postActionColor": "AMBER"
      }