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

Class to handle e12 protocol on Arduino. More...

#include <arduino_e12_protocol.h>

Inheritance diagram for e12_arduino:
e12 e12_client e12_demo

Public Member Functions

 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 int send (e12_packet_t *buf, bool retry=true)
 Send a packet to the e12 device.
 
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.
 
virtual int sleep (uint32_t ms, void *data)
 Put the device to sleep.
 
- 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 on_receive (e12_packet_t *p)
 Handles the received packet.
 
virtual int wakeup_e12_node ()
 Wakes up the e12 node.
 
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.
 

Detailed Description

Class to handle e12 protocol on Arduino.

Constructor & Destructor Documentation

◆ e12_arduino()

e12_arduino::e12_arduino ( uint32_t  vid,
uint32_t  pid 
)

Constructor for e12_arduino.

Parameters
vidVendor ID
pidProduct ID

◆ ~e12_arduino()

e12_arduino::~e12_arduino ( )

Destructor for e12_arduino.

Member Function Documentation

◆ begin()

int e12_arduino::begin ( void *  bus,
uint8_t  e12_addr = 0 
)
virtual

Initialize the e12 device.

Parameters
busI2C bus
e12_addre12 device address
Returns
int Status of initialization

Implements e12.

◆ close()

int e12_arduino::close ( )

Close the e12 device.

Returns
int Status of close operation

◆ e12_run()

void e12_arduino::e12_run ( )

Run the e12 protocol.

◆ get_log_evt()

e12_log_evt_t * e12_arduino::get_log_evt ( )
virtual

Get the log event.

Returns
e12_log_evt_t* Pointer to the log event

Implements e12.

◆ get_time_ms()

uint32_t e12_arduino::get_time_ms ( )
virtual

Get the current time in milliseconds.

Returns
uint32_t Current time in milliseconds

Implements e12.

◆ on_wakeup()

int e12_arduino::on_wakeup ( )
virtual

Handle wakeup event.

Returns
int Status of the operation

Implements e12.

◆ read()

e12_packet_t * e12_arduino::read ( )
virtual

Read a packet from the e12 device.

Returns
e12_packet_t* Pointer to the packet

Implements e12.

◆ send()

int e12_arduino::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

Implements e12.

Reimplemented in e12_client.

◆ set_node_auth_credentials()

int e12_arduino::set_node_auth_credentials ( e12_auth_data_t auth)
virtual

Set node authentication credentials.

Parameters
authAuthentication data
Returns
int Status of the operation

Implements e12.

◆ sleep()

int e12_arduino::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

Implements e12.

Reimplemented in e12_client.


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