this is a sample for mbed(LPC1768)

Committer:
1
Date:
Thu Nov 19 10:17:55 2015 +0800
Revision:
0:3163adfd2cf1
????????????????????????
1.callback
2.thread
3.auto-connect,time-up

Who changed what in which revision?

UserRevisionLine numberNew contents of line
1 0:3163adfd2cf1 1 /* Automatically generated nanopb header */
1 0:3163adfd2cf1 2 /* Generated by nanopb-0.2.5 at Wed May 28 15:52:00 2014. */
1 0:3163adfd2cf1 3
1 0:3163adfd2cf1 4 #ifndef _PB_SITEWHERE_PB_H_
1 0:3163adfd2cf1 5 #define _PB_SITEWHERE_PB_H_
1 0:3163adfd2cf1 6 #include <pb.h>
1 0:3163adfd2cf1 7
1 0:3163adfd2cf1 8 #ifdef __cplusplus
1 0:3163adfd2cf1 9 extern "C" {
1 0:3163adfd2cf1 10 #endif
1 0:3163adfd2cf1 11
1 0:3163adfd2cf1 12 /* Enum definitions */
1 0:3163adfd2cf1 13 typedef enum _SiteWhere_Command {
1 0:3163adfd2cf1 14 SiteWhere_Command_REGISTER = 1,
1 0:3163adfd2cf1 15 SiteWhere_Command_ACKNOWLEDGE = 2,
1 0:3163adfd2cf1 16 SiteWhere_Command_DEVICELOCATION = 3,
1 0:3163adfd2cf1 17 SiteWhere_Command_DEVICEALERT = 4,
1 0:3163adfd2cf1 18 SiteWhere_Command_DEVICEMEASUREMENT = 5
1 0:3163adfd2cf1 19 } SiteWhere_Command;
1 0:3163adfd2cf1 20
1 0:3163adfd2cf1 21 typedef enum _Device_Command {
1 0:3163adfd2cf1 22 Device_Command_REGISTER_ACK = 1
1 0:3163adfd2cf1 23 } Device_Command;
1 0:3163adfd2cf1 24
1 0:3163adfd2cf1 25 typedef enum _Device_RegistrationAckState {
1 0:3163adfd2cf1 26 Device_RegistrationAckState_NEW_REGISTRATION = 1,
1 0:3163adfd2cf1 27 Device_RegistrationAckState_ALREADY_REGISTERED = 2,
1 0:3163adfd2cf1 28 Device_RegistrationAckState_REGISTRATION_ERROR = 3
1 0:3163adfd2cf1 29 } Device_RegistrationAckState;
1 0:3163adfd2cf1 30
1 0:3163adfd2cf1 31 typedef enum _Device_RegistrationAckError {
1 0:3163adfd2cf1 32 Device_RegistrationAckError_INVALID_SPECIFICATION = 1,
1 0:3163adfd2cf1 33 Device_RegistrationAckError_SITE_TOKEN_REQUIRED = 2
1 0:3163adfd2cf1 34 } Device_RegistrationAckError;
1 0:3163adfd2cf1 35
1 0:3163adfd2cf1 36 /* Struct definitions */
1 0:3163adfd2cf1 37 typedef struct _Device {
1 0:3163adfd2cf1 38 uint8_t dummy_field;
1 0:3163adfd2cf1 39 } Device;
1 0:3163adfd2cf1 40
1 0:3163adfd2cf1 41 typedef struct _SiteWhere {
1 0:3163adfd2cf1 42 uint8_t dummy_field;
1 0:3163adfd2cf1 43 } SiteWhere;
1 0:3163adfd2cf1 44
1 0:3163adfd2cf1 45 typedef struct _Device_Header {
1 0:3163adfd2cf1 46 Device_Command command;
1 0:3163adfd2cf1 47 bool has_originator;
1 0:3163adfd2cf1 48 char originator[30];
1 0:3163adfd2cf1 49 bool has_nestedPath;
1 0:3163adfd2cf1 50 char nestedPath[50];
1 0:3163adfd2cf1 51 bool has_nestedSpec;
1 0:3163adfd2cf1 52 char nestedSpec[40];
1 0:3163adfd2cf1 53 } Device_Header;
1 0:3163adfd2cf1 54
1 0:3163adfd2cf1 55 typedef struct _Device_RegistrationAck {
1 0:3163adfd2cf1 56 Device_RegistrationAckState state;
1 0:3163adfd2cf1 57 bool has_errorType;
1 0:3163adfd2cf1 58 Device_RegistrationAckError errorType;
1 0:3163adfd2cf1 59 bool has_errorMessage;
1 0:3163adfd2cf1 60 char errorMessage[70];
1 0:3163adfd2cf1 61 } Device_RegistrationAck;
1 0:3163adfd2cf1 62
1 0:3163adfd2cf1 63 typedef struct _SiteWhere_Acknowledge {
1 0:3163adfd2cf1 64 char hardwareId[40];
1 0:3163adfd2cf1 65 bool has_message;
1 0:3163adfd2cf1 66 char message[70];
1 0:3163adfd2cf1 67 } SiteWhere_Acknowledge;
1 0:3163adfd2cf1 68
1 0:3163adfd2cf1 69 typedef struct _SiteWhere_DeviceAlert {
1 0:3163adfd2cf1 70 char hardwareId[40];
1 0:3163adfd2cf1 71 char alertType[40];
1 0:3163adfd2cf1 72 char alertMessage[70];
1 0:3163adfd2cf1 73 bool has_eventDate;
1 0:3163adfd2cf1 74 uint64_t eventDate;
1 0:3163adfd2cf1 75 } SiteWhere_DeviceAlert;
1 0:3163adfd2cf1 76
1 0:3163adfd2cf1 77 typedef struct _SiteWhere_DeviceLocation {
1 0:3163adfd2cf1 78 char hardwareId[40];
1 0:3163adfd2cf1 79 uint64_t latitude;
1 0:3163adfd2cf1 80 uint64_t longitude;
1 0:3163adfd2cf1 81 bool has_elevation;
1 0:3163adfd2cf1 82 uint64_t elevation;
1 0:3163adfd2cf1 83 bool has_eventDate;
1 0:3163adfd2cf1 84 uint64_t eventDate;
1 0:3163adfd2cf1 85 } SiteWhere_DeviceLocation;
1 0:3163adfd2cf1 86
1 0:3163adfd2cf1 87 typedef struct _SiteWhere_Header {
1 0:3163adfd2cf1 88 SiteWhere_Command command;
1 0:3163adfd2cf1 89 bool has_originator;
1 0:3163adfd2cf1 90 char originator[30];
1 0:3163adfd2cf1 91 } SiteWhere_Header;
1 0:3163adfd2cf1 92
1 0:3163adfd2cf1 93 typedef struct _SiteWhere_Measurement {
1 0:3163adfd2cf1 94 char measurementId[30];
1 0:3163adfd2cf1 95 uint64_t measurementValue;
1 0:3163adfd2cf1 96 } SiteWhere_Measurement;
1 0:3163adfd2cf1 97
1 0:3163adfd2cf1 98 typedef struct _SiteWhere_RegisterDevice {
1 0:3163adfd2cf1 99 char hardwareId[40];
1 0:3163adfd2cf1 100 char specificationToken[40];
1 0:3163adfd2cf1 101 } SiteWhere_RegisterDevice;
1 0:3163adfd2cf1 102
1 0:3163adfd2cf1 103 typedef struct _SiteWhere_DeviceMeasurements {
1 0:3163adfd2cf1 104 char hardwareId[40];
1 0:3163adfd2cf1 105 size_t measurement_count;
1 0:3163adfd2cf1 106 SiteWhere_Measurement measurement[5];
1 0:3163adfd2cf1 107 bool has_eventDate;
1 0:3163adfd2cf1 108 uint64_t eventDate;
1 0:3163adfd2cf1 109 } SiteWhere_DeviceMeasurements;
1 0:3163adfd2cf1 110
1 0:3163adfd2cf1 111 /* Default values for struct fields */
1 0:3163adfd2cf1 112
1 0:3163adfd2cf1 113 /* Field tags (for use in manual encoding/decoding) */
1 0:3163adfd2cf1 114 #define Device_Header_command_tag 1
1 0:3163adfd2cf1 115 #define Device_Header_originator_tag 2
1 0:3163adfd2cf1 116 #define Device_Header_nestedPath_tag 3
1 0:3163adfd2cf1 117 #define Device_Header_nestedSpec_tag 4
1 0:3163adfd2cf1 118 #define Device_RegistrationAck_state_tag 1
1 0:3163adfd2cf1 119 #define Device_RegistrationAck_errorType_tag 2
1 0:3163adfd2cf1 120 #define Device_RegistrationAck_errorMessage_tag 3
1 0:3163adfd2cf1 121 #define SiteWhere_Acknowledge_hardwareId_tag 1
1 0:3163adfd2cf1 122 #define SiteWhere_Acknowledge_message_tag 2
1 0:3163adfd2cf1 123 #define SiteWhere_DeviceAlert_hardwareId_tag 1
1 0:3163adfd2cf1 124 #define SiteWhere_DeviceAlert_alertType_tag 2
1 0:3163adfd2cf1 125 #define SiteWhere_DeviceAlert_alertMessage_tag 3
1 0:3163adfd2cf1 126 #define SiteWhere_DeviceAlert_eventDate_tag 4
1 0:3163adfd2cf1 127 #define SiteWhere_DeviceLocation_hardwareId_tag 1
1 0:3163adfd2cf1 128 #define SiteWhere_DeviceLocation_latitude_tag 2
1 0:3163adfd2cf1 129 #define SiteWhere_DeviceLocation_longitude_tag 3
1 0:3163adfd2cf1 130 #define SiteWhere_DeviceLocation_elevation_tag 4
1 0:3163adfd2cf1 131 #define SiteWhere_DeviceLocation_eventDate_tag 5
1 0:3163adfd2cf1 132 #define SiteWhere_Header_command_tag 1
1 0:3163adfd2cf1 133 #define SiteWhere_Header_originator_tag 2
1 0:3163adfd2cf1 134 #define SiteWhere_Measurement_measurementId_tag 2
1 0:3163adfd2cf1 135 #define SiteWhere_Measurement_measurementValue_tag 3
1 0:3163adfd2cf1 136 #define SiteWhere_RegisterDevice_hardwareId_tag 1
1 0:3163adfd2cf1 137 #define SiteWhere_RegisterDevice_specificationToken_tag 2
1 0:3163adfd2cf1 138 #define SiteWhere_DeviceMeasurements_hardwareId_tag 1
1 0:3163adfd2cf1 139 #define SiteWhere_DeviceMeasurements_measurement_tag 2
1 0:3163adfd2cf1 140 #define SiteWhere_DeviceMeasurements_eventDate_tag 3
1 0:3163adfd2cf1 141
1 0:3163adfd2cf1 142 /* Struct field encoding specification for nanopb */
1 0:3163adfd2cf1 143 extern const pb_field_t SiteWhere_fields[1];
1 0:3163adfd2cf1 144 extern const pb_field_t SiteWhere_Header_fields[3];
1 0:3163adfd2cf1 145 extern const pb_field_t SiteWhere_RegisterDevice_fields[3];
1 0:3163adfd2cf1 146 extern const pb_field_t SiteWhere_Acknowledge_fields[3];
1 0:3163adfd2cf1 147 extern const pb_field_t SiteWhere_DeviceLocation_fields[6];
1 0:3163adfd2cf1 148 extern const pb_field_t SiteWhere_DeviceAlert_fields[5];
1 0:3163adfd2cf1 149 extern const pb_field_t SiteWhere_Measurement_fields[3];
1 0:3163adfd2cf1 150 extern const pb_field_t SiteWhere_DeviceMeasurements_fields[4];
1 0:3163adfd2cf1 151 extern const pb_field_t Device_fields[1];
1 0:3163adfd2cf1 152 extern const pb_field_t Device_Header_fields[5];
1 0:3163adfd2cf1 153 extern const pb_field_t Device_RegistrationAck_fields[4];
1 0:3163adfd2cf1 154
1 0:3163adfd2cf1 155 /* Maximum encoded size of messages (where known) */
1 0:3163adfd2cf1 156 #define SiteWhere_size 0
1 0:3163adfd2cf1 157 #define SiteWhere_Header_size 38
1 0:3163adfd2cf1 158 #define SiteWhere_RegisterDevice_size 84
1 0:3163adfd2cf1 159 #define SiteWhere_Acknowledge_size 114
1 0:3163adfd2cf1 160 #define SiteWhere_DeviceLocation_size 78
1 0:3163adfd2cf1 161 #define SiteWhere_DeviceAlert_size 165
1 0:3163adfd2cf1 162 #define SiteWhere_Measurement_size 41
1 0:3163adfd2cf1 163 #define SiteWhere_DeviceMeasurements_size 266
1 0:3163adfd2cf1 164 #define Device_size 0
1 0:3163adfd2cf1 165 #define Device_Header_size 132
1 0:3163adfd2cf1 166 #define Device_RegistrationAck_size 84
1 0:3163adfd2cf1 167
1 0:3163adfd2cf1 168 #ifdef __cplusplus
1 0:3163adfd2cf1 169 } /* extern "C" */
1 0:3163adfd2cf1 170 #endif
1 0:3163adfd2cf1 171
1 0:3163adfd2cf1 172 #endif