mbed client lightswitch demo
Dependencies: mbed Socket lwip-eth lwip-sys lwip
Fork of mbed-client-classic-example-lwip by
mbed-client/mbed-client/m2mconstants.h@11:cada08fc8a70, 2016-06-09 (annotated)
- Committer:
- mbedAustin
- Date:
- Thu Jun 09 17:08:36 2016 +0000
- Revision:
- 11:cada08fc8a70
Commit for public Consumption
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mbedAustin | 11:cada08fc8a70 | 1 | /* |
| mbedAustin | 11:cada08fc8a70 | 2 | * Copyright (c) 2015 ARM Limited. All rights reserved. |
| mbedAustin | 11:cada08fc8a70 | 3 | * SPDX-License-Identifier: Apache-2.0 |
| mbedAustin | 11:cada08fc8a70 | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
| mbedAustin | 11:cada08fc8a70 | 5 | * not use this file except in compliance with the License. |
| mbedAustin | 11:cada08fc8a70 | 6 | * You may obtain a copy of the License at |
| mbedAustin | 11:cada08fc8a70 | 7 | * |
| mbedAustin | 11:cada08fc8a70 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| mbedAustin | 11:cada08fc8a70 | 9 | * |
| mbedAustin | 11:cada08fc8a70 | 10 | * Unless required by applicable law or agreed to in writing, software |
| mbedAustin | 11:cada08fc8a70 | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| mbedAustin | 11:cada08fc8a70 | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| mbedAustin | 11:cada08fc8a70 | 13 | * See the License for the specific language governing permissions and |
| mbedAustin | 11:cada08fc8a70 | 14 | * limitations under the License. |
| mbedAustin | 11:cada08fc8a70 | 15 | */ |
| mbedAustin | 11:cada08fc8a70 | 16 | #ifndef M2MCONSTANTS_H |
| mbedAustin | 11:cada08fc8a70 | 17 | #define M2MCONSTANTS_H |
| mbedAustin | 11:cada08fc8a70 | 18 | |
| mbedAustin | 11:cada08fc8a70 | 19 | #include <stdint.h> |
| mbedAustin | 11:cada08fc8a70 | 20 | #include "m2mconfig.h" |
| mbedAustin | 11:cada08fc8a70 | 21 | |
| mbedAustin | 11:cada08fc8a70 | 22 | const int MAX_VALUE_LENGTH = 256; |
| mbedAustin | 11:cada08fc8a70 | 23 | const int BUFFER_LENGTH = 1024; |
| mbedAustin | 11:cada08fc8a70 | 24 | extern const String COAP; |
| mbedAustin | 11:cada08fc8a70 | 25 | const int32_t MINIMUM_REGISTRATION_TIME = 60; //in seconds |
| mbedAustin | 11:cada08fc8a70 | 26 | const uint64_t ONE_SECOND_TIMER = 1; |
| mbedAustin | 11:cada08fc8a70 | 27 | const uint16_t MAX_ALLOWED_STRING_LENGTH = 64; |
| mbedAustin | 11:cada08fc8a70 | 28 | const uint16_t OPTIMUM_LIFETIME = 3600; |
| mbedAustin | 11:cada08fc8a70 | 29 | const uint16_t REDUCE_LIFETIME = 900; |
| mbedAustin | 11:cada08fc8a70 | 30 | const float REDUCTION_FACTOR = 0.75f; |
| mbedAustin | 11:cada08fc8a70 | 31 | |
| mbedAustin | 11:cada08fc8a70 | 32 | const int RETRY_COUNT = 2; |
| mbedAustin | 11:cada08fc8a70 | 33 | const int RETRY_INTERVAL = 5; |
| mbedAustin | 11:cada08fc8a70 | 34 | |
| mbedAustin | 11:cada08fc8a70 | 35 | // values per: draft-ietf-core-observe-16 |
| mbedAustin | 11:cada08fc8a70 | 36 | // OMA LWM2M CR ref. |
| mbedAustin | 11:cada08fc8a70 | 37 | #define START_OBSERVATION 0 |
| mbedAustin | 11:cada08fc8a70 | 38 | #define STOP_OBSERVATION 1 |
| mbedAustin | 11:cada08fc8a70 | 39 | |
| mbedAustin | 11:cada08fc8a70 | 40 | // PUT attributes to be checked from server |
| mbedAustin | 11:cada08fc8a70 | 41 | extern const String EQUAL; |
| mbedAustin | 11:cada08fc8a70 | 42 | extern const String AMP; |
| mbedAustin | 11:cada08fc8a70 | 43 | extern const String PMIN; |
| mbedAustin | 11:cada08fc8a70 | 44 | extern const String PMAX; |
| mbedAustin | 11:cada08fc8a70 | 45 | extern const String GT; |
| mbedAustin | 11:cada08fc8a70 | 46 | extern const String LT; |
| mbedAustin | 11:cada08fc8a70 | 47 | extern const String ST; |
| mbedAustin | 11:cada08fc8a70 | 48 | extern const String CANCEL; |
| mbedAustin | 11:cada08fc8a70 | 49 | |
| mbedAustin | 11:cada08fc8a70 | 50 | //LWM2MOBJECT NAME/ID |
| mbedAustin | 11:cada08fc8a70 | 51 | extern const String M2M_SECURITY_ID; |
| mbedAustin | 11:cada08fc8a70 | 52 | extern const String M2M_SERVER_ID; |
| mbedAustin | 11:cada08fc8a70 | 53 | extern const String M2M_ACCESS_CONTROL_ID; |
| mbedAustin | 11:cada08fc8a70 | 54 | extern const String M2M_DEVICE_ID; |
| mbedAustin | 11:cada08fc8a70 | 55 | |
| mbedAustin | 11:cada08fc8a70 | 56 | extern const String M2M_CONNECTIVITY_MONITOR_ID; |
| mbedAustin | 11:cada08fc8a70 | 57 | extern const String M2M_FIRMWARE_ID; |
| mbedAustin | 11:cada08fc8a70 | 58 | extern const String M2M_LOCATION_ID; |
| mbedAustin | 11:cada08fc8a70 | 59 | extern const String M2M_CONNECTIVITY_STATISTICS_ID; |
| mbedAustin | 11:cada08fc8a70 | 60 | extern const String RESERVED_ID; |
| mbedAustin | 11:cada08fc8a70 | 61 | |
| mbedAustin | 11:cada08fc8a70 | 62 | //OBJECT RESOURCE TYPE |
| mbedAustin | 11:cada08fc8a70 | 63 | extern const String OMA_RESOURCE_TYPE; |
| mbedAustin | 11:cada08fc8a70 | 64 | |
| mbedAustin | 11:cada08fc8a70 | 65 | //DEVICE RESOURCES |
| mbedAustin | 11:cada08fc8a70 | 66 | extern const String DEVICE_MANUFACTURER; |
| mbedAustin | 11:cada08fc8a70 | 67 | extern const String DEVICE_DEVICE_TYPE; |
| mbedAustin | 11:cada08fc8a70 | 68 | extern const String DEVICE_MODEL_NUMBER; |
| mbedAustin | 11:cada08fc8a70 | 69 | extern const String DEVICE_SERIAL_NUMBER; |
| mbedAustin | 11:cada08fc8a70 | 70 | extern const String DEVICE_HARDWARE_VERSION; |
| mbedAustin | 11:cada08fc8a70 | 71 | extern const String DEVICE_FIRMWARE_VERSION; |
| mbedAustin | 11:cada08fc8a70 | 72 | extern const String DEVICE_SOFTWARE_VERSION; |
| mbedAustin | 11:cada08fc8a70 | 73 | extern const String DEVICE_REBOOT; |
| mbedAustin | 11:cada08fc8a70 | 74 | extern const String DEVICE_FACTORY_RESET; |
| mbedAustin | 11:cada08fc8a70 | 75 | extern const String DEVICE_AVAILABLE_POWER_SOURCES; |
| mbedAustin | 11:cada08fc8a70 | 76 | extern const String DEVICE_POWER_SOURCE_VOLTAGE; |
| mbedAustin | 11:cada08fc8a70 | 77 | extern const String DEVICE_POWER_SOURCE_CURRENT; |
| mbedAustin | 11:cada08fc8a70 | 78 | extern const String DEVICE_BATTERY_LEVEL; |
| mbedAustin | 11:cada08fc8a70 | 79 | extern const String DEVICE_BATTERY_STATUS; |
| mbedAustin | 11:cada08fc8a70 | 80 | extern const String DEVICE_MEMORY_FREE; |
| mbedAustin | 11:cada08fc8a70 | 81 | extern const String DEVICE_MEMORY_TOTAL; |
| mbedAustin | 11:cada08fc8a70 | 82 | extern const String DEVICE_ERROR_CODE; |
| mbedAustin | 11:cada08fc8a70 | 83 | extern const String DEVICE_RESET_ERROR_CODE; |
| mbedAustin | 11:cada08fc8a70 | 84 | extern const String DEVICE_CURRENT_TIME; |
| mbedAustin | 11:cada08fc8a70 | 85 | extern const String DEVICE_UTC_OFFSET; |
| mbedAustin | 11:cada08fc8a70 | 86 | extern const String DEVICE_TIMEZONE; |
| mbedAustin | 11:cada08fc8a70 | 87 | extern const String DEVICE_SUPPORTED_BINDING_MODE; |
| mbedAustin | 11:cada08fc8a70 | 88 | |
| mbedAustin | 11:cada08fc8a70 | 89 | extern const String BINDING_MODE_UDP; |
| mbedAustin | 11:cada08fc8a70 | 90 | extern const String BINDING_MODE_UDP_QUEUE; |
| mbedAustin | 11:cada08fc8a70 | 91 | extern const String BINDING_MODE_SMS; |
| mbedAustin | 11:cada08fc8a70 | 92 | extern const String BINDING_MODE_SMS_QUEUE; |
| mbedAustin | 11:cada08fc8a70 | 93 | |
| mbedAustin | 11:cada08fc8a70 | 94 | extern const String ERROR_CODE_VALUE; |
| mbedAustin | 11:cada08fc8a70 | 95 | |
| mbedAustin | 11:cada08fc8a70 | 96 | |
| mbedAustin | 11:cada08fc8a70 | 97 | |
| mbedAustin | 11:cada08fc8a70 | 98 | //SECURITY RESOURCES |
| mbedAustin | 11:cada08fc8a70 | 99 | extern const String SECURITY_M2M_SERVER_URI; |
| mbedAustin | 11:cada08fc8a70 | 100 | extern const String SECURITY_BOOTSTRAP_SERVER; |
| mbedAustin | 11:cada08fc8a70 | 101 | extern const String SECURITY_SECURITY_MODE; |
| mbedAustin | 11:cada08fc8a70 | 102 | extern const String SECURITY_PUBLIC_KEY; |
| mbedAustin | 11:cada08fc8a70 | 103 | extern const String SECURITY_SERVER_PUBLIC_KEY; |
| mbedAustin | 11:cada08fc8a70 | 104 | extern const String SECURITY_SECRET_KEY; |
| mbedAustin | 11:cada08fc8a70 | 105 | extern const String SECURITY_SMS_SECURITY_MODE; |
| mbedAustin | 11:cada08fc8a70 | 106 | extern const String SECURITY_SMS_BINDING_KEY; |
| mbedAustin | 11:cada08fc8a70 | 107 | extern const String SECURITY_SMS_BINDING_SECRET_KEY; |
| mbedAustin | 11:cada08fc8a70 | 108 | extern const String SECURITY_M2M_SERVER_SMS_NUMBER; |
| mbedAustin | 11:cada08fc8a70 | 109 | extern const String SECURITY_SHORT_SERVER_ID; |
| mbedAustin | 11:cada08fc8a70 | 110 | extern const String SECURITY_CLIENT_HOLD_OFF_TIME; |
| mbedAustin | 11:cada08fc8a70 | 111 | |
| mbedAustin | 11:cada08fc8a70 | 112 | //SERVER RESOURCES |
| mbedAustin | 11:cada08fc8a70 | 113 | extern const String SERVER_SHORT_SERVER_ID; |
| mbedAustin | 11:cada08fc8a70 | 114 | extern const String SERVER_LIFETIME; |
| mbedAustin | 11:cada08fc8a70 | 115 | extern const String SERVER_DEFAULT_MIN_PERIOD; |
| mbedAustin | 11:cada08fc8a70 | 116 | extern const String SERVER_DEFAULT_MAX_PERIOD; |
| mbedAustin | 11:cada08fc8a70 | 117 | extern const String SERVER_DISABLE; |
| mbedAustin | 11:cada08fc8a70 | 118 | extern const String SERVER_DISABLE_TIMEOUT; |
| mbedAustin | 11:cada08fc8a70 | 119 | extern const String SERVER_NOTIFICATION_STORAGE; |
| mbedAustin | 11:cada08fc8a70 | 120 | extern const String SERVER_BINDING; |
| mbedAustin | 11:cada08fc8a70 | 121 | extern const String SERVER_REGISTRATION_UPDATE; |
| mbedAustin | 11:cada08fc8a70 | 122 | |
| mbedAustin | 11:cada08fc8a70 | 123 | //FIRMWARE RESOURCES |
| mbedAustin | 11:cada08fc8a70 | 124 | extern const String FIRMWARE_PACKAGE; |
| mbedAustin | 11:cada08fc8a70 | 125 | extern const String FIRMWARE_PACKAGE_URI; |
| mbedAustin | 11:cada08fc8a70 | 126 | extern const String FIRMWARE_UPDATE; |
| mbedAustin | 11:cada08fc8a70 | 127 | extern const String FIRMWARE_STATE; |
| mbedAustin | 11:cada08fc8a70 | 128 | extern const String FIRMWARE_UPDATE_SUPPORTED_OBJECTS; |
| mbedAustin | 11:cada08fc8a70 | 129 | extern const String FIRMWARE_UPDATE_RESULT; |
| mbedAustin | 11:cada08fc8a70 | 130 | extern const String FIRMWARE_PACKAGE_NAME; |
| mbedAustin | 11:cada08fc8a70 | 131 | extern const String FIRMWARE_PACKAGE_VERSION; |
| mbedAustin | 11:cada08fc8a70 | 132 | |
| mbedAustin | 11:cada08fc8a70 | 133 | // TLV serializer / deserializer |
| mbedAustin | 11:cada08fc8a70 | 134 | const uint8_t TYPE_RESOURCE = 0xC0; |
| mbedAustin | 11:cada08fc8a70 | 135 | const uint8_t TYPE_MULTIPLE_RESOURCE = 0x80; |
| mbedAustin | 11:cada08fc8a70 | 136 | const uint8_t TYPE_RESOURCE_INSTANCE = 0x40; |
| mbedAustin | 11:cada08fc8a70 | 137 | const uint8_t TYPE_OBJECT_INSTANCE = 0x0; |
| mbedAustin | 11:cada08fc8a70 | 138 | |
| mbedAustin | 11:cada08fc8a70 | 139 | const uint8_t ID8 = 0x0; |
| mbedAustin | 11:cada08fc8a70 | 140 | const uint8_t ID16 = 0x20; |
| mbedAustin | 11:cada08fc8a70 | 141 | |
| mbedAustin | 11:cada08fc8a70 | 142 | const uint8_t LENGTH8 = 0x08; |
| mbedAustin | 11:cada08fc8a70 | 143 | const uint8_t LENGTH16 = 0x10; |
| mbedAustin | 11:cada08fc8a70 | 144 | const uint8_t LENGTH24 = 0x18; |
| mbedAustin | 11:cada08fc8a70 | 145 | |
| mbedAustin | 11:cada08fc8a70 | 146 | const uint8_t COAP_CONTENT_OMA_TLV_TYPE = 99; |
| mbedAustin | 11:cada08fc8a70 | 147 | const uint8_t COAP_CONTENT_OMA_JSON_TYPE = 100; |
| mbedAustin | 11:cada08fc8a70 | 148 | |
| mbedAustin | 11:cada08fc8a70 | 149 | const uint16_t MAX_UNINT_16_COUNT = 65535; |
| mbedAustin | 11:cada08fc8a70 | 150 | |
| mbedAustin | 11:cada08fc8a70 | 151 | #endif // M2MCONSTANTS_H |
Austin Blackstone
