56 #include "ble_srv_common.h" 57 #include "app_util_platform.h" 61 #define BLE_UUID_TES_SERVICE 0x0200 62 #define BLE_TES_MAX_DATA_LEN (BLE_GATT_ATT_MTU_DEFAULT - 3) 69 #define PACKED(TYPE) TYPE __attribute__ ((packed)) 72 typedef PACKED(
struct 76 }) ble_tes_temperature_t;
78 typedef PACKED(
struct 82 }) ble_tes_pressure_t;
84 typedef uint8_t ble_tes_humidity_t;
86 typedef PACKED(
struct 92 typedef PACKED(
struct 106 } ble_tes_gas_mode_t;
108 typedef PACKED(
struct 113 }) ble_tes_color_config_t;
115 typedef PACKED(
struct 117 uint16_t temperature_interval_ms;
118 uint16_t pressure_interval_ms;
119 uint16_t humidity_interval_ms;
120 uint16_t color_interval_ms;
121 uint8_t gas_interval_mode;
122 ble_tes_color_config_t color_config;
125 #define BLE_TES_CONFIG_TEMPERATURE_INT_MIN 100 126 #define BLE_TES_CONFIG_TEMPERATURE_INT_MAX 60000 127 #define BLE_TES_CONFIG_PRESSURE_INT_MIN 50 128 #define BLE_TES_CONFIG_PRESSURE_INT_MAX 60000 129 #define BLE_TES_CONFIG_HUMIDITY_INT_MIN 100 130 #define BLE_TES_CONFIG_HUMIDITY_INT_MAX 60000 131 #define BLE_TES_CONFIG_COLOR_INT_MIN 200 132 #define BLE_TES_CONFIG_COLOR_INT_MAX 60000 133 #define BLE_TES_CONFIG_GAS_MODE_MIN 1 134 #define BLE_TES_CONFIG_GAS_MODE_MAX 3 138 BLE_TES_EVT_NOTIF_TEMPERATURE,
139 BLE_TES_EVT_NOTIF_PRESSURE,
140 BLE_TES_EVT_NOTIF_HUMIDITY,
141 BLE_TES_EVT_NOTIF_GAS,
142 BLE_TES_EVT_NOTIF_COLOR,
143 BLE_TES_EVT_CONFIG_RECEIVED
151 ble_tes_evt_type_t evt_type,
162 ble_tes_temperature_t * p_init_temperature;
163 ble_tes_pressure_t * p_init_pressure;
164 ble_tes_humidity_t * p_init_humidity;
165 ble_tes_gas_t * p_init_gas;
166 ble_tes_color_t * p_init_color;
167 ble_tes_config_t * p_init_config;
274 #endif // BLE_TES_H__ ble_gatts_char_handles_t humidity_handles
Definition: ble_tes.h:181
uint32_t ble_tes_init(ble_tes_t *p_tes, const ble_tes_init_t *p_tes_init)
Function for initializing the Thingy Environment Service.
uint32_t ble_tes_gas_set(ble_tes_t *p_tes, ble_tes_gas_t *p_data)
Function for setting the gas data.
uint32_t ble_tes_pressure_set(ble_tes_t *p_tes, ble_tes_pressure_t *p_data)
Function for setting the pressure.
ble_gatts_char_handles_t gas_handles
Definition: ble_tes.h:182
uint16_t conn_handle
Definition: ble_tes.h:185
bool is_temperature_notif_enabled
Definition: ble_tes.h:186
ble_gatts_char_handles_t color_handles
Definition: ble_tes.h:183
Thingy Environment Service initialization structure.
Definition: ble_tes.h:160
void ble_tes_on_ble_evt(ble_tes_t *p_tes, ble_evt_t *p_ble_evt)
Function for handling the Thingy Environment Service's BLE events.
void(* ble_tes_evt_handler_t)(ble_tes_t *p_tes, ble_tes_evt_type_t evt_type, uint8_t *p_data, uint16_t length)
Thingy Environment Service event handler type.
Definition: ble_tes.h:150
bool is_color_notif_enabled
Definition: ble_tes.h:190
uint32_t ble_tes_temperature_set(ble_tes_t *p_tes, ble_tes_temperature_t *p_data)
Function for setting the temperature.
Thingy Environment Service structure.
Definition: ble_tes.h:175
uint16_t service_handle
Definition: ble_tes.h:178
bool is_humidity_notif_enabled
Definition: ble_tes.h:188
ble_gatts_char_handles_t pressure_handles
Definition: ble_tes.h:180
uint8_t uuid_type
Definition: ble_tes.h:177
ble_tes_evt_handler_t evt_handler
Definition: ble_tes.h:168
ble_gatts_char_handles_t temperature_handles
Definition: ble_tes.h:179
uint32_t ble_tes_color_set(ble_tes_t *p_tes, ble_tes_color_t *p_data)
Function for setting the color data.
bool is_gas_notif_enabled
Definition: ble_tes.h:189
ble_tes_evt_handler_t evt_handler
Definition: ble_tes.h:191
bool is_pressure_notif_enabled
Definition: ble_tes.h:187
ble_gatts_char_handles_t config_handles
Definition: ble_tes.h:184
uint32_t ble_tes_humidity_set(ble_tes_t *p_tes, ble_tes_humidity_t *p_data)
Function for setting the humidity.