LoRa-BLE-Sensor
Loading...
Searching...
No Matches
ble_sensor_service.h
Go to the documentation of this file.
1
16#ifndef BLE_SENSOR_SERVICE_H
17#define BLE_SENSOR_SERVICE_H
18
19#include "sensor_app.h"
20/*
21- Service DEVICE
22- device_name (r/w)
23- hardware_version (r)
24- firmware_version (r)
25- device_type (r)
26- Commands (w)
27 - clear and resetup nvs (w)
28 - restart device (w)
29- number of sensors (r)
30- number of power configurations (r)
31- Battery Status (r)
32 - Battery State (r)
33 - Battery Level (r)
34 - Battery Voltage (r)
35 - Battery Current (r)
36 - Battery Temperature (r)
37 - Battery Percentage (r)
38*/
39
40/* Define the UUIDs for the Sensor service */
41#define BT_UUID_SENSOR_VAL BT_UUID_128_ENCODE(0x07de1ad6, 0x4f7a, 0x4156, 0x9836, 0x77690b6ed2c0)
42#define BT_UUID_SENSOR_STATE_VAL BT_UUID_128_ENCODE(0x07de1ad6, 0x4f7a, 0x4156, 0x9836, 0x77690b6ed2c1)
43
44#define BT_UUID_SENSOR1_ENABLED_VAL BT_UUID_128_ENCODE(0x07de1ad6, 0x4f7a, 0x4156, 0x9836, 0x77690b6ed2c2)
45#define BT_UUID_SENSOR1_CONFIG_VAL BT_UUID_128_ENCODE(0x07de1ad6, 0x4f7a, 0x4156, 0x9836, 0x77690b6ed2c3)
46#define BT_UUID_SENSOR1_PWR_CONFIG_VAL BT_UUID_128_ENCODE(0x07de1ad6, 0x4f7a, 0x4156, 0x9836, 0x77690b6ed2c4)
47#define BT_UUID_SENSOR1_DATA_FREQ_VAL BT_UUID_128_ENCODE(0x07de1ad6, 0x4f7a, 0x4156, 0x9836, 0x77690b6ed2c5)
48#define BT_UUID_SENSOR1_DATA_VAL BT_UUID_128_ENCODE(0x07de1ad6, 0x4f7a, 0x4156, 0x9836, 0x77690b6ed2c6)
49#define BT_UUID_SENSOR1_DATA_TIMESTAMP_VAL BT_UUID_128_ENCODE(0x07de1ad6, 0x4f7a, 0x4156, 0x9836, 0x77690b6ed2c7)
50
51#define BT_UUID_SENSOR2_ENABLED_VAL BT_UUID_128_ENCODE(0x07de1ad6, 0x4f7a, 0x4156, 0x9836, 0x77690b6ed2c8)
52#define BT_UUID_SENSOR2_CONFIG_VAL BT_UUID_128_ENCODE(0x07de1ad6, 0x4f7a, 0x4156, 0x9836, 0x77690b6ed2c9)
53#define BT_UUID_SENSOR2_PWR_CONFIG_VAL BT_UUID_128_ENCODE(0x07de1ad6, 0x4f7a, 0x4156, 0x9836, 0x77690b6ed2ca)
54#define BT_UUID_SENSOR2_DATA_FREQ_VAL BT_UUID_128_ENCODE(0x07de1ad6, 0x4f7a, 0x4156, 0x9836, 0x77690b6ed2cb)
55#define BT_UUID_SENSOR2_DATA_VAL BT_UUID_128_ENCODE(0x07de1ad6, 0x4f7a, 0x4156, 0x9836, 0x77690b6ed2cc)
56#define BT_UUID_SENSOR2_DATA_TIMESTAMP_VAL BT_UUID_128_ENCODE(0x07de1ad6, 0x4f7a, 0x4156, 0x9836, 0x77690b6ed2cd)
57
58/* Attach the UUIDs for the Sensor service */
59#define BT_UUID_SENSOR BT_UUID_DECLARE_128(BT_UUID_SENSOR_VAL)
60#define BT_UUID_SENSOR_STATE BT_UUID_DECLARE_128(BT_UUID_SENSOR_STATE_VAL)
61
62#define BT_UUID_SENSOR1_ENABLED BT_UUID_DECLARE_128(BT_UUID_SENSOR1_ENABLED_VAL)
63#define BT_UUID_SENSOR1_CONFIG BT_UUID_DECLARE_128(BT_UUID_SENSOR1_CONFIG_VAL)
64#define BT_UUID_SENSOR1_PWR_CONFIG BT_UUID_DECLARE_128(BT_UUID_SENSOR1_PWR_CONFIG_VAL)
65#define BT_UUID_SENSOR1_DATA_FREQ BT_UUID_DECLARE_128(BT_UUID_SENSOR1_DATA_FREQ_VAL)
66#define BT_UUID_SENSOR1_DATA BT_UUID_DECLARE_128(BT_UUID_SENSOR1_DATA_VAL)
67#define BT_UUID_SENSOR1_DATA_TIMESTAMP BT_UUID_DECLARE_128(BT_UUID_SENSOR1_DATA_TIMESTAMP_VAL)
68
69#define BT_UUID_SENSOR2_ENABLED BT_UUID_DECLARE_128(BT_UUID_SENSOR2_ENABLED_VAL)
70#define BT_UUID_SENSOR2_CONFIG BT_UUID_DECLARE_128(BT_UUID_SENSOR2_CONFIG_VAL)
71#define BT_UUID_SENSOR2_PWR_CONFIG BT_UUID_DECLARE_128(BT_UUID_SENSOR2_PWR_CONFIG_VAL)
72#define BT_UUID_SENSOR2_DATA_FREQ BT_UUID_DECLARE_128(BT_UUID_SENSOR2_DATA_FREQ_VAL)
73#define BT_UUID_SENSOR2_DATA BT_UUID_DECLARE_128(BT_UUID_SENSOR2_DATA_VAL)
74#define BT_UUID_SENSOR2_DATA_TIMESTAMP BT_UUID_DECLARE_128(BT_UUID_SENSOR2_DATA_TIMESTAMP_VAL)
75
83
84#endif
int ble_sensor_service_init(sensor_app_config_t *config)
Initialize the BLE sensor service.
Definition ble_sensor_service.c:499
A library to manage sensor applications. Working between power configurations, data configurations,...
Structure for the sensor app configuration. This is used to store the sensor configuration and state.
Definition sensor_app.h:64