VitroIO SDK
Software development kit for Vitro Shard.
|
Class is an API for creating and sending IoT Blocks. More...
#include <iot-block.h>
Public Types | |
enum | IoTBlock_Sizes_t { SIZE_S = 16 , SIZE_M = 128 , SIZE_L = 512 , SIZE_XL = 1024 } |
IoTBlock predefined sizes. More... | |
Public Member Functions | |
struct | __attribute__ ((packed)) Frame |
Structure contains node's data needed for encryption and final CAN frame. More... | |
IoTBlock (Transport_layer *comm) | |
Construct a new IoT Block object. More... | |
int | make (uint32_t data, uint32_t parameter) |
Prepare IoT block consisting of the Initialize Vector, encrypted data, parameter ID, node Id, timestamp, digest, and signature. More... | |
int | make (void *data, size_t dataLen, uint32_t parameter) |
Prepare IoT block consisting of the Initialize Vector, encrypted data, parameter ID, node Id, timestamp, digest, and signature. More... | |
int | make (void *data, IoTBlock_Sizes_t size, uint32_t parameter) |
Prepare IoT block consisting of the Initialize Vector, encrypted data, parameter ID, node Id, timestamp, digest, and signature. Make sure that there is enough data for given size. More... | |
void | send () |
Send IoT Block by chosen transport layer. Before sending, the Block has to be prepared with the make() method. More... | |
Frame * | get_frame () |
Return pointer to Frame structure. The structure contains whole IoT block. More... | |
uint8_t * | get_frame_as_array () |
Return pointer to uint8_t array of CAN_DATA_SIZE size. The array contains whole IoT block. More... | |
void | print () |
Prints whole Iot Block data. More... | |
uint32_t | get_blob_size () |
Get the blob size. More... | |
Class is an API for creating and sending IoT Blocks.
The class wraps all crypto operations needed for creating IoT blocks. The last prepared block is stored in an object of this class and the pointer to the block can be acquired with get_iot().
IoTBlock predefined sizes.
Enumerator | |
---|---|
SIZE_S | |
SIZE_M | |
SIZE_L | |
SIZE_XL |
vitroio::sdk::IoTBlock::IoTBlock | ( | Transport_layer * | comm | ) |
Construct a new IoT Block object.
comm | Pointer to transport layer to be used. |
|
inline |
Structure contains node's data needed for encryption and final CAN frame.
All members of structure are required to be sent in CAN frame. Sensor's value is encrypted and together with Intialization Vector creates blob. nodeID, parameterID and timestamp are evident and placed at the top of encrypted data. digest is a result of SHA256 hash function on blob + parameterID + nodeID + timestamp. signature is created only on digest.
uint32_t vitroio::sdk::IoTBlock::get_blob_size | ( | ) |
Get the blob size.
Frame * vitroio::sdk::IoTBlock::get_frame | ( | ) |
Return pointer to Frame structure. The structure contains whole IoT block.
uint8_t * vitroio::sdk::IoTBlock::get_frame_as_array | ( | ) |
Return pointer to uint8_t array of CAN_DATA_SIZE size. The array contains whole IoT block.
int vitroio::sdk::IoTBlock::make | ( | uint32_t | data, |
uint32_t | parameter | ||
) |
Prepare IoT block consisting of the Initialize Vector, encrypted data, parameter ID, node Id, timestamp, digest, and signature.
data | sensor data value |
parameter | sensor's data type ID |
int vitroio::sdk::IoTBlock::make | ( | void * | data, |
IoTBlock_Sizes_t | size, | ||
uint32_t | parameter | ||
) |
Prepare IoT block consisting of the Initialize Vector, encrypted data, parameter ID, node Id, timestamp, digest, and signature. Make sure that there is enough data for given size.
data | Pointer to data to be encrypted |
size | IoTBlock size IoTBlock_Sizes_t |
parameter | Parameter ID |
int vitroio::sdk::IoTBlock::make | ( | void * | data, |
size_t | dataLen, | ||
uint32_t | parameter | ||
) |
Prepare IoT block consisting of the Initialize Vector, encrypted data, parameter ID, node Id, timestamp, digest, and signature.
data | Pointer to data to be encrypted |
dataLen | Length of data given |
parameter | Parameter ID |
void vitroio::sdk::IoTBlock::print | ( | ) |
Prints whole Iot Block data.
void vitroio::sdk::IoTBlock::send | ( | ) |
Send IoT Block by chosen transport layer. Before sending, the Block has to be prepared with the make() method.