btstack_util.c (bf1b35bfe3277735b5f948f7202313e4ac994877) | btstack_util.c (f8fbdce0c5067e7e7edd3a29934b1f9b79c8ff2d) |
---|---|
1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 35 unchanged lines hidden (view full) --- 44 */ 45 46#include "btstack_config.h" 47#include "btstack_util.h" 48#include <stdio.h> 49#include <string.h> 50#include "btstack_debug.h" 51 | 1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 35 unchanged lines hidden (view full) --- 44 */ 45 46#include "btstack_config.h" 47#include "btstack_util.h" 48#include <stdio.h> 49#include <string.h> 50#include "btstack_debug.h" 51 |
52void bt_store_16(uint8_t *buffer, uint16_t pos, uint16_t value){ | 52void little_endian_store_16(uint8_t *buffer, uint16_t pos, uint16_t value){ |
53 buffer[pos++] = value; 54 buffer[pos++] = value >> 8; 55} 56 | 53 buffer[pos++] = value; 54 buffer[pos++] = value >> 8; 55} 56 |
57void bt_store_32(uint8_t *buffer, uint16_t pos, uint32_t value){ | 57void little_endian_store_32(uint8_t *buffer, uint16_t pos, uint32_t value){ |
58 buffer[pos++] = value; 59 buffer[pos++] = value >> 8; 60 buffer[pos++] = value >> 16; 61 buffer[pos++] = value >> 24; 62} 63 | 58 buffer[pos++] = value; 59 buffer[pos++] = value >> 8; 60 buffer[pos++] = value >> 16; 61 buffer[pos++] = value >> 24; 62} 63 |
64void net_store_16(uint8_t *buffer, uint16_t pos, uint16_t value){ | 64void big_endian_store_16(uint8_t *buffer, uint16_t pos, uint16_t value){ |
65 buffer[pos++] = value >> 8; 66 buffer[pos++] = value; 67} 68 | 65 buffer[pos++] = value >> 8; 66 buffer[pos++] = value; 67} 68 |
69void net_store_32(uint8_t *buffer, uint16_t pos, uint32_t value){ | 69void big_endian_store_32(uint8_t *buffer, uint16_t pos, uint32_t value){ |
70 buffer[pos++] = value >> 24; 71 buffer[pos++] = value >> 16; 72 buffer[pos++] = value >> 8; 73 buffer[pos++] = value; 74} 75 76void bt_flip_addr(bd_addr_t dest, bd_addr_t src){ 77 dest[0] = src[5]; --- 104 unchanged lines hidden (view full) --- 182} 183 184// Bluetooth Base UUID: 00000000-0000-1000-8000- 00805F9B34FB 185const uint8_t sdp_bluetooth_base_uuid[] = { 0x00, 0x00, 0x00, 0x00, /* - */ 0x00, 0x00, /* - */ 0x10, 0x00, /* - */ 186 0x80, 0x00, /* - */ 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB }; 187 188void sdp_normalize_uuid(uint8_t *uuid, uint32_t shortUUID){ 189 memcpy(uuid, sdp_bluetooth_base_uuid, 16); | 70 buffer[pos++] = value >> 24; 71 buffer[pos++] = value >> 16; 72 buffer[pos++] = value >> 8; 73 buffer[pos++] = value; 74} 75 76void bt_flip_addr(bd_addr_t dest, bd_addr_t src){ 77 dest[0] = src[5]; --- 104 unchanged lines hidden (view full) --- 182} 183 184// Bluetooth Base UUID: 00000000-0000-1000-8000- 00805F9B34FB 185const uint8_t sdp_bluetooth_base_uuid[] = { 0x00, 0x00, 0x00, 0x00, /* - */ 0x00, 0x00, /* - */ 0x10, 0x00, /* - */ 186 0x80, 0x00, /* - */ 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB }; 187 188void sdp_normalize_uuid(uint8_t *uuid, uint32_t shortUUID){ 189 memcpy(uuid, sdp_bluetooth_base_uuid, 16); |
190 net_store_32(uuid, 0, shortUUID); | 190 big_endian_store_32(uuid, 0, shortUUID); |
191} 192 193int sdp_has_blueooth_base_uuid(uint8_t * uuid128){ 194 return memcmp(&uuid128[4], &sdp_bluetooth_base_uuid[4], 12) == 0; 195} 196 197static char uuid128_to_str_buffer[32+4+1]; 198char * uuid128_to_str(uint8_t * uuid){ --- 159 unchanged lines hidden --- | 191} 192 193int sdp_has_blueooth_base_uuid(uint8_t * uuid128){ 194 return memcmp(&uuid128[4], &sdp_bluetooth_base_uuid[4], 12) == 0; 195} 196 197static char uuid128_to_str_buffer[32+4+1]; 198char * uuid128_to_str(uint8_t * uuid){ --- 159 unchanged lines hidden --- |