Home | History | Annotate | Download | only in bluetooth
      1 /*
      2  *
      3  *  BlueZ - Bluetooth protocol stack for Linux
      4  *
      5  *  Copyright (C) 2011  Nokia Corporation
      6  *  Copyright (C) 2011  Marcel Holtmann <marcel (at) holtmann.org>
      7  *
      8  *
      9  *  This program is free software; you can redistribute it and/or modify
     10  *  it under the terms of the GNU General Public License as published by
     11  *  the Free Software Foundation; either version 2 of the License, or
     12  *  (at your option) any later version.
     13  *
     14  *  This program is distributed in the hope that it will be useful,
     15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17  *  GNU General Public License for more details.
     18  *
     19  *  You should have received a copy of the GNU General Public License
     20  *  along with this program; if not, write to the Free Software
     21  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     22  *
     23  */
     24 
     25 #ifndef __BLUETOOTH_UUID_H
     26 #define __BLUETOOTH_UUID_H
     27 
     28 #ifdef __cplusplus
     29 extern "C" {
     30 #endif
     31 
     32 #include <stdint.h>
     33 #include <bluetooth/bluetooth.h>
     34 
     35 typedef struct {
     36 	enum {
     37 		BT_UUID_UNSPEC = 0,
     38 		BT_UUID16 = 16,
     39 		BT_UUID32 = 32,
     40 		BT_UUID128 = 128,
     41 	} type;
     42 	union {
     43 		uint16_t  u16;
     44 		uint32_t  u32;
     45 		uint128_t u128;
     46 	} value;
     47 } bt_uuid_t;
     48 
     49 int bt_uuid16_create(bt_uuid_t *btuuid, uint16_t value);
     50 int bt_uuid32_create(bt_uuid_t *btuuid, uint32_t value);
     51 int bt_uuid128_create(bt_uuid_t *btuuid, uint128_t value);
     52 
     53 int bt_uuid_cmp(const bt_uuid_t *uuid1, const bt_uuid_t *uuid2);
     54 void bt_uuid_to_uuid128(const bt_uuid_t *src, bt_uuid_t *dst);
     55 
     56 #define MAX_LEN_UUID_STR 37
     57 
     58 int bt_uuid_to_string(const bt_uuid_t *uuid, char *str, size_t n);
     59 int bt_string_to_uuid(bt_uuid_t *uuid, const char *string);
     60 
     61 #ifdef __cplusplus
     62 }
     63 #endif
     64 
     65 #endif /* __BLUETOOTH_UUID_H */
     66