afLib 1.3 which is supporting both SPI and UART

Dependencies:   vt100 mbed afLib_1_3

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers af_attributes.h Source File

af_attributes.h

00001 #ifndef _AF_ATTRIBUTES_H_
00002 #define _AF_ATTRIBUTES_H_
00003 
00004 #include "mbed.h"
00005 #include "afLib.h"
00006 
00007 /**
00008  * af_attributes.h
00009  *
00010  */
00011 
00012 #define ATTRIBUTE_TYPE_SINT8                                       2
00013 #define ATTRIBUTE_TYPE_SINT16                                      3
00014 #define ATTRIBUTE_TYPE_SINT32                                      4
00015 #define ATTRIBUTE_TYPE_SINT64                                      5
00016 #define ATTRIBUTE_TYPE_BOOLEAN                                     1
00017 #define ATTRIBUTE_TYPE_UTF8S                                      20
00018 #define ATTRIBUTE_TYPE_BYTES                                      21
00019 #define ATTRIBUTE_TYPE_FIXED_15_16                                 6
00020 
00021 #define afSUCCESS                    0    // Operation completed successfully
00022 #define afERROR_NO_SUCH_ATTRIBUTE   -1    // Request was made for unknown attribute id
00023 #define afERROR_BUSY                -2    // Request already in progress, try again
00024 #define afERROR_INVALID_COMMAND     -3    // Command could not be parsed
00025 #define afERROR_QUEUE_OVERFLOW      -4    // Queue is full
00026 #define afERROR_QUEUE_UNDERFLOW     -5    // Queue is empty
00027 #define afERROR_INVALID_PARAM       -6    // Bad input parameter
00028 
00029 #define AF_SYSTEM_COMMAND            65012
00030 #define AF_SYSTEM_ASR_STATE          65013
00031 #define AF_SYSTEM_LINKED_TIMESTAMP   65015
00032 
00033 #define MODULE_STATE_REBOOTED                 0
00034 #define MODULE_STATE_LINKED                   1
00035 #define MODULE_STATE_UPDATING                 2
00036 #define MOUDLE_STATE_UPDATE_READY             3
00037 
00038 #define MODULE_COMMAND_NONE                   0
00039 #define MODULE_COMMAND_REBOOT                 1
00040 
00041 #define ATTR_SOFTWARE_RESET          666
00042 #define ATTR_MCU_RESET_REASON        999
00043 
00044 #define ATTR_LED                 1024
00045 #define ATTR_IO0                 1025
00046 #define ATTR_IO1                 1026
00047 #define ATTR_IO2                 1028
00048 #define ATTR_BUTTON              1030
00049 #define ATTR_IO3                 1031
00050 
00051 #define ATTR_BOOT_LOADER_VER     2001
00052 #define ATTR_BLE_STACK_VER       2002
00053 #define ATTR_FW_APP_VER          2003
00054 #define ATTR_DEVICE_DESC         2004
00055 #define ATTR_WIFI_VER            2006
00056 
00057 #define ATTR_OFFLINE_SCHED      59001
00058 #define ATTR_SECURITY_ENABLED   60000
00059 #define ATTR_UTC_OFFSET         65001
00060 #define ATTR_CONFIGURES_SSID    65004
00061 #define ATTR_WIFI_BARS          65005
00062 #define ATTR_WIFI_STDY_STATE    65006
00063 
00064 #define ATTR_COMMAND            65012
00065 #define ATTR_ASR_STATE          65013
00066 #define ATTR_LOW_BATTERY        65014
00067 #define ATTR_LINKED_TIMESTAMP   65015
00068 #define ATTR_ATTR_ACK           65018
00069 #define ATTR_REBOOT_REASON      65019
00070 #define ATTR_BLE_COMMS          65020
00071 #define ATTR_MCU_INTERFACE      65021
00072 
00073 #define DISPLAY_MODE_OFF        0
00074 #define DISPLAY_MODE_GAS        1
00075 #define DISPLAY_MODE_SUMMARY    2
00076 #define DISPLAY_MODE_CHART      3
00077 
00078 typedef struct {
00079     uint16_t id ;
00080     char *description ;
00081     int attribute_type ;
00082     int size ;
00083 } af_attribute_type ;
00084 
00085 /**
00086  * get_af_attr
00087  * @param id attribute id value to look up
00088  * @returns index of the attribute in the af_attribute_type af_attr[]
00089  */
00090 int get_af_attr(uint16_t id) ;
00091 
00092 /**
00093  * print_af_error
00094  * @param resultCode return value from afLib function(s)
00095  */
00096 void print_af_error(int resultCode) ;
00097 
00098 /**
00099  * Callback that allows ASR to request an MCU attribute be changed. 
00100  * You should define this function in your MCU firmware to perform application-specific actions 
00101  * your code must take (e.g., updating the state of the hardware), 
00102  * in light of the attribute value change.
00103 */
00104 bool attributeChangeRequest(
00105     const uint8_t   requestId, 
00106     const uint16_t  attributeId,
00107     const uint16_t  valueLen,
00108     const uint8_t   *value
00109 ) ;
00110 
00111 /*
00112  * Application callback that allows afLib to notify that an attribute has changed. 
00113  * This method will be called in response to a getAttribute call from the application 
00114  * and whenever a ASR module attribute changes.
00115  */
00116 void attributeUpdatedReport(
00117     const uint8_t   requestId,
00118     const uint16_t  attributeId,
00119     const uint16_t  valueLen,
00120     const uint8_t   *value
00121 ) ;
00122 
00123 extern afLib *afero ; 
00124 #endif /* _AF_ATTRIBUTES_H */