e12
 
Loading...
Searching...
No Matches
e12_client Class Reference

#include <e12_client.h>

Inheritance diagram for e12_client:
e12_arduino e12 e12_demo

Public Member Functions

 e12_client (uint32_t vid, uint32_t pid)
 
 ~e12_client ()
 
int wakeup_e12_node ()
 Wakes up the e12 node.
 
int sleep (uint32_t ms, void *data)
 Put the device to sleep.
 
int send (e12_packet_t *buf, bool retry=true)
 Send a packet to the e12 device.
 
int on_receive (e12_packet_t *p)
 Handles the received packet.
 
- Public Member Functions inherited from e12_arduino
 e12_arduino (uint32_t vid, uint32_t pid)
 Constructor for e12_arduino.
 
 ~e12_arduino ()
 Destructor for e12_arduino.
 
virtual int begin (void *bus, uint8_t e12_addr=0)
 Initialize the e12 device.
 
void e12_run ()
 Run the e12 protocol.
 
int close ()
 Close the e12 device.
 
virtual uint32_t get_time_ms ()
 Get the current time in milliseconds.
 
virtual e12_packet_tread ()
 Read a packet from the e12 device.
 
virtual e12_log_evt_tget_log_evt ()
 Get the log event.
 
virtual int set_node_auth_credentials (e12_auth_data_t *auth)
 Set node authentication credentials.
 
virtual int on_wakeup ()
 Handle wakeup event.
 
- Public Member Functions inherited from e12
 e12 (uint32_t vid, uint32_t pid)
 Constructor for the e12 class.
 
 ~e12 ()
 Destructor for the e12 class.
 
e12_packet_te12_get_packet ()
 Gets a new packet for the e12 protocol.
 
e12_onwire_tencode (e12_packet_t *data)
 Encodes the given data into a packet.
 
e12_packet_tdecode (e12_onwire_t *pkt, uint8_t data)
 Decodes the given data into a packet.
 
void set_e12_device (e12_device_t *p)
 Sets the e12 device.
 
void set_product_info (uint32_t vid, uint32_t pid)
 Sets the product information.
 
void set_fwr_details (uint32_t fwr_version, mcu_arch_t arch, mcu_flashing_protocol_t protocol, bool enabled)
 Set the vmcu firmware details object.
 
uint32_t get_fwr_version ()
 Get the fwr version object.
 
uint32_t get_pin_mask ()
 Get the pin io mask object. top 16bit for analog, lower 16bit for digital.
 
uint32_t get_pin_io_mask ()
 Get the pin io mask object. top 16bit for analog, lower 16bit for digital.
 
int publish_info ()
 Publish info e.g fwr version, arch, protocol etc.
 
int publish_profile ()
 Publish profile info e.g pin configuration.
 
bool set_pin_in (uint8_t pin_number, bool is_analog=false)
 Sets the pin as input and type (analog/digital)
 
bool set_pin_out (uint8_t pin_number, bool is_analog=false)
 Sets the pin as output and type (analog/digital)
 
void set_node_properties (e12_node_properties_t *props)
 Sets the properties of the e12 node.
 
void set_timeout (uint32_t ms)
 Sets the timeout value.
 
bool is_configured ()
 Checks if the e12 endpoint is configured.
 
void set_configured (bool status)
 Set the configured status for e12 endpoint.
 
uint32_t get_version ()
 Gets the version of the e12 protocol.
 
void set_version (uint32_t v)
 Sets the version of the e12 protocol.
 
void set_pin_mask (uint32_t pin_mask, uint32_t io_mask)
 Sets the bit mask for pin and io. Recommended to be used by advanced user or else use set_pin_in and set_pin_out.
 
virtual e12_packet_tget_request (e12_cmd_t cmd, bool response=true, void *data=0)
 Gets a request packet for the given command.
 
virtual e12_packet_tget_response (e12_packet_t *p)
 Gets a response packet for the given packet.
 
bool get_message (e12_packet_t *data)
 Gets a message from the e12 protocol.
 
virtual int print_buffer (e12_onwire_t *buf)
 Prints the contents of the buffer.
 
virtual int on_ctl_read (uint8_t pin)
 allows READ state of any valid pin
 
virtual bool on_ctl_write (uint8_t pin, uint32_t val)
 Validates a WRITE request (PIN <- IN only)
 
virtual int log (uint8_t type, uint8_t status, uint32_t ts, void *data)=0
 
virtual int on_config (const char *s, int len)=0
 
virtual int on_get_state (char *s, int len, void *ctx)=0
 
virtual int on_restore_state (const char *s, int len)=0
 

Additional Inherited Members

- Static Public Member Functions inherited from e12
static uint8_t get_checksum (const char *data, uint8_t len)
 Get the checksum object.
 
- Protected Member Functions inherited from e12
e12_onwire_tget_encode_buffer ()
 Gets the buffer for encoding packets.
 
e12_onwire_tget_decode_buffer ()
 Gets the buffer for decoding packets.
 
void flush_buffer (e12_onwire_t *buf)
 Flushes the given buffer.
 
e12_node_op_status_t get_node_status ()
 Gets the status of the e12 node.
 
e12_node_op_status_t set_node_status (e12_node_op_status_t status, uint32_t data)
 Sets the status of the e12 node.
 
bool on_ctl (ctl_op_t op, uint8_t pin, uint32_t val)
 function doing basic sanity and scheduling return cmds
 
- Protected Attributes inherited from e12
uint32_t _timeout
 Timeout value in milliseconds.
 
uint8_t _seq
 Sequence number for packets.
 

Constructor & Destructor Documentation

◆ e12_client()

e12_client::e12_client ( uint32_t  vid,
uint32_t  pid 
)
inline

◆ ~e12_client()

e12_client::~e12_client ( )
inline

Member Function Documentation

◆ on_receive()

int e12_client::on_receive ( e12_packet_t p)
virtual

Handles the received packet.

Handle the received packet.

Parameters
pPointer to the received packet
Returns
0 on success, non-zero on failure
Parameters
pPointer to the received packet
Returns
int Status code

Reimplemented from e12.

◆ send()

int e12_client::send ( e12_packet_t buf,
bool  retry = true 
)
virtual

Send a packet to the e12 device.

Parameters
bufPacket buffer
Returns
int Status of send operation

Reimplemented from e12_arduino.

◆ sleep()

int e12_client::sleep ( uint32_t  ms,
void *  data 
)
virtual

Put the device to sleep.

Parameters
msSleep duration in milliseconds
dataAdditional data
Returns
int Status of the operation

Reimplemented from e12_arduino.

◆ wakeup_e12_node()

int e12_client::wakeup_e12_node ( )
virtual

Wakes up the e12 node.

Returns
0 on success, non-zero on failure

Reimplemented from e12.


The documentation for this class was generated from the following files: