Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ʵսLinux Bluetooth±à³Ì(Áù) L2CAP±à³ÌʵÀý

ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
 Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬IdentifierµÈ¡£
ÒÔÏÂÊÇÒ»¸ö·¢ËÍsignaling CommandÒÔ¼°½ÓÊÕResponseµÄ¼òµ¥Àý×Ó£º
int main(int argc, char** argv)
{
 int l2_sck = 0;
 int iRel  = 0;
 struct sockaddr_l2 local_l2_addr;
 struct sockaddr_l2 remote_l2_addr;
 char str[24] ={0};
 int len = 0;
 int size = 50;
 char* send_buf;
 char* recv_buf;
 int i = 0;
 int id = 1; //²»ÒªÎª0
 
 send_buf = malloc(L2CAP_CMD_HDR_SIZE + size);
 recv_buf = malloc(L2CAP_CMD_HDR_SIZE + size);
 
 if(argc < 2)
 {
  printf("\n%s <bdaddr>\n", argv[0]);
  exit(0);
 }
 // create l2cap raw socket
 l2_sck = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_L2CAP); //´´½¨L2CAP protocolµÄRAW Packet
 if(l2_sck < 0)
 {
  perror("\nsocket:");
  return -1;
 }
 //bind
 memset(&local_l2_addr, 0, sizeof(struct sockaddr_l2));
 local_l2_addr.l2_family = PF_BLUETOOTH;
 bacpy(&local_l2_addr.l2_bdaddr , BDADDR_ANY);
 iRel = bind(l2_sck, (struct sockaddr*) &local_l2_addr, sizeof(struct sockaddr_l2));
 if(iRel < 0)
 {
  perror("\nbind()");
  exit(0);
 }
 //connect
 memset(&remote_l2_addr, 0 , sizeof(struct sockaddr_l2));
 remote_l2_addr.l2_family = PF_BLUETOOTH;
 //printf("\nConnect to %s\n", argv[1]);
 str2ba(argv[1], &remote_l2_addr.l2_bdaddr);
 iRel = connect(l2_sck, (struct sockaddr*)&remote_l2_addr, sizeof(struct sockaddr_l2));
 if(iRel < 0)
 {
  perror("\nconnect()");
  exit(0);
 }
 //get local bda


Ïà¹ØÎĵµ£º

LinuxÏ»ñÈ¡CPUID¡¢Ó²ÅÌÐòÁкÅÓëMACµØÖ·


 
ÔںܶàϵͳÈí¼þµÄ¿ª·¢ÖУ¬ÐèҪʹÓÃһЩϵͳµÄΨһÐÔÐÅÏ¢¡£ËùÒÔ£¬µÃµ½Ö÷»úµÄCPUID¡¢Ó²ÅÌÐòÁкż°Íø¿¨µÄMACµØÖ·£¬¾Í³É¸öÒ»¼þºÜÖØÒªµÄÓ¦Óá£
±¾È˾­¹ýÒ»·¬google¼´×Ô¼ºµÄ×êÑУ¬»ù±¾ÉÏʵÏÖÁËÕ⼸¸ö¹¦ÄÜ¡£ÐèÒªµÄ×¼±¸ÖªÊ¶ÓУº
GCCµÄǶÈë»ã±à£¬¾ßÌåµÄGCCǶÈë»ã±à֪ʶ£¬Çë²Î¿¼Ïà¹ØÊÖ²á
ioctlϵͳµ÷Ó㬾ßÌåµÄµ÷Ó÷½·¨ ......

LinuxÔÚVMwareÐéÄâ»úÖеÄÍøÂçÉèÖÃ

