91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

基于bluez協議的linux下藍牙設備搜索, 對初學者有點用.

資源截圖

代碼片段和文件信息

/*
?*
?*??BlueZ?-?Bluetooth?protocol?stack?for?Linux
?*
?*??Copyright?(C)?2000-2001??Qualcomm?Incorporated
?*??Copyright?(C)?2002-2003??Maxim?Krasnyansky?
?*??Copyright?(C)?2002-2008??Marcel?Holtmann?
?*
?*
?*??This?program?is?free?software;?you?can?redistribute?it?and/or?modify
?*??it?under?the?terms?of?the?GNU?General?Public?License?as?published?by
?*??the?Free?Software?Foundation;?either?version?2?of?the?License?or
?*??(at?your?option)?any?later?version.
?*
?*??This?program?is?distributed?in?the?hope?that?it?will?be?useful
?*??but?WITHOUT?ANY?WARRANTY;?without?even?the?implied?warranty?of
?*??MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR?PURPOSE.??See?the
?*??GNU?General?Public?License?for?more?details.
?*
?*??You?should?have?received?a?copy?of?the?GNU?General?Public?License
?*??along?with?this?program;?if?not?write?to?the?Free?Software
?*??Foundation?Inc.?51?Franklin?St?Fifth?Floor?Boston?MA??02110-1301??USA
?*
?*/

#ifdef?HAVE_CONFIG_H
#include?
#endif

#include?
#include?
#include?
#include?
#include?
#include?
#include?

#include?
#include?

void?baswap(bdaddr_t?*dst?const?bdaddr_t?*src)
{
register?unsigned?char?*d?=?(unsigned?char?*)?dst;
register?const?unsigned?char?*s?=?(const?unsigned?char?*)?src;
register?int?i;
for?(i?=?0;?i? d[i]?=?s[5-i];
}

char?*batostr(const?bdaddr_t?*ba)
{
char?*str?=?bt_malloc(18);
if?(!str)
return?NULL;

sprintf(str?“%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X“
ba->b[0]?ba->b[1]?ba->b[2]?
ba->b[3]?ba->b[4]?ba->b[5]);
return?str;
}

bdaddr_t?*strtoba(const?char?*str)
{
const?char?*ptr?=?str;
int?i;

uint8_t?*ba?=?bt_malloc(sizeof(bdaddr_t));
if?(!ba)
return?NULL;

for(i?=?0;?i? ba[i]?=?(uint8_t)?strtol(ptr?NULL?16);
if?(i?!=?5?&&?!(ptr?=?strchr(ptr‘:‘)))
ptr?=?“:00:00:00:00:00“;
ptr++;
}
return?(bdaddr_t?*)?ba;
}

int?ba2str(const?bdaddr_t?*ba?char?*str)
{
uint8_t?b[6];

baswap((bdaddr_t?*)?b?ba);
return?sprintf(str?“%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X“
b[0]?b[1]?b[2]?b[3]?b[4]?b[5]);
}

int?str2ba(const?char?*str?bdaddr_t?*ba)
{
uint8_t?b[6];
const?char?*ptr?=?str;
int?i;

for?(i?=?0;?i? b[i]?=?(uint8_t)?strtol(ptr?NULL?16);
if?(i?!=?5?&&?!(ptr?=?strchr(ptr?‘:‘)))
ptr?=?“:00:00:00:00:00“;
ptr++;
}
baswap(ba?(bdaddr_t?*)?b);
return?0;
}

int?ba2oui(const?bdaddr_t?*ba?char?*str)
{
uint8_t?b[6];

baswap((bdaddr_t?*)?b?ba);
return?sprintf(str?“%2.2X-%2.2X-%2.2X“?b[0]?b[1]?b[2]);
}

int?bachk(const?char?*str)
{
char?tmp[18]?*ptr?=?tmp;

if?(!str)
return?-1;

if?(strlen(str)?!=?17)
return?-1;

memcpy(tmp?str?18);

while?(*ptr)?{
*ptr?=?toupper(*ptr);
if?(*ptr??‘9‘?&&?*ptr??‘F‘)
return?-1;
ptr++;

*ptr?=?toupper(*ptr);
if?(*ptr??‘9‘?&&?*ptr??‘F‘)
return?

評論

共有 條評論