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