Release candidate version. The pointer in GAS Pressure display is changed to a triangle.

Dependencies:   UniGraphic mbed vt100

Please note, at 2-Mar-2018 the current version of mbed-lib has a defect in Ticker.
https://os.mbed.com/forum/bugs-suggestions/topic/29287/

So, mbed lib version 157 is intentionally being used.
Please do not update mbed library until the problem in the above URL is fixed.

In this version, format of GAS Pressure Display has been changed.
/media/uploads/Rhyme/low.jpg

/media/uploads/Rhyme/good.jpg

/media/uploads/Rhyme/high.jpg

moto

Committer:
Rhyme
Date:
Fri Mar 02 07:56:09 2018 +0000
Revision:
0:774324cbc5a6
Release candidate version. GAS Pressure pointer is now a triangle.; Some source file clean-up was done.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:774324cbc5a6 1 #ifndef _AF_ATTRIBUTES_H_
Rhyme 0:774324cbc5a6 2 #define _AF_ATTRIBUTES_H_
Rhyme 0:774324cbc5a6 3
Rhyme 0:774324cbc5a6 4 #include "mbed.h"
Rhyme 0:774324cbc5a6 5 #include "afLib.h"
Rhyme 0:774324cbc5a6 6
Rhyme 0:774324cbc5a6 7 /**
Rhyme 0:774324cbc5a6 8 * af_attributes.h
Rhyme 0:774324cbc5a6 9 *
Rhyme 0:774324cbc5a6 10 */
Rhyme 0:774324cbc5a6 11
Rhyme 0:774324cbc5a6 12 #define ATTRIBUTE_TYPE_SINT8 2
Rhyme 0:774324cbc5a6 13 #define ATTRIBUTE_TYPE_SINT16 3
Rhyme 0:774324cbc5a6 14 #define ATTRIBUTE_TYPE_SINT32 4
Rhyme 0:774324cbc5a6 15 #define ATTRIBUTE_TYPE_SINT64 5
Rhyme 0:774324cbc5a6 16 #define ATTRIBUTE_TYPE_BOOLEAN 1
Rhyme 0:774324cbc5a6 17 #define ATTRIBUTE_TYPE_UTF8S 20
Rhyme 0:774324cbc5a6 18 #define ATTRIBUTE_TYPE_BYTES 21
Rhyme 0:774324cbc5a6 19 #define ATTRIBUTE_TYPE_FIXED_15_16 6
Rhyme 0:774324cbc5a6 20
Rhyme 0:774324cbc5a6 21 #define afSUCCESS 0 // Operation completed successfully
Rhyme 0:774324cbc5a6 22 #define afERROR_NO_SUCH_ATTRIBUTE -1 // Request was made for unknown attribute id
Rhyme 0:774324cbc5a6 23 #define afERROR_BUSY -2 // Request already in progress, try again
Rhyme 0:774324cbc5a6 24 #define afERROR_INVALID_COMMAND -3 // Command could not be parsed
Rhyme 0:774324cbc5a6 25 #define afERROR_QUEUE_OVERFLOW -4 // Queue is full
Rhyme 0:774324cbc5a6 26 #define afERROR_QUEUE_UNDERFLOW -5 // Queue is empty
Rhyme 0:774324cbc5a6 27 #define afERROR_INVALID_PARAM -6 // Bad input parameter
Rhyme 0:774324cbc5a6 28
Rhyme 0:774324cbc5a6 29 #define AF_SYSTEM_COMMAND 65012
Rhyme 0:774324cbc5a6 30 #define AF_SYSTEM_ASR_STATE 65013
Rhyme 0:774324cbc5a6 31 #define AF_SYSTEM_LINKED_TIMESTAMP 65015
Rhyme 0:774324cbc5a6 32
Rhyme 0:774324cbc5a6 33 #define MODULE_STATE_REBOOTED 0
Rhyme 0:774324cbc5a6 34 #define MODULE_STATE_LINKED 1
Rhyme 0:774324cbc5a6 35 #define MODULE_STATE_UPDATING 2
Rhyme 0:774324cbc5a6 36 #define MOUDLE_STATE_UPDATE_READY 3
Rhyme 0:774324cbc5a6 37
Rhyme 0:774324cbc5a6 38 #define MODULE_COMMAND_NONE 0
Rhyme 0:774324cbc5a6 39 #define MODULE_COMMAND_REBOOT 1
Rhyme 0:774324cbc5a6 40
Rhyme 0:774324cbc5a6 41 #define ATTR_SENSE_VAL 1
Rhyme 0:774324cbc5a6 42 #define ATTR_ACCEL_PRESENT 100
Rhyme 0:774324cbc5a6 43 #define ATTR_ACCEL_ENABLE 101
Rhyme 0:774324cbc5a6 44 #define ATTR_ACCEL_INTERVAL 102
Rhyme 0:774324cbc5a6 45 #define ATTR_ACCEL_VALUE 103
Rhyme 0:774324cbc5a6 46
Rhyme 0:774324cbc5a6 47 #define ATTR_COLOR0_PRESENT 200
Rhyme 0:774324cbc5a6 48 #define ATTR_COLOR0_ENABLE 201
Rhyme 0:774324cbc5a6 49 #define ATTR_COLOR0_INTERVAL 202
Rhyme 0:774324cbc5a6 50 #define ATTR_COLOR0_TRIGMODE 203
Rhyme 0:774324cbc5a6 51 #define ATTR_COLOR0_ITIME 204
Rhyme 0:774324cbc5a6 52 #define ATTR_COLOR0_CALIBRATE 205
Rhyme 0:774324cbc5a6 53 #define ATTR_COLOR0_PWM_R 206
Rhyme 0:774324cbc5a6 54 #define ATTR_COLOR0_PWM_G 207
Rhyme 0:774324cbc5a6 55 #define ATTR_COLOR0_PWM_B 208
Rhyme 0:774324cbc5a6 56 #define ATTR_COLOR0_PWM_PERIOD 209
Rhyme 0:774324cbc5a6 57 #define ATTR_COLOR0_PWM_TARGET 210
Rhyme 0:774324cbc5a6 58 #define ATTR_COLOR0_R_VALUE 211
Rhyme 0:774324cbc5a6 59 #define ATTR_COLOR0_G_VALUE 212
Rhyme 0:774324cbc5a6 60 #define ATTR_COLOR0_B_VALUE 213
Rhyme 0:774324cbc5a6 61
Rhyme 0:774324cbc5a6 62 #define ATTR_COLOR1_PRESENT 220
Rhyme 0:774324cbc5a6 63 #define ATTR_COLOR1_ENABLE 221
Rhyme 0:774324cbc5a6 64 #define ATTR_COLOR1_INTERVAL 222
Rhyme 0:774324cbc5a6 65 #define ATTR_COLOR1_TRIGMODE 223
Rhyme 0:774324cbc5a6 66 #define ATTR_COLOR1_ITIME 224
Rhyme 0:774324cbc5a6 67 #define ATTR_COLOR1_CALIBRATE 225
Rhyme 0:774324cbc5a6 68 #define ATTR_COLOR1_PWM_R 226
Rhyme 0:774324cbc5a6 69 #define ATTR_COLOR1_PWM_G 227
Rhyme 0:774324cbc5a6 70 #define ATTR_COLOR1_PWM_B 228
Rhyme 0:774324cbc5a6 71 #define ATTR_COLOR1_PWM_PERIOD 229
Rhyme 0:774324cbc5a6 72 #define ATTR_COLOR1_PWM_TARGET 230
Rhyme 0:774324cbc5a6 73 #define ATTR_COLOR1_R_VALUE 231
Rhyme 0:774324cbc5a6 74 #define ATTR_COLOR1_G_VALUE 232
Rhyme 0:774324cbc5a6 75 #define ATTR_COLOR1_B_VALUE 233
Rhyme 0:774324cbc5a6 76
Rhyme 0:774324cbc5a6 77 /* temperature sensor LM75B with color0 */
Rhyme 0:774324cbc5a6 78 #define ATTR_TEMP0_PRESENT 300
Rhyme 0:774324cbc5a6 79 #define ATTR_TEMP0_ENABLE 301
Rhyme 0:774324cbc5a6 80 #define ATTR_TEMP0_INTERVAL 302
Rhyme 0:774324cbc5a6 81 #define ATTR_TEMP0_VALUE 303
Rhyme 0:774324cbc5a6 82
Rhyme 0:774324cbc5a6 83 /* temperature sensor AT502-11 (before) */
Rhyme 0:774324cbc5a6 84 #define ATTR_TEMP1_PRESENT 310
Rhyme 0:774324cbc5a6 85 #define ATTR_TEMP1_ENABLE 311
Rhyme 0:774324cbc5a6 86 #define ATTR_TEMP1_INTERVAL 312
Rhyme 0:774324cbc5a6 87 #define ATTR_TEMP1_VALUE 313
Rhyme 0:774324cbc5a6 88
Rhyme 0:774324cbc5a6 89 /* temperature sensor AT502-11 (after) */
Rhyme 0:774324cbc5a6 90 #define ATTR_TEMP2_PRESENT 320
Rhyme 0:774324cbc5a6 91 #define ATTR_TEMP2_ENABLE 321
Rhyme 0:774324cbc5a6 92 #define ATTR_TEMP2_INTERVAL 322
Rhyme 0:774324cbc5a6 93 #define ATTR_TEMP2_VALUE 323
Rhyme 0:774324cbc5a6 94
Rhyme 0:774324cbc5a6 95 /* temperature sensor LM75B with color1 */
Rhyme 0:774324cbc5a6 96 #define ATTR_TEMP3_PRESENT 330
Rhyme 0:774324cbc5a6 97 #define ATTR_TEMP3_ENABLE 331
Rhyme 0:774324cbc5a6 98 #define ATTR_TEMP3_INTERVAL 332
Rhyme 0:774324cbc5a6 99 #define ATTR_TEMP3_VALUE 333
Rhyme 0:774324cbc5a6 100
Rhyme 0:774324cbc5a6 101 /* gas pressure sensor */
Rhyme 0:774324cbc5a6 102 /* gas pressure sensor */
Rhyme 0:774324cbc5a6 103 #define ATTR_GAS_PRESENT 400
Rhyme 0:774324cbc5a6 104 #define ATTR_GAS_ENABLE 401
Rhyme 0:774324cbc5a6 105 #define ATTR_GAS_INTERVAL 402
Rhyme 0:774324cbc5a6 106 #define ATTR_GAS_VALUE 403
Rhyme 0:774324cbc5a6 107 #define ATTR_GAS_THR_MODE 404
Rhyme 0:774324cbc5a6 108 #define ATTR_GAS_THR_HIGH 405
Rhyme 0:774324cbc5a6 109 #define ATTR_GAS_THR_LOW 406
Rhyme 0:774324cbc5a6 110
Rhyme 0:774324cbc5a6 111 /* current trans sensor */
Rhyme 0:774324cbc5a6 112 #define ATTR_CURRENT_PRESENT 500
Rhyme 0:774324cbc5a6 113 #define ATTR_CURRENT_ENABLE 501
Rhyme 0:774324cbc5a6 114 #define ATTR_CURRENT_INTERVAL 502
Rhyme 0:774324cbc5a6 115 #define ATTR_CURRENT_VALUE 503
Rhyme 0:774324cbc5a6 116
Rhyme 0:774324cbc5a6 117 #define ATTR_SOFTWARE_RESET 666
Rhyme 0:774324cbc5a6 118 #define ATTR_DISPLAY_MODE 777
Rhyme 0:774324cbc5a6 119 #define ATTR_MCU_RESET_REASON 999
Rhyme 0:774324cbc5a6 120
Rhyme 0:774324cbc5a6 121 #define ATTR_LED 1024
Rhyme 0:774324cbc5a6 122 #define ATTR_IO0 1025
Rhyme 0:774324cbc5a6 123 #define ATTR_IO1 1026
Rhyme 0:774324cbc5a6 124 #define ATTR_IO2 1028
Rhyme 0:774324cbc5a6 125 #define ATTR_BUTTON 1030
Rhyme 0:774324cbc5a6 126 #define ATTR_IO3 1031
Rhyme 0:774324cbc5a6 127
Rhyme 0:774324cbc5a6 128 #define ATTR_BOOT_LOADER_VER 2001
Rhyme 0:774324cbc5a6 129 #define ATTR_BLE_STACK_VER 2002
Rhyme 0:774324cbc5a6 130 #define ATTR_FW_APP_VER 2003
Rhyme 0:774324cbc5a6 131 #define ATTR_DEVICE_DESC 2004
Rhyme 0:774324cbc5a6 132 #define ATTR_WIFI_VER 2006
Rhyme 0:774324cbc5a6 133
Rhyme 0:774324cbc5a6 134 #define ATTR_OFFLINE_SCHED 59001
Rhyme 0:774324cbc5a6 135 #define ATTR_SECURITY_ENABLED 60000
Rhyme 0:774324cbc5a6 136 #define ATTR_UTC_OFFSET 65001
Rhyme 0:774324cbc5a6 137 #define ATTR_CONFIGURES_SSID 65004
Rhyme 0:774324cbc5a6 138 #define ATTR_WIFI_BARS 65005
Rhyme 0:774324cbc5a6 139 #define ATTR_WIFI_STDY_STATE 65006
Rhyme 0:774324cbc5a6 140
Rhyme 0:774324cbc5a6 141 #define ATTR_COMMAND 65012
Rhyme 0:774324cbc5a6 142 #define ATTR_ASR_STATE 65013
Rhyme 0:774324cbc5a6 143 #define ATTR_LOW_BATTERY 65014
Rhyme 0:774324cbc5a6 144 #define ATTR_LINKED_TIMESTAMP 65015
Rhyme 0:774324cbc5a6 145 #define ATTR_ATTR_ACK 65018
Rhyme 0:774324cbc5a6 146 #define ATTR_REBOOT_REASON 65019
Rhyme 0:774324cbc5a6 147 #define ATTR_BLE_COMMS 65020
Rhyme 0:774324cbc5a6 148 #define ATTR_MCU_INTERFACE 65021
Rhyme 0:774324cbc5a6 149
Rhyme 0:774324cbc5a6 150 #define DISPLAY_MODE_OFF 0
Rhyme 0:774324cbc5a6 151 #define DISPLAY_MODE_GAS 1
Rhyme 0:774324cbc5a6 152 #define DISPLAY_MODE_SUMMARY 2
Rhyme 0:774324cbc5a6 153 #define DISPLAY_MODE_CHART 3
Rhyme 0:774324cbc5a6 154
Rhyme 0:774324cbc5a6 155 typedef struct {
Rhyme 0:774324cbc5a6 156 uint16_t id ;
Rhyme 0:774324cbc5a6 157 char *description ;
Rhyme 0:774324cbc5a6 158 int attribute_type ;
Rhyme 0:774324cbc5a6 159 int size ;
Rhyme 0:774324cbc5a6 160 } af_attribute_type ;
Rhyme 0:774324cbc5a6 161
Rhyme 0:774324cbc5a6 162 /**
Rhyme 0:774324cbc5a6 163 * get_af_attr
Rhyme 0:774324cbc5a6 164 * @param id attribute id value to look up
Rhyme 0:774324cbc5a6 165 * @returns index of the attribute in the af_attribute_type af_attr[]
Rhyme 0:774324cbc5a6 166 */
Rhyme 0:774324cbc5a6 167 int get_af_attr(uint16_t id) ;
Rhyme 0:774324cbc5a6 168
Rhyme 0:774324cbc5a6 169 /**
Rhyme 0:774324cbc5a6 170 * print_af_error
Rhyme 0:774324cbc5a6 171 * @param resultCode return value from afLib function(s)
Rhyme 0:774324cbc5a6 172 */
Rhyme 0:774324cbc5a6 173 void print_af_error(int resultCode) ;
Rhyme 0:774324cbc5a6 174
Rhyme 0:774324cbc5a6 175 /**
Rhyme 0:774324cbc5a6 176 * Callback that allows ASR to request an MCU attribute be changed.
Rhyme 0:774324cbc5a6 177 * You should define this function in your MCU firmware to perform application-specific actions
Rhyme 0:774324cbc5a6 178 * your code must take (e.g., updating the state of the hardware),
Rhyme 0:774324cbc5a6 179 * in light of the attribute value change.
Rhyme 0:774324cbc5a6 180 */
Rhyme 0:774324cbc5a6 181 void attributeChangeRequest(
Rhyme 0:774324cbc5a6 182 const uint8_t requestId,
Rhyme 0:774324cbc5a6 183 const uint16_t attributeId,
Rhyme 0:774324cbc5a6 184 const uint16_t valueLen,
Rhyme 0:774324cbc5a6 185 const uint8_t *value
Rhyme 0:774324cbc5a6 186 ) ;
Rhyme 0:774324cbc5a6 187
Rhyme 0:774324cbc5a6 188 /*
Rhyme 0:774324cbc5a6 189 * Application callback that allows afLib to notify that an attribute has changed.
Rhyme 0:774324cbc5a6 190 * This method will be called in response to a getAttribute call from the application
Rhyme 0:774324cbc5a6 191 * and whenever a ASR module attribute changes.
Rhyme 0:774324cbc5a6 192 */
Rhyme 0:774324cbc5a6 193 void attributeUpdatedReport(
Rhyme 0:774324cbc5a6 194 const uint8_t requestId,
Rhyme 0:774324cbc5a6 195 const uint16_t attributeId,
Rhyme 0:774324cbc5a6 196 const uint16_t valueLen,
Rhyme 0:774324cbc5a6 197 const uint8_t *value
Rhyme 0:774324cbc5a6 198 ) ;
Rhyme 0:774324cbc5a6 199
Rhyme 0:774324cbc5a6 200 extern afLib *afero ;
Rhyme 0:774324cbc5a6 201 #endif /* _AF_ATTRIBUTES_H */