xref: /nrf52832-nimble/packages/NimBLE-latest/nimble/host/services/dis/include/services/dis/ble_svc_dis.h (revision 042d53a763ad75cb1465103098bb88c245d95138)
1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *  http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied.  See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef H_BLE_SVC_DIS_
21 #define H_BLE_SVC_DIS_
22 
23 /**
24  * Example:
25  *
26  *    char firmware_revision[20] = '?.?.?';
27  *    struct image_version iv;
28  *    if (!imgr_my_version(&iv)) {
29  *	snprintf(firmware_revision, sizeof(firmware_revision),
30  *		 "%u.%u.%u", iv.iv_major, iv.iv_minor, iv.iv_revision);
31  *    }
32  *    ble_svc_dis_manufacturer_name_set("MyNewt");
33  *    ble_svc_dis_firmware_revision_set(firmware_revision);
34  *
35  */
36 
37 #define BLE_SVC_DIS_UUID16					0x180A
38 #define BLE_SVC_DIS_CHR_UUID16_MODEL_NUMBER			0x2A24
39 #define BLE_SVC_DIS_CHR_UUID16_SERIAL_NUMBER			0x2A25
40 #define BLE_SVC_DIS_CHR_UUID16_FIRMWARE_REVISION 		0x2A26
41 #define BLE_SVC_DIS_CHR_UUID16_HARDWARE_REVISION 		0x2A27
42 #define BLE_SVC_DIS_CHR_UUID16_SOFTWARE_REVISION 		0x2A28
43 #define BLE_SVC_DIS_CHR_UUID16_MANUFACTURER_NAME		0x2A29
44 
45 /**
46  * Structure holding data for the main characteristics
47  */
48 struct ble_svc_dis_data {
49     /**
50      * Model number.
51      * Represent the model number that is assigned by the device vendor.
52      */
53     const char *model_number;
54     /**
55      * Serial number.
56      * Represent the serial number for a particular instance of the device.
57      */
58     const char *serial_number;
59     /**
60      * Firmware revision.
61      * Represent the firmware revision for the firmware within the device.
62      */
63     const char *firmware_revision;
64     /**
65      * Hardware revision.
66      * Represent the hardware revision for the hardware within the device.
67      */
68     const char *hardware_revision;
69     /**
70      * Software revision.
71      * Represent the software revision for the software within the device.
72      */
73     const char *software_revision;
74     /**
75      * Manufacturer name.
76      * Represent the name of the manufacturer of the device.
77      */
78     const char *manufacturer_name;
79 };
80 
81 /**
82  * Variable holding data for the main characteristics.
83  */
84 extern struct ble_svc_dis_data ble_svc_dis_data;
85 
86 /**
87  * Service initialisation.
88  * Automatically called during package initialisation.
89  */
90 void ble_svc_dis_init(void);
91 
92 const char *ble_svc_dis_model_number(void);
93 int ble_svc_dis_model_number_set(const char *value);
94 const char *ble_svc_dis_serial_number(void);
95 int ble_svc_dis_serial_number_set(const char *value);
96 const char *ble_svc_dis_firmware_revision(void);
97 int ble_svc_dis_firmware_revision_set(const char *value);
98 const char *ble_svc_dis_hardware_revision(void);
99 int ble_svc_dis_hardware_revision_set(const char *value);
100 const char *ble_svc_dis_software_revision(void);
101 int ble_svc_dis_software_revision_set(const char *value);
102 const char *ble_svc_dis_manufacturer_name(void);
103 int ble_svc_dis_manufacturer_name_set(const char *value);
104 
105 #endif
106