Õâ¸öÎÊÌâ¸ãÁ˺ܳ¤Ê±¼ä£¬Ò²ÔÚÍøÉϲéÁ˺ܶණÎ÷£¬ÏÖÔÚÂýÂýµÄÀ´ÕûÀíÒ»ÏÂ
vmware°²×°ºÃÒԺ󣬻á×Ô¶¯Ìí¼ÓÁ½ÕÅÍø¿¨£¨vmnet1ºÍvmnet8£©£¬Õû¸ö»úÆ÷µÄ½á¹¹¾Í¿ÉÒÔ³éÏó³É£ºÐéÄâ»úϵͳ£¨ÐéÄâÍø¿¨vmnet0)¨D¨D£¨vmnet1 vmnet8£©¨D¨Dʵ¼Êϵͳ(Íø¿¨)¡£
1.VmwareµÄÍø¿¨ÉèÖÃ
    (1)Bridged£¨ÇŽӣ©·½Ê½
  &n ......

£¨×ª£©¾­µä£ºLinux²ËÄñÈëÃż¶ÃüÁî´óÈ«

1. man ¶ÔÄãÊìϤ»ò²»ÊìϤµÄÃüÁîÌṩ°ïÖú½âÊÍ
eg:man ls ¾Í¿ÉÒԲ鿴lsÏà¹ØµÄÓ÷¨
×¢£º°´q¼ü»òÕßctrl+cÍ˳ö£¬ÔÚlinuxÏ¿ÉÒÔʹÓÃctrl+cÖÕÖ¹µ±Ç°³ÌÐòÔËÐС£
2. ls ²é¿´Ä¿Â¼»òÕßÎļþµÄÊô*£¬ÁоٳöÈÎһĿ¼ÏÂÃæµÄÎļþ
eg: ls /usr/man
ls -l
a.d±íʾĿ¼(directory)£¬Èç¹ûÊÇÒ»¸ö"-"±íʾÊÇÎļþ£¬Èç¹ûÊÇlÔò±íʾÊÇÒ»¸öÁ¬½ÓÎļþ ......

Linux+Java+Mysql¿ªÔ´¿ª·¢»·¾³µÄ´î½¨

¾­ÀúÁËÒ»´Îϵͳ±ÀÀ£ÖÕÓÚ°ÑlinuxϵͳϵĿª·¢»·¾³ÍêÕûµÄ¿ª·¢Á˳öÀ´ÁË¡£
Õâ´Î²ÉÈ¡µÄÊÇubuntu9.10(RC)+JDK1.5+Mysql5.1Íâ´øÒ»¸öeclipse×÷ΪIDE¡£
ÓÉÓڱʼDZ¾µÄ¹âÇýËãÊÇÎþÉüÁË£¬ËùÒÔµ±Õâ´Îubuntu·¢Æ¢ÆødownµôµÄʱºò¼¸ºõ×¥¿ñ¡£Ã»ÓйâÅÌ£¬Ôõô°²×°ÏµÍ³£¿
ÍøÉÏÒ»ËÑ£¬×îºó²ÉÈ¡µÄ°ì·¨ÊÇÓÃuÅÌÆô¶¯ISO¾µÏñÎļþÀ´½øÐа²×°µÄ¡£Æð³õ·Å½ ......

ʵսLinux Bluetooth±à³Ì£¨¶þ£© BlueZ¼ò½é

LinuxÏÂBluetoothЭÒéÕ»µÄʵÏÖ. LinuxÏ¿ª·ÅµÄÀ¶ÑÀЭÒéÕ»Ö÷Òª°üÀ¨IBM¹«Ë¾µÄBlueDrekar£¬Nokia¹«Ë¾µÄAffix, Axis¹«Ë¾µÄOpenBTºÍ¹Ù·½Ð­ÒéÕ»BlueZ¡£ÎÒÃÇÖ÷ÒªÃæ¶ÔBluezÀ´Ì½ÌÖ¡£
BlueZ»ù´¡´úÂë¾ùÊÇÓÉMaxim KrasnyanskyÍê³ÉµÄ¡£°üÀ¨£ºHCI£¬L2CAP£¬RFCOMMºÍ»ù±¾socketµÄʵÏÖ¡£Ëû¾ÍÖ°ÓÚQualcomm(¸ßͨ)¡£Marcel Holtmann¿ª·¢²ãµÄÐ­Ò ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