Merge "Modify GATT search service result event handling logic" into tizen
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / common / oal-utils.c
1 /*
2  * Open Adaptation Layer (OAL)
3  *
4  * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * 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, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #include <stdlib.h>
21 #include <stdio.h>
22
23 #include <dlog.h>
24 #include <string.h>
25 #include <bluetooth.h>
26 #include "oal-utils.h"
27 #include "oal-manager.h"
28
29 char *bdt_bd2str(const bt_address_t *bdaddr, bdstr_t *bdstr)
30 {
31         const uint8_t *addr = bdaddr->addr;
32
33         if (bdaddr == NULL) {
34                 *bdstr[0] = 0;
35                 return *bdstr;
36         }
37
38         snprintf(*bdstr, sizeof(bdstr_t), "%02x:%02x:%02x:%02x:%02x:%02x",
39                         addr[0], addr[1], addr[2],
40                         addr[3], addr[4], addr[5]);
41         return *bdstr;
42 }
43
44 char* convert_bdaddr_2_str(const bt_bdaddr_t *bd_addr, char *buf, int len)
45 {
46         const uint8_t *p;
47
48         if (!bd_addr)
49                 return strncpy(buf, "NULL", len);
50
51         p = bd_addr->address;
52
53         snprintf(buf, len, "%02x:%02x:%02x:%02x:%02x:%02x",
54                         p[0], p[1], p[2], p[3], p[4], p[5]);
55
56         return buf;
57 }
58
59 char *bdaddr_2_str(const bt_bdaddr_t *bd_addr)
60 {
61         static char buf[BT_ADDRESS_STR_LEN];
62         return convert_bdaddr_2_str(bd_addr, buf, BT_ADDRESS_STR_LEN);
63 }
64
65 void string_to_uuid(char *str, service_uuid_t *p_uuid)
66 {
67         uint32_t uuid0, uuid4;
68         uint16_t uuid1, uuid2, uuid3, uuid5;
69
70         sscanf(str, "%08x-%04hx-%04hx-%04hx-%08x%04hx",
71                         &uuid0, &uuid1, &uuid2, &uuid3, &uuid4, &uuid5);
72
73         uuid0 = htonl(uuid0);
74         uuid1 = htons(uuid1);
75         uuid2 = htons(uuid2);
76         uuid3 = htons(uuid3);
77         uuid4 = htonl(uuid4);
78         uuid5 = htons(uuid5);
79
80         memcpy(&(p_uuid->uuid[0]), &uuid0, 4);
81         memcpy(&(p_uuid->uuid[4]), &uuid1, 2);
82         memcpy(&(p_uuid->uuid[6]), &uuid2, 2);
83         memcpy(&(p_uuid->uuid[8]), &uuid3, 2);
84         memcpy(&(p_uuid->uuid[10]), &uuid4, 4);
85         memcpy(&(p_uuid->uuid[14]), &uuid5, 2);
86
87         return;
88 }
89
90 void oal_print_device_address_t(const bt_address_t *addr)
91 {
92         BT_INFO("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", addr->addr[0], addr->addr[1], addr->addr[2],
93                         addr->addr[3], addr->addr[4], addr->addr[5]);
94 }
95
96 void oal_convert_addr_string_to_type(unsigned char *addr,
97                 const char *address)
98 {
99         int i;
100         char *ptr = NULL;
101
102         for (i = 0; i < BT_ADDRESS_BYTES_NUM; i++) {
103                 addr[i] = strtol(address, &ptr, 16);
104                 if (ptr != NULL) {
105                         if (ptr[0] != ':')
106                                 return;
107                         address = ptr + 1;
108                 }
109         }
110 }
111
112 int oal_is_address_zero(unsigned char *addr1)
113 {
114         int i;
115         for (i = 0; i < BT_ADDRESS_BYTES_NUM; i++) {
116                 if (addr1[i] == 0)
117                         continue;
118
119                 break;
120         }
121         if (i == BT_ADDRESS_BYTES_NUM)
122                 return 1;
123         else
124                 return 0;
125 }
126
127 void uuid_to_string(service_uuid_t *p_uuid, char *str)
128 {
129         uint32_t uuid0, uuid4;
130         uint16_t uuid1, uuid2, uuid3, uuid5;
131
132         memcpy(&uuid0, &(p_uuid->uuid[0]), 4);
133         memcpy(&uuid1, &(p_uuid->uuid[4]), 2);
134         memcpy(&uuid2, &(p_uuid->uuid[6]), 2);
135         memcpy(&uuid3, &(p_uuid->uuid[8]), 2);
136         memcpy(&uuid4, &(p_uuid->uuid[10]), 4);
137         memcpy(&uuid5, &(p_uuid->uuid[14]), 2);
138
139         snprintf((char *)str, BT_UUID_STRING_MAX, "%.8x-%.4x-%.4x-%.4x-%.8x%.4x",
140                         ntohl(uuid0), ntohs(uuid1),
141                         ntohs(uuid2), ntohs(uuid3),
142                         ntohl(uuid4), ntohs(uuid5));
143 }
144
145 void uuid_to_stringname(service_uuid_t *p_uuid, char *str)
146 {
147         uint32_t uuid0, uuid4;
148         uint16_t uuid1, uuid2, uuid3, uuid5;
149         const char *uuid_name;
150         const char *uuid_name1;
151
152         memcpy(&uuid0, &(p_uuid->uuid[0]), 4);
153         memcpy(&uuid1, &(p_uuid->uuid[4]), 2);
154         memcpy(&uuid2, &(p_uuid->uuid[6]), 2);
155         memcpy(&uuid3, &(p_uuid->uuid[8]), 2);
156         memcpy(&uuid4, &(p_uuid->uuid[10]), 4);
157         memcpy(&uuid5, &(p_uuid->uuid[14]), 2);
158
159
160         uuid_name = dump_uuid_name(ntohl(uuid0));
161         uuid_name1 = dump_uuid_name((ntohl(uuid4) >> 16));
162
163         BT_DBG("UUID Name [%s]", uuid_name);
164         BT_DBG("UUID Name Shifted [%s]", uuid_name1);
165
166         snprintf((char *)str, 2*BT_UUID_STRING_MAX, "%.8x-%.4x-%.4x-%.4x-%.8x%.4x--%s",
167                         ntohl(uuid0), ntohs(uuid1),
168                         ntohs(uuid2), ntohs(uuid3),
169                         ntohl(uuid4), ntohs(uuid5),
170                         !(g_strcmp0(dump_uuid_name(ntohl(uuid0)), "--")) ? dump_uuid_name(((uuid4) >> 16)) : uuid_name);
171 }
172
173 int hex2bin(const char *s)
174 {
175         int ret = 0;
176         int i;
177         for (i = 0; i < 2; i++) {
178                 char c = *s++;
179                 int n = 0;
180                 if ('0' <= c && c <= '9')
181                         n = c-'0';
182                 else if ('a' <= c && c <= 'f')
183                         n = 10 + c-'a';
184                 else if ('A' <= c && c <= 'F')
185                         n = 10 + c-'A';
186                 ret = n + ret*16;
187         }
188         return ret;
189 }
190
191 void convert_str_2_hex(unsigned char out[], char in[])
192 {
193         int i = 0;
194         for (i = 0; i < 62; i++) {
195                 out[i] = hex2bin(in); \
196                          in += 2; \
197         }
198 }
199
200 void convert_hex_2_str(unsigned char * hex, int len, char * str_out)
201 {
202         int i = 0;
203
204         for (i = 0; i < len; i++)
205                 snprintf(str_out + (i * 3), 3*(len - i), "%02x ", hex[i]);
206
207         str_out[3*len] = 0;
208 }
209
210 void print_bt_properties(int num_properties, bt_property_t *properties)
211 {
212         int i;
213         for (i = 0; i < num_properties; i++) {
214                 bt_property_t prop;
215                 memcpy(&prop, properties + i, sizeof(prop));
216                 BT_INFO("prop: %s\n", convert_bt_property_2_str(&prop));
217         }
218 }
219
220 char* convert_scan_mode_2_str(bt_scan_mode_t scan_mode)
221 {
222         switch (scan_mode) {
223         case BT_SCAN_MODE_NONE:
224                 return "Non Scannable";
225         case BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE:
226                 return "Connectable And Discoverable";
227         case BT_SCAN_MODE_CONNECTABLE:
228                 return "Connectable";
229         default:
230                 return "Unknown Scan Mode";
231         }
232
233 }
234
235 char* convert_device_type_2_str(bt_device_type_t device_type)
236 {
237         switch (device_type) {
238         case BT_DEVICE_DEVTYPE_BREDR:
239                 return "BREDR Device";
240         case BT_DEVICE_DEVTYPE_BLE:
241                 return "BLE Device";
242         case BT_DEVICE_DEVTYPE_DUAL:
243                 return "Dual Device";
244         default:
245                 return "Unknown Device Type";
246         }
247 }
248
249 char *convert_bt_property_2_str(const bt_property_t *property)
250 {
251         static char buf[4096];
252         char *p;
253
254         p = buf + snprintf(buf, 4096, "type=%s len=%d val=",
255                         convert_property_type_2_str(property->type),
256                         property->len);
257
258         switch (property->type) {
259         case BT_PROPERTY_BDNAME:
260         case BT_PROPERTY_REMOTE_FRIENDLY_NAME:
261                 snprintf(p, property->len + 1, "%s",
262                                 ((bt_bdname_t *) property->val)->name);
263                 break;
264         case BT_PROPERTY_BDADDR:
265                 sprintf(p, "%s", bdaddr_2_str((bt_bdaddr_t *) property->val));
266                 break;
267         case BT_PROPERTY_CLASS_OF_DEVICE:
268                 sprintf(p, "%06x", *((unsigned int *) property->val));
269                 break;
270         case BT_PROPERTY_TYPE_OF_DEVICE:
271                 sprintf(p, "%s", convert_device_type_2_str(
272                                         *((bt_device_type_t *) property->val)));
273                 break;
274         case BT_PROPERTY_REMOTE_RSSI:
275                 sprintf(p, "%d", *((char *) property->val));
276                 break;
277         case BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
278                 sprintf(p, "%d", *((unsigned int *) property->val));
279                 break;
280         case BT_PROPERTY_ADAPTER_SCAN_MODE:
281                 sprintf(p, "%s",
282                                 convert_scan_mode_2_str(*((bt_scan_mode_t *) property->val)));
283                 break;
284         case BT_PROPERTY_ADAPTER_BONDED_DEVICES:
285                 break;
286         case BT_PROPERTY_UUIDS:
287                 break;
288         case BT_PROPERTY_SERVICE_RECORD:
289                 break;
290                 /* Tizen BlueZ specific Device properties */
291         case BT_PROPERTY_REMOTE_PAIRED:
292                 sprintf(p, "%d", *((uint8_t *) property->val));
293                 break;
294         case BT_PROPERTY_REMOTE_CONNECTED:
295                 sprintf(p, "%d", *((unsigned int *) property->val));
296                 break;
297         case BT_PROPERTY_REMOTE_TRUST:
298                 sprintf(p, "%d", *((uint8_t *) property->val));
299                 break;
300         case BT_PROPERTY_PAIRABLE:
301                 sprintf(p, "%d", *((uint8_t *) property->val));
302                 break;
303         case BT_PROPERTY_VERSION:
304                 snprintf(p, property->len + 1, "%s",
305                                 ((char *) property->val));
306                 break;
307         case BT_PROPERTY_LOCAL_LE_FEATURES:
308                 local_le_feat_2_string(p, property->val);
309                 break;
310         case BT_PROPERTY_PAIRABLE_TIMEOUT:
311                 sprintf(p, "%d", *((unsigned int *) property->val));
312                 break;
313         case BT_PROPERTY_IPSP_INITIALIZED:
314                 sprintf(p, "%d", *((uint8_t *) property->val));
315                 break;
316         case BT_PROPERTY_MODALIAS:
317                 snprintf(p, property->len + 1, "%s",
318                                 ((char *) property->val));
319                 break;
320         case BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA_LEN:
321                 sprintf(p, "%d", *((unsigned int *) property->val));
322                 break;
323         case BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA: {
324                 int indx;
325                 char *pppp = property->val;
326                 for (indx = 0; indx < property->len; indx++)
327                         p += sprintf(p, " %2.2X", pppp[indx]);
328                 break;
329         }
330         case BT_PROPERTY_REMOTE_BLE_ADV_DATA: {
331                 int indx;
332                 char *pppp = property->val;
333                 for (indx = 0; indx < property->len; indx++)
334                         p += sprintf(p, " %2.2X", pppp[indx]);
335                 break;
336         }
337         case BT_PROPERTY_REMOTE_IS_ALIAS_SET: {
338                 sprintf(p, "%d", *((uint8_t *) property->val));
339                 break;
340         }
341         /* End of Tizen BlueZ specific device propeties */
342         case BT_PROPERTY_REMOTE_VERSION_INFO:
343         case BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP:
344         default:
345                 sprintf(p, "%p", property->val);
346                 break;
347         }
348         return buf;
349 }
350
351 char *dump_char_prop(uint8_t prop)
352 {
353         switch (prop) {
354         CASE_RETURN_STR(BROADCAST);
355         CASE_RETURN_STR(READ);
356         CASE_RETURN_STR(WRITE_NR);
357         CASE_RETURN_STR(WRITE);
358         CASE_RETURN_STR(NOTIFY);
359         CASE_RETURN_STR(INDICATE);
360         CASE_RETURN_STR(AUTH);
361         CASE_RETURN_STR(EXT_PROP);
362         default:
363                 return "--";
364         }
365 }
366
367 char *dump_char_perm(uint8_t perm)
368 {
369         switch (perm) {
370         CASE_RETURN_STR(RD);
371         CASE_RETURN_STR(WR);
372         CASE_RETURN_STR(ENCRYPT_RD);
373         CASE_RETURN_STR(ENCRYPT_WR);
374         CASE_RETURN_STR(ENC_AUTH_RD);
375         CASE_RETURN_STR(ENC_AUTH_WR);
376         default:
377                 return "--";
378         }
379 }
380
381 char *char_prop_to_string(uint8_t prop, char *str)
382 {
383         int i, ret = 0;
384         char *ptr = str;
385
386         for (i = 0; i < 8; i++) {
387                 if (prop & (1 << i)) {
388                         ret = snprintf(ptr, 11, "%s|", dump_char_prop(prop & (1 << i)));
389                         ptr += ret;
390                 }
391         }
392         --ptr;
393         *ptr = '\0';
394         return str;
395 }
396
397 char *char_perm_to_string(uint8_t perm, char *str)
398 {
399         int i, ret = 0;
400         char *ptr = str;
401
402         for (i = 0; i < 6; i++) {
403                 if (perm & (1 << i)) {
404                         ret = snprintf(ptr, 13, "%s|", dump_char_perm(perm & (1 << i)));
405                         ptr += ret;
406                 }
407         }
408         --ptr;
409         *ptr = '\0';
410         return str;
411 }
412
413 void local_le_feat_2_string(char *str, const bt_local_le_features_t *f)
414 {
415         uint16_t scan_num;
416
417         str += snprintf(str, strlen(str), "{\n");
418
419         str += sprintf(str, "Privacy supported: %s,\n",
420                         f->local_privacy_enabled ? "TRUE" : "FALSE");
421
422         str += sprintf(str, "Num of advertising instances: %u,\n",
423                         f->max_adv_instance);
424
425         str += sprintf(str, "PRA offloading support: %s,\n",
426                         f->rpa_offload_supported ? "TRUE" : "FALSE");
427
428         str += sprintf(str, "Num of offloaded IRKs: %u,\n",
429                         f->max_irk_list_size);
430
431         str += sprintf(str, "Num of offloaded scan filters: %u,\n",
432                         f->max_adv_filter_supported);
433
434         scan_num = f->scan_result_storage_size;
435
436         str += sprintf(str, "Num of offloaded scan results: %u,\n", scan_num);
437
438         str += sprintf(str, "Activity & energy report support: %s\n",
439                         f->activity_energy_info_supported ? "TRUE" : "FALSE");
440
441         str += sprintf(str, "LE 2M PHY support: %s\n",
442                         f->le_2m_phy_supported ? "TRUE" : "FALSE");
443
444         str += sprintf(str, "LE Coded PHY support: %s\n",
445                         f->le_coded_phy_supported ? "TRUE" : "FALSE");
446
447         sprintf(str, "}");
448 }
449
450 char* convert_property_type_2_str(bt_property_type_t prop_type)
451 {
452         switch (prop_type) {
453         case BT_PROPERTY_BDNAME:
454                 return "[Bluetooth Name]";
455         case BT_PROPERTY_BDADDR:
456                 return "[Bluetooth Address]";
457         case BT_PROPERTY_UUIDS:
458                 return "[UUIDS]";
459         case BT_PROPERTY_CLASS_OF_DEVICE:
460                 return "[Class of Device]";
461         case BT_PROPERTY_TYPE_OF_DEVICE:
462                 return "[Bluetooth Type of Device]";
463         case BT_PROPERTY_SERVICE_RECORD:
464                 return "[Bluetooth Service record]";
465         case BT_PROPERTY_ADAPTER_SCAN_MODE:
466                 return "[Bluetooth Adapter Scan Mode]";
467         case BT_PROPERTY_ADAPTER_BONDED_DEVICES:
468                 return "[Bluetooth Bonded Devices]";
469         case BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
470                 return "[Bluetooth Adapter Discovery Timeout]";
471         case BT_PROPERTY_REMOTE_FRIENDLY_NAME:
472                 return "[Bluetooth Friendly Name]";
473         case BT_PROPERTY_REMOTE_RSSI:
474                 return "[Bluetooth Rmote RSSI]";
475         case BT_PROPERTY_REMOTE_VERSION_INFO:
476                 return "[Bluetooth Version Info]";
477         case BT_PROPERTY_LOCAL_LE_FEATURES:
478                 return "[Bluetooth LE Features]";
479         case BT_PROPERTY_REMOTE_PAIRED:
480                 return "[Bluetooth Remote Paired]";
481         case BT_PROPERTY_REMOTE_CONNECTED:
482                 return "[Bluetooth Remote Connected]";
483         case BT_PROPERTY_REMOTE_TRUST:
484                 return "[Bluetooth Remote TRUST]";
485         case BT_PROPERTY_PAIRABLE:
486                 return "[Bluetooth Pairable]";
487         case BT_PROPERTY_PAIRABLE_TIMEOUT:
488                 return "[Bluetooth Pairable Timeout]";
489         case BT_PROPERTY_VERSION:
490                 return "[Bluetooth Version]";
491         case BT_PROPERTY_IPSP_INITIALIZED:
492                 return "[Bluetooth IPSP Initialized]";
493         case BT_PROPERTY_MODALIAS:
494                 return "[Bluetooth ModAlias]";
495         case BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP:
496                 return "[Bluetooth Remote Device Timestamp]";
497         case BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA_LEN:
498                 return "[Bluetooth Remote Device Manufacturer Data Len]";
499         case BT_PROPERTY_REMOTE_DEVICE_MANUFACTURER_DATA:
500                 return "[Bluetooth Remote Device Manufacturer Data]";
501         case BT_PROPERTY_REMOTE_BLE_ADV_DATA:
502                 return "[Bluetooth Remote Device LE Advertising Data]";
503         default:
504                 return "[Default Property]";
505         }
506 }
507
508 const char *dump_uuid_name(int uuid_no)
509 {
510         switch (uuid_no) {
511         CASE_RETURN_STR(BASE)
512         CASE_RETURN_STR(SDP)
513         CASE_RETURN_STR(UDP)
514         CASE_RETURN_STR(RFCOMM)
515         CASE_RETURN_STR(TCP)
516         CASE_RETURN_STR(TCS_BIN)
517         CASE_RETURN_STR(TCS_AT)
518         CASE_RETURN_STR(ATT)
519         CASE_RETURN_STR(OBEX)
520         CASE_RETURN_STR(IP)
521         CASE_RETURN_STR(FTP)
522         CASE_RETURN_STR(HTTP)
523         CASE_RETURN_STR(WSP)
524         CASE_RETURN_STR(BNEP)
525         CASE_RETURN_STR(UPNP)
526         CASE_RETURN_STR(HIDP)
527         CASE_RETURN_STR(HardcopyControlChannel)
528         CASE_RETURN_STR(HardcopyDataChannel)
529         CASE_RETURN_STR(HardcopyNotification)
530         CASE_RETURN_STR(AVCTP)
531         CASE_RETURN_STR(AVDTP)
532         CASE_RETURN_STR(CMTP)
533         CASE_RETURN_STR(MCAPControlChannel)
534         CASE_RETURN_STR(MCAPDataChannel)
535         CASE_RETURN_STR(L2CAP)
536         CASE_RETURN_STR(ServiceDiscoveryServerServiceClassID)
537         CASE_RETURN_STR(BrowseGroupDescriptorServiceClassID)
538         CASE_RETURN_STR(SerialPort)
539         CASE_RETURN_STR(LANAccessUsingPPP)
540         CASE_RETURN_STR(DialupNetworking)
541         CASE_RETURN_STR(IrMCSync)
542         CASE_RETURN_STR(OBEXObjectPush)
543         CASE_RETURN_STR(OBEXFileTransfer)
544         CASE_RETURN_STR(IrMCSyncCommand)
545         CASE_RETURN_STR(Headset)
546         CASE_RETURN_STR(CordlessTelephony)
547         CASE_RETURN_STR(AudioSource)
548         CASE_RETURN_STR(AudioSink)
549         CASE_RETURN_STR(AV_RemoteControlTarget)
550         CASE_RETURN_STR(AdvancedAudioDistribution)
551         CASE_RETURN_STR(AV_RemoteControl)
552         CASE_RETURN_STR(AV_RemoteControlController)
553         CASE_RETURN_STR(Intercom)
554         CASE_RETURN_STR(Fax)
555         CASE_RETURN_STR(Headset_Audio_Gateway)
556         CASE_RETURN_STR(WAP)
557         CASE_RETURN_STR(WAP_CLIENT)
558         CASE_RETURN_STR(PANU)
559         CASE_RETURN_STR(NAP)
560         CASE_RETURN_STR(GN)
561         CASE_RETURN_STR(DirectPrinting)
562         CASE_RETURN_STR(ReferencePrinting)
563         CASE_RETURN_STR(Basic_Imaging_Profile)
564         CASE_RETURN_STR(ImagingResponder)
565         CASE_RETURN_STR(ImagingAutomaticArchive)
566         CASE_RETURN_STR(ImagingReferencedObjects)
567         CASE_RETURN_STR(Handsfree)
568         CASE_RETURN_STR(HandsfreeAudioGateway)
569         CASE_RETURN_STR(DirectPrintingReferenceObjectsService)
570         CASE_RETURN_STR(ReflectedUI)
571         CASE_RETURN_STR(BasicPrinting)
572         CASE_RETURN_STR(PrintingStatus)
573         CASE_RETURN_STR(HumanInterfaceDeviceService)
574         CASE_RETURN_STR(HardcopyCableReplacement)
575         CASE_RETURN_STR(HCR_Print)
576         CASE_RETURN_STR(HCR_Scan)
577         CASE_RETURN_STR(Common_ISDN_Access)
578         CASE_RETURN_STR(SIM_Access)
579         CASE_RETURN_STR(Phonebook_Access_PCE)
580         CASE_RETURN_STR(Phonebook_Access_PSE)
581         CASE_RETURN_STR(Phonebook_Access)
582         CASE_RETURN_STR(Headset_HS)
583         CASE_RETURN_STR(Message_Access_Server)
584         CASE_RETURN_STR(Message_Notification_Server)
585         CASE_RETURN_STR(Message_Access_Profile)
586         CASE_RETURN_STR(GNSS)
587         CASE_RETURN_STR(GNSS_Server)
588         CASE_RETURN_STR(ThreeD_Display)
589         CASE_RETURN_STR(ThreeD_Glasses)
590         CASE_RETURN_STR(ThreeD_Synchronization)
591         CASE_RETURN_STR(MPS_Profile)
592         CASE_RETURN_STR(MPS_SC)
593         CASE_RETURN_STR(CTN_Access_Service)
594         CASE_RETURN_STR(CTN_Notification_Service)
595         CASE_RETURN_STR(CTN_Profile)
596         CASE_RETURN_STR(PnPInformation)
597         CASE_RETURN_STR(GenericNetworking)
598         CASE_RETURN_STR(GenericFileTransfer)
599         CASE_RETURN_STR(GenericAudio)
600         CASE_RETURN_STR(GenericTelephony)
601         CASE_RETURN_STR(UPNP_Service)
602         CASE_RETURN_STR(UPNP_IP_Service)
603         CASE_RETURN_STR(ESDP_UPNP_IP_PAN)
604         CASE_RETURN_STR(ESDP_UPNP_IP_LAP)
605         CASE_RETURN_STR(ESDP_UPNP_L2CAP)
606         CASE_RETURN_STR(VideoSource)
607         CASE_RETURN_STR(VideoSink)
608         CASE_RETURN_STR(VideoDistribution)
609         CASE_RETURN_STR(HDP)
610         CASE_RETURN_STR(HDP_Source)
611         CASE_RETURN_STR(HDP_Sink)
612         CASE_RETURN_STR(Generic_Access)
613         CASE_RETURN_STR(Generic_Attribute)
614         CASE_RETURN_STR(Immediate_Alert)
615         CASE_RETURN_STR(Link_Loss)
616         CASE_RETURN_STR(Tx_Power)
617         CASE_RETURN_STR(Current_Time)
618         CASE_RETURN_STR(Reference_Time_Update)
619         CASE_RETURN_STR(Next_Dst_Change)
620         CASE_RETURN_STR(Glucose)
621         CASE_RETURN_STR(Health_Thermometer)
622         CASE_RETURN_STR(Device_Information)
623         CASE_RETURN_STR(Heart_Rate)
624         CASE_RETURN_STR(Phone_Alert_Status)
625         CASE_RETURN_STR(Battery_Service)
626         CASE_RETURN_STR(Blood_Pressure)
627         CASE_RETURN_STR(Alert_Notification)
628         CASE_RETURN_STR(Human_Interface_Device)
629         CASE_RETURN_STR(Scan_Parameters)
630         CASE_RETURN_STR(Running_Speed_And_Cadence)
631         CASE_RETURN_STR(Automation_IO)
632         CASE_RETURN_STR(Cycling_Speed_And_Cadence)
633         CASE_RETURN_STR(Cycling_Power)
634         CASE_RETURN_STR(Location_And_Navigation)
635         CASE_RETURN_STR(Environmental_Sensing)
636         CASE_RETURN_STR(Body_Composition)
637         CASE_RETURN_STR(User_Data)
638         CASE_RETURN_STR(Weight_Scale)
639         CASE_RETURN_STR(Bond_Management)
640         CASE_RETURN_STR(Continuous_Glucose_Monitoring)
641         CASE_RETURN_STR(Internet_Protocol_Support)
642         CASE_RETURN_STR(Indoor_Positioning)
643         CASE_RETURN_STR(Pulse_Oximeter)
644         CASE_RETURN_STR(Http_Proxy)
645         CASE_RETURN_STR(Transport_Discovery)
646         CASE_RETURN_STR(Object_Transfer)
647         CASE_RETURN_STR(Gap_Device_Name)
648         CASE_RETURN_STR(Gap_Appearance)
649         CASE_RETURN_STR(Gap_Peripheral_Privacy_Flag)
650         CASE_RETURN_STR(Gap_Reconnection_Address)
651         CASE_RETURN_STR(Gap_Peripheral_Preferred_Connection_Parameters)
652         CASE_RETURN_STR(Gatt_Service_Changed)
653         CASE_RETURN_STR(Alert_Level)
654         CASE_RETURN_STR(Tx_Power_Level)
655         CASE_RETURN_STR(Date_Time)
656         CASE_RETURN_STR(Day_Of_Week)
657         CASE_RETURN_STR(Day_Date_Time)
658         CASE_RETURN_STR(Exact_Time_256)
659         CASE_RETURN_STR(Dst_Offset)
660         CASE_RETURN_STR(Time_Zone)
661         CASE_RETURN_STR(Local_Time_Information)
662         CASE_RETURN_STR(Time_With_Dst)
663         CASE_RETURN_STR(Time_Accuracy)
664         CASE_RETURN_STR(Time_Source)
665         CASE_RETURN_STR(Reference_Time_Information)
666         CASE_RETURN_STR(Time_Update_Control_Point)
667         CASE_RETURN_STR(Time_Update_State)
668         CASE_RETURN_STR(Glucose_Measurement)
669         CASE_RETURN_STR(Battery_Level)
670         CASE_RETURN_STR(Temperature_Measurement)
671         CASE_RETURN_STR(Temperature_Type)
672         CASE_RETURN_STR(Intermediate_Temperature)
673         CASE_RETURN_STR(Measurement_Interval)
674         CASE_RETURN_STR(Boot_Keyboard_Input_Report)
675         CASE_RETURN_STR(System_Id)
676         CASE_RETURN_STR(Model_Number_String)
677         CASE_RETURN_STR(Serial_Number_String)
678         CASE_RETURN_STR(Firmware_Revision_String)
679         CASE_RETURN_STR(Hardware_Revision_String)
680         CASE_RETURN_STR(Software_Revision_String)
681         CASE_RETURN_STR(Manufacturer_Name_String)
682         CASE_RETURN_STR(Regulatory_Certification_Data_List)
683         CASE_RETURN_STR(Current_Time_Charac)
684         CASE_RETURN_STR(Magnetic_Declination)
685         CASE_RETURN_STR(Scan_Refresh)
686         CASE_RETURN_STR(Boot_Keyboard_Output_Report)
687         CASE_RETURN_STR(Boot_Mouse_Input_Report)
688         CASE_RETURN_STR(Glucose_Measurement_Context)
689         CASE_RETURN_STR(Blood_Pressure_Measurement)
690         CASE_RETURN_STR(Intermediate_Cuff_Pressure)
691         CASE_RETURN_STR(Heart_Rate_Measurement)
692         CASE_RETURN_STR(Body_Sensor_Location)
693         CASE_RETURN_STR(Heart_Rate_Control_Point)
694         CASE_RETURN_STR(Alert_Status)
695         CASE_RETURN_STR(Ringer_Control_Point)
696         CASE_RETURN_STR(Ringer_Setting)
697         CASE_RETURN_STR(Alert_Category_Id_Bit_Mask)
698         CASE_RETURN_STR(Alert_Category_Id)
699         CASE_RETURN_STR(Alert_Notification_Control_Point)
700         CASE_RETURN_STR(Unread_Alert_Status)
701         CASE_RETURN_STR(New_Alert)
702         CASE_RETURN_STR(Supported_New_Alert_Category)
703         CASE_RETURN_STR(Supported_Unread_Alert_Category)
704         CASE_RETURN_STR(Blood_Pressure_Feature)
705         CASE_RETURN_STR(Hid_Information)
706         CASE_RETURN_STR(Report_Map)
707         CASE_RETURN_STR(Hid_Control_Point)
708         CASE_RETURN_STR(Report)
709         CASE_RETURN_STR(Protocol_Mode)
710         CASE_RETURN_STR(Scan_Interval_Window)
711         CASE_RETURN_STR(Pnp_Id)
712         CASE_RETURN_STR(Glucose_Feature)
713         CASE_RETURN_STR(Record_Access_Control_Point)
714         CASE_RETURN_STR(Rsc_Measurement)
715         CASE_RETURN_STR(Rsc_Feature)
716         CASE_RETURN_STR(Sc_Control_Point)
717         CASE_RETURN_STR(Digital)
718         CASE_RETURN_STR(Analog)
719         CASE_RETURN_STR(Aggregate)
720         CASE_RETURN_STR(Csc_Measurement)
721         CASE_RETURN_STR(Csc_Feature)
722         CASE_RETURN_STR(Sensor_Location)
723         CASE_RETURN_STR(Plx_Spot_Check_Measurement)
724         CASE_RETURN_STR(Plx_Continuous_Measurement)
725         CASE_RETURN_STR(Plx_Features)
726         CASE_RETURN_STR(Cycling_Power_Measurement)
727         CASE_RETURN_STR(Cycling_Power_Vector)
728         CASE_RETURN_STR(Cycling_Power_Feature)
729         CASE_RETURN_STR(Cycling_Power_Control_Point)
730         CASE_RETURN_STR(Location_And_Speed)
731         CASE_RETURN_STR(Navigation)
732         CASE_RETURN_STR(Position_Quality)
733         CASE_RETURN_STR(Ln_Feature)
734         CASE_RETURN_STR(Ln_Control_Point)
735         CASE_RETURN_STR(Elevation)
736         CASE_RETURN_STR(Pressure)
737         CASE_RETURN_STR(Temperature)
738         CASE_RETURN_STR(Humidity)
739         CASE_RETURN_STR(True_Wind_Speed)
740         CASE_RETURN_STR(True_Wind_Direction)
741         CASE_RETURN_STR(Apparent_Wind_Speed)
742         CASE_RETURN_STR(Apparent_Wind_Direction)
743         CASE_RETURN_STR(Gust_Factor)
744         CASE_RETURN_STR(Pollen_Concentration)
745         CASE_RETURN_STR(Uv_Index)
746         CASE_RETURN_STR(Irradiance)
747         CASE_RETURN_STR(Rainfall)
748         CASE_RETURN_STR(Wind_Chill)
749         CASE_RETURN_STR(Heat_Index)
750         CASE_RETURN_STR(Dew_Point)
751         CASE_RETURN_STR(Descriptor_Value_Changed)
752         CASE_RETURN_STR(Aerobic_Threshold)
753         CASE_RETURN_STR(Age)
754         CASE_RETURN_STR(Anaerobic_Heart_Rate_Lower_Limit)
755         CASE_RETURN_STR(Anaerobic_Heart_Rate_Upper_Limit)
756         CASE_RETURN_STR(Anaerobic_Threshold)
757         CASE_RETURN_STR(Aerobic_Heart_Rate_Upper_Limit)
758         CASE_RETURN_STR(Date_Of_Birth)
759         CASE_RETURN_STR(Date_Of_Threshold_Assessment)
760         CASE_RETURN_STR(Email_Address)
761         CASE_RETURN_STR(Fat_Burn_Heart_Rate_Lower_Limit)
762         CASE_RETURN_STR(Fat_Burn_Heart_Rate_Upper_Limit)
763         CASE_RETURN_STR(First_Name)
764         CASE_RETURN_STR(Five_Zone_Heart_Rate_Limits)
765         CASE_RETURN_STR(Gender)
766         CASE_RETURN_STR(Heart_Rate_Max)
767         CASE_RETURN_STR(Height)
768         CASE_RETURN_STR(Hip_Circumference)
769         CASE_RETURN_STR(Last_Name)
770         CASE_RETURN_STR(Maximum_Recommended_Heart_Rate)
771         CASE_RETURN_STR(Resting_Heart_Rate)
772         CASE_RETURN_STR(Sport_Type_For_Aerobic_And_Anaerobic_Thresholds)
773         CASE_RETURN_STR(Three_Zone_Heart_Rate_Limits)
774         CASE_RETURN_STR(Two_Zone_Heart_Rate_Limit)
775         CASE_RETURN_STR(Vo2_Max)
776         CASE_RETURN_STR(Waist_Circumference)
777         CASE_RETURN_STR(Weight)
778         CASE_RETURN_STR(Database_Change_Increment)
779         CASE_RETURN_STR(User_Index)
780         CASE_RETURN_STR(Body_Composition_Feature)
781         CASE_RETURN_STR(Body_Composition_Measurement)
782         CASE_RETURN_STR(Weight_Measurement)
783         CASE_RETURN_STR(Weight_Scale_Feature)
784         CASE_RETURN_STR(User_Control_Point)
785         CASE_RETURN_STR(Magnetic_Flux_Density_2D)
786         CASE_RETURN_STR(Magnetic_Flux_Density_3D)
787         CASE_RETURN_STR(Language)
788         CASE_RETURN_STR(Barometric_Pressure_Trend)
789         CASE_RETURN_STR(Bond_Management_Control_Point)
790         CASE_RETURN_STR(Bond_Management_Feature)
791         CASE_RETURN_STR(Gap_Central_Address_Resolution_Support)
792         CASE_RETURN_STR(Cgm_Measurement)
793         CASE_RETURN_STR(Cgm_Feature)
794         CASE_RETURN_STR(Cgm_Status)
795         CASE_RETURN_STR(Cgm_Session_Start_Time)
796         CASE_RETURN_STR(Cgm_Session_Run_Time)
797         CASE_RETURN_STR(Cgm_Specific_Ops_Control_Point)
798         CASE_RETURN_STR(Indoor_Positioning_Configuration)
799         CASE_RETURN_STR(Latitude)
800         CASE_RETURN_STR(Longitude)
801         CASE_RETURN_STR(Local_North_Coordinate)
802         CASE_RETURN_STR(Local_East_Coordinate)
803         CASE_RETURN_STR(Floor_Number)
804         CASE_RETURN_STR(Altitude)
805         CASE_RETURN_STR(Uncertainty)
806         CASE_RETURN_STR(Location_Name)
807         CASE_RETURN_STR(Uri)
808         CASE_RETURN_STR(Http_Headers)
809         CASE_RETURN_STR(Http_Status_Code)
810         CASE_RETURN_STR(Http_Entity_Body)
811         CASE_RETURN_STR(Http_Control_Point)
812         CASE_RETURN_STR(Https_Security)
813         CASE_RETURN_STR(Tds_Control_Point)
814         CASE_RETURN_STR(Ots_Feature)
815         CASE_RETURN_STR(Object_Name)
816         CASE_RETURN_STR(Object_Type)
817         CASE_RETURN_STR(Object_Size)
818         CASE_RETURN_STR(Object_First_Created)
819         CASE_RETURN_STR(Object_Last_Modified)
820         CASE_RETURN_STR(Object_Id)
821         CASE_RETURN_STR(Object_Properties)
822         CASE_RETURN_STR(Object_Action_Control_Point)
823         CASE_RETURN_STR(Object_List_Control_Point)
824         CASE_RETURN_STR(Object_List_Filter)
825         CASE_RETURN_STR(Object_Changed)
826         CASE_RETURN_STR(Fitness_Machine_Control_Point)
827         CASE_RETURN_STR(Gatt_Characteristic_Extended_Properties)
828         CASE_RETURN_STR(Gatt_Characteristic_User_Description)
829         CASE_RETURN_STR(Gatt_Client_Characteristic_Configuration)
830         CASE_RETURN_STR(Gatt_Server_Characteristic_Configuration)
831         CASE_RETURN_STR(Gatt_Characteristic_Presentation_Format)
832         CASE_RETURN_STR(Gatt_Characteristic_Aggregate_Format)
833         CASE_RETURN_STR(Valid_Range)
834         CASE_RETURN_STR(External_Report_Reference)
835         CASE_RETURN_STR(Report_Reference)
836         CASE_RETURN_STR(Number_Of_Digitals)
837         CASE_RETURN_STR(Value_Trigger_Setting)
838         CASE_RETURN_STR(Es_Configuration)
839         CASE_RETURN_STR(Es_Measurement)
840         CASE_RETURN_STR(Es_Trigger_Setting)
841         CASE_RETURN_STR(Time_Trigger_Setting)
842         CASE_RETURN_STR(Gatt_Primary_Service_Declaration)
843         CASE_RETURN_STR(Gatt_Secondary_Service_Declaration)
844         CASE_RETURN_STR(Gatt_Include_Declaration)
845         CASE_RETURN_STR(Gatt_Characteristic_Declaration)
846         default:
847                 return "--";
848         }
849 }