edge_st_sdk package

Submodules

edge_st_sdk.edge_client module

edge_client

The edge_client module contains an interface for creating edge client classes.

class edge_st_sdk.edge_client.EdgeClient[source]

Bases: object

The EdgeClient class is an interface for creating edge client classes.

abstract add_listener(listener)[source]

Add a listener.

Parameters

listener (edge_st_sdk.edge_client.EdgeClientListener) – Listener to be added.

abstract connect()[source]

Connect to the core.

abstract delete_shadow_state(callback, timeout_s)[source]

Delete the state of the shadow client.

Delete the device shadow from the cloud by publishing an empty JSON document to the corresponding shadow topics.

Parameters
  • callback – Function to be called when the response for a shadow request comes back.

  • timeout_s (int) – Timeout in seconds to perform the request.

abstract disconnect()[source]

Disconnect from the core.

abstract get_shadow_state(callback, timeout_s)[source]

Get the state of the shadow client.

Retrieve the device shadow JSON document from the cloud by publishing an empty JSON document to the corresponding shadow topics.

Parameters
  • callback – Function to be called when the response for a shadow request comes back.

  • timeout_s (int) – Timeout in seconds to perform the request.

abstract publish(topic, payload, qos)[source]

Publish a new message to the desired topic with the given quality of service.

Parameters
  • topic (str) – Topic name to publish to.

  • payload (str) – Payload to publish (JSON formatted string).

  • qos (int) – Quality of Service. Could be “0” or “1”.

abstract remove_listener(listener)[source]

Remove a listener.

Parameters

listener (edge_st_sdk.edge_client.EdgeClientListener) – Listener to be removed.

abstract subscribe(topic, qos, callback)[source]

Subscribe to the desired topic with the given quality of service and register a callback to handle the published messages.

Parameters
  • topic (str) – Topic name to publish to.

  • qos (int) – Quality of Service. Could be “0” or “1”.

  • callback – Function to be called when a new message for the subscribed topic comes in.

abstract unsubscribe(topic)[source]

Unsubscribe from the desired topic.

Parameters

topic (str) – Topic name to unsubscribe from.

abstract update_shadow_state(payload, callback, timeout_s)[source]

Update the state of the shadow client.

Update the device shadow JSON document string on the cloud by publishing the provided JSON document to the corresponding shadow topics.

Parameters
  • payload (json) – JSON document string used to update the shadow JSON document on the cloud.

  • callback – Function to be called when the response for a shadow request comes back.

  • timeout_s (int) – Timeout in seconds to perform the request.

class edge_st_sdk.edge_client.EdgeClientListener[source]

Bases: object

Interface used by the edge_st_sdk.edge_client.EdgeClient class to notify changes of a client’s status.

abstract on_status_change(client, new_status, old_status)[source]

To be called whenever a client changes its status.

Parameters
Raises

NotImplementedError` – if the method has not been implemented.

class edge_st_sdk.edge_client.EdgeClientStatus[source]

Bases: enum.Enum

Status of the client.

CONNECTED = 'CONNECTED'

Connected to the client.

CONNECTING = 'CONNECTING'

Opening a connection with the client.

DISCONNECTING = 'DISCONNECTING'

Closing the connection to the client.

IDLE = 'IDLE'

Waiting for a connection and sending advertising data.

INIT = 'INIT'

Dummy initial status.

UNREACHABLE = 'UNREACHABLE'

The client disappeared without first disconnecting.

Module contents