Skip to content

Implement a function to get the state of state_listener_ #52

@georgevbsantiago

Description

@georgevbsantiago

Implement a get_state_listener() function

The state_listener_ variable can store several different states, it would be interesting to have a function to get the current corresponding state on the Device.

enum THINGER_STATE{
NETWORK_CONNECTING,
NETWORK_CONNECTED,
NETWORK_CONNECT_ERROR,
SOCKET_CONNECTING,
SOCKET_CONNECTED,
SOCKET_CONNECTION_ERROR,
SOCKET_DISCONNECTED,
SOCKET_TIMEOUT,
SOCKET_ERROR,
THINGER_AUTHENTICATING,
THINGER_AUTH_FAILED,
THINGER_STOP_REQUEST
};

This function can help to implement some functionality like:

If state_listener is equal to NETWORK_CONNECT_ERROR, then blink YELLOW LED;

If state_listener is equal to SOCKET_ERROR or THINGER_AUTH_FAILED, then blink RED LED;

If state_listener is equal to THINGER_AUTHENTICATEDor THINGER_AUTH_FAILED, then blink GREEN LED;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions