UniSaSA
1.0
Embedded Library
|
#include "unisasa_types.h"
Go to the source code of this file.
Data Structures | |
union | converter_t |
union | deviceAddress_t |
struct | device_t |
union | sensorType_t |
struct | sensor_t |
union | actuatorType_t |
struct | actuator_t |
Macros | |
#define | NUMSENS 64 |
#define | NUMACTS 64 |
#define | FIRST_ID_SEN 0 |
#define | FIRST_ID_ACT 0 |
#define | BYTES_ADDRESS_DEVICE 1 |
#define | ADDR_ANY 0 |
#define | BYTES_UNSIGNED_INT 4 /** for ID_t */ |
#define | BYTES_MESSAGE 8 /** MAX could be 255, see mcu memory */ |
#define | LITTLE_ENDIAN |
#define | SEND(array, size, converter) _reverseArray(array, size, converter); send(converter, size) |
#define | RECV(array, size, converter) receive(converter, size); _reverseArray(converter, size, array) |
Typedefs | |
typedef unsigned char | byte_t |
typedef union converter_t | converter_t |
typedef union deviceAddress_t | deviceAddress_t |
typedef void(* | messageHandlerFunc) (unsigned char *) |
typedef void(* | messageAndAnswerHandlerFunc) (unsigned char *request, unsigned char *reply) |
typedef struct device_t | device_t |
typedef void(* | getSensorValueFunc) (unsigned char *sensor_value) |
typedef union sensorType_t | sensorType_t |
typedef struct sensor_t | sensor_t |
typedef void(* | setActuatorValueFunc) (unsigned char *act_value) |
typedef union actuatorType_t | actuatorType_t |
typedef struct actuator_t | actuator_t |
typedef void(* | receiveUnisasa) (unsigned char *message, unsigned int size) |
typedef void(* | sendUnisasa) (unsigned char *message, unsigned int size) |
Functions | |
void | createDevice (unsigned int address, unsigned char sizeIOmsg, messageHandlerFunc callback1, messageAndAnswerHandlerFunc callback2) |
void | addSensor (unsigned int typeSensor, unsigned char sizeOutput, unsigned char typeOutput, getSensorValueFunc getValue) |
void | addActuator (unsigned int typeActuator, unsigned char sizeInput, unsigned char typeInput, setActuatorValueFunc setValue) |
void | communication (receiveUnisasa recvFunc, sendUnisasa sendFunc) |
Unisasa header file for microcontrollers. Use this API to interface your MCUs with UniSaSA easily and quickly
Definition in file unisasa.h.
typedef struct actuator_t actuator_t |
Internal use only use addActuator
typedef union actuatorType_t actuatorType_t |
Internal use only
typedef union converter_t converter_t |
Converter unsigned int/ unsigned char iternal use only.
Internal use only use createDevice()
typedef union deviceAddress_t deviceAddress_t |
Address Device Internal use only fast convert int/char*
typedef void(* getSensorValueFunc) (unsigned char *sensor_value) |
typedef void(* messageAndAnswerHandlerFunc) (unsigned char *request, unsigned char *reply) |
callback function called when a gateway send a message and wants a reply
request | received from the gateway |
reply | to send to the gateway |
typedef void(* messageHandlerFunc) (unsigned char *) |
callback function called when a gateway send a message
message | received from the gateway |
typedef void(* receiveUnisasa) (unsigned char *message, unsigned int size) |
typedef void(* sendUnisasa) (unsigned char *message, unsigned int size) |
Internal use only use addSensor()
typedef union sensorType_t sensorType_t |
Internal use only
typedef void(* setActuatorValueFunc) (unsigned char *act_value) |
void addActuator | ( | unsigned int | typeActuator, |
unsigned char | sizeInput, | ||
unsigned char | typeInput, | ||
setActuatorValueFunc | setValue | ||
) |
Add an actuator create a new internal actuator structure, dont use it directly
typeActuator | constant defined in Actuator type |
sizeInput | size actuator input in byte |
typeInput | constant defined in Sensor/Actuators IO type |
setValue | callback function (for SET_ACUATOR_VALUE message) |
void addSensor | ( | unsigned int | typeSensor, |
unsigned char | sizeOutput, | ||
unsigned char | typeOutput, | ||
getSensorValueFunc | getValue | ||
) |
Add a sensor create a new internal sensor structure, dont use it directly
typeSensor | constant defined in Sensor type |
sizeOutput | size sensor output in byte |
typeOutput | constant defined in Sensor/Actuators IO type |
getValue | callback function (for GET_SENSOR_VALUE message) |
void communication | ( | receiveUnisasa | recvFunc, |
sendUnisasa | sendFunc | ||
) |
Manage communication with the gateway Active the communication loop, it is blocking
receiveFunc | your communication device receive function |
sendFunc | your communication device send function |
void createDevice | ( | unsigned int | address, |
unsigned char | sizeIOmsg, | ||
messageHandlerFunc | callback1, | ||
messageAndAnswerHandlerFunc | callback2 | ||
) |
Setup this device Function to setup the hardware device/node/mcu
address | depends on your device, it could be unconcerned |
sizeIOmsg | (byte) request/replay to/from this device function, the callback for the 'MSG_TO_DEVICE' message function, the callback for the 'MSG_TO_DEVICE_AND_ANSWER' message |