钃濈墮SDP鍗忚姒傝堪

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了钃濈墮SDP鍗忚姒傝堪相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/%e4%b8%80%e7%82%b9' title='涓€鐐?>涓€鐐?/a>   load   discovery   att   type   request   瑙勮寖   src   oss   

涔嬪墠鍐欎簡涓€绡?bluedroid瀵逛簬sdp鐨勫疄鐜扮殑婧愮爜鍒嗘瀽   锛屼粬鍏跺疄瀵逛簬sdp 鍗忚鏈韩鐨勫垎鏋愬苟涓嶅锛岃€屾槸渚ч噸浜?sdp 澶勪簬Android bluedroid 鏋舵瀯涓殑浠g爜娴佺▼锛岃繖绡囨枃绔狅紝鏄拡瀵筍DP 鐨勮鑼冩潵鏁寸悊SDP 鍗忚鏈韩鐨勪竴浜涜鐐广€?/p>

 

姒傝锛?/h2>

鎴戜滑鎯充竴鎯筹紝涓や釜闄岀敓鐨勮澶囷紙涔嬪墠鏈湁杩囦氦浜掞級濡備綍鍘诲彂鐜板鏂规敮鎸佷粈涔堟湇鍔″憿锛熷緢瀹规槗鎯冲埌锛屾垜浠渶瑕佷竴绉嶅崗璁紝杩欑鍗忚瑙勫畾浜嗘湇鍔″湪鏈嶅姟鍣ㄤ笂闈㈡槸濡備綍瀛樺偍鐨勪互鍙婂鏂瑰浣曡兘澶熼€氳繃杩欎釜鍗忚鏉ヨ幏鍙栧埌鏁版嵁锛屼互鍙婂弻鏂瑰叡鍚岄伒瀹堢殑涓€浜涜瀹氱瓑绛夈€?/p>

SDP鍏ㄧО鏄疭ervice Discovery Protocol锛屽畠鏄竴绉嶆湇鍔″彂鐜扮殑鍗忚锛屽畠鍙互杈炬垚鎴戜滑涓婇潰鎻愬嚭鐨勯棶棰樸€傝繖閮ㄥ垎鍙傝€僣ore_spec锛孷ol3-PartB銆?/p>

杩欐牱鐨勪竴涓崗璁簲璇ュ叿浣撳疄鐜颁竴浜涗粈涔堬紵

閭h偗瀹氭槸浼氳瀹氱壒瀹氱殑鏁版嵁鏍煎紡锛屼互鍙婁氦浜掔殑娴佺▼銆?/p>

涓嬮潰灏卞垎濡備笅鐨勫嚑閮ㄥ垎鏉ヤ粙缁峉DP锛?/p>

  1. 鍩烘湰姒傚康銆?/li>
  2. 鏁版嵁鏍煎紡
  3. 浜や簰娴佺▼
  4. 瀹炰緥

 

鍩烘湰姒傚康锛?/h2>

Service Record锛氭湇鍔″氨鏄彲浠ユ彁渚涚壒瀹氫俊鎭垨鑰呰繘琛岀壒瀹氱殑琛屼负锛屾垨鑰呮槸鑳借繘琛屾帶鍒舵煇浜涜祫婧愮殑涓€涓疄浣撱€傚畠鐨勫疄鐜板彲浠ュ熀浜庤蒋浠舵垨鑰呯‖浠讹紝涔熷彲浠ユ槸涓よ€呭吋鏈夈€傚湪鏈嶅姟鍣ㄤ笂闈㈢淮鎶ょ殑鍏充簬涓€涓猻ervcie鐨勬墍鏈変俊鎭殑闆嗗悎灏辨槸涓€涓猻ervice record銆傚畠鐨勬墍鏈変俊鎭線寰€閮芥槸鐢╯ervice attributes鏉ヨ〃绀虹殑銆?/p>

鎶€鏈垎浜浘鐗? src=

service attribute锛氬畠鏄浜巗ervice 鍚勭灞炴€х殑涓€绉嶆弿杩般€傛瘮濡俿ervice ID锛宻ervice鐨刵ame銆備竴浜涘父瑙佺殑灞炴€у涓嬶細

鎶€鏈垎浜浘鐗? src=

 

 鎶€鏈垎浜浘鐗? src=

 

浠庝笂闈㈢殑鍥句腑鍙戠幇service attribute 鐢?attribute ID鍜宎ttribute Value缁勬垚鐨勩€?/p>

 

Attribute ID锛氬畠鏄竴涓?6浣嶇殑鏃犵鍙锋暣鏁帮紝瀹冪敤鏉ュ尯鍒嗗湪鍚屼竴涓猄ervice Record涔嬩腑鐨勪笉鍚宎ttribute锛屽悓鏃跺畠涔熷線寰€鏆楀惈涓庡畠鐩稿叧鐨?nbsp;    Attribute Value鐨勮涔夈€傛敞鎰忓畠鐨勭敤data element 鏉ヨ〃绀虹殑銆?/p>

Attribute Value锛氬畠鏄竴涓蹭笉瀹氶暱鐨勬暟鎹紝瀹冪殑鍚箟鏄敱涓庡畠瀵瑰簲鐨凙ttribute ID浠ュ強瀹冩墍鍦ㄧ殑service绫诲埆鏉ュ喅瀹氱殑銆傛敞鎰忓畠鐨勬暟鎹牸寮忕殑鏄痙ata element銆傦紙鍚庣画浠嬬粛锛?/p>

 

Service class锛氬畠灏辨槸涓€绉峴ervice鐨勭被鍒紝瀹冩彁渚涗簡鎵€鏈夊睘浜庤繖涓被鍒殑attributes鐨勫畾涔夛紝瀹冪被浼奸潰鍚戝璞$紪绋嬮噷闈㈢殑绫伙紝鍏蜂綋鐨剆ervice鏄被鐨勫疄渚嬶紝涓€涓叿浣撶殑service 瀹冨彲鑳介毝灞炲涓被鍒€傜被浼奸潰鍚戝璞$殑閲岄潰鐨勭户鎵裤€傚綋鐒舵瘡涓猚lass鏈韩涔熸槸瑕佸拰鍒殑class鏉ュ仛浠ュ尯鍒嗙殑锛屾壙鎷呰繖椤逛换鍔$殑鍙橀噺鍙玸ervice class identifier锛屽湪service閲岄潰鎬荤敱涓€涓猘ttribute鍙仛ServiceClassIDList锛岃繖涓猻ervice class identifier灏卞瓨鍌ㄥ湪杩欎釜attribute鐨刟ttribute value 閲岄潰锛岃繖涓€兼槸涓€涓猆UID銆?/p>

 

UUID锛欰 UUID is a universally unique identifier that is guaranteed to be unique across all space and all time銆傛敞鎰忓畠鍏锋湁鍏ㄥ眬鐨勫敮涓€鎬с€?nbsp;瀹冩槸128bit鐨勫€笺€?/p>

 

Service Search Patterns锛氳繖涓槸涓€涓睻UID锛屾槸鐢ㄦ潵鎼滅储鐢ㄧ殑銆?/p>

 

Data element锛氬畠鐢県eader鍜宒ata涓ら儴鍒嗙粍鎴愩€傚叾涓紝header閮ㄥ垎鍙堢敱涓ら儴鍒嗙粍鎴愶細绫诲瀷鎻忚堪绗﹀拰澶у皬鎻忚堪绗︼紝鍓嶈€呮槸鏉ユ弿杩癲ata鐨勭被鍒紝鍚庤€呮槸鏉ユ弿杩癲ata 鐨勫ぇ灏忋€傛姒傚康闈炲父閲嶈銆傜被鍨嬫弿杩扮鏄敤header閮ㄥ垎鐨勯珮5bits鏉ヨ〃绀虹殑銆傚ぇ灏忔弿杩扮鏄敤header閮ㄥ垎鐨勪綆3涓瓧鑺傛潵鎻忚堪鐨勩€備笅闈㈢湅鐪嬭繖涓や釜鎻忚堪绗﹀叿浣撶殑绫诲埆浠ュ強澶у皬锛?/p>

 

鎶€鏈垎浜浘鐗? src=

 

鎶€鏈垎浜浘鐗? src=

涓嬮潰涓句釜渚嬪瓙鏉ヨ鏄庯細

鎶€鏈垎浜浘鐗? src=

鎺ヤ笅鏉?鎴戜滑鐪嬬湅锛?/p>

PDU ID 琛ㄧず杩欎釜PDU鏄綔鐢紝鏄敤浠ュ尯鍒叾浠栫殑PDU

TransactionID锛氱敤浠ュ尯鍒叾浠栫殑Transaction

鍙﹀杩樻湁涓€涓蹇礐ontinuation State锛氬綋SDP 鏈嶅姟鍣ㄨ繑鍥瀋lient 缁撴灉鐨勬椂鍊欙紝濡傛灉鏁版嵁澶ぇ锛岄偅涔堝氨浼氬垎鍖咃紝涓嬮潰棰濆害鍙橀噺灏辨槸鍒嗗寘鐨勬爣蹇楋紝濡傛灉閮ㄥ垎鍖咃紝鍏跺€间负0

鎶€鏈垎浜浘鐗? src=

鎺ヤ笅鏉?锛屾垜浠湅鐪嬩氦浜掔殑鍩烘湰鐨勬祦绋嬶細

鍥犱负鍩烘湰涓婇潰鎵€鏈夌殑浜や簰娴佺▼閮芥槸涓€鏍风殑锛屼笅闈㈠彧璁插叾涓竴涓氦浜掔殑娴佺▼銆?/p>

鎶€鏈垎浜浘鐗? class=

涓嬮潰鏉ヨВ鏋愪竴涓嬪畠鐨勫弬鏁帮細

ServiceSearchPattern:杩欎釜鍖归厤妯″紡鏄敱涓€涓睻UID缁勬垚鐨勶紝涓€娆℃渶澶氬寘鍚?2涓猆UID锛孶UID鐨勮〃鐜板舰寮忔槸data element

 

MaximumAttributeByteCount:浠巖esponse涓繑鍥炵殑鏈€澶х殑PDU

AttributeIDList:杩欎釜鍙傛暟鍖呭惈鐨勬槸涓€涓瞐ttribute ID鎴栬€呮槸attribute ID鐨勮寖鍥达紝涔熷彲浠ユ槸涓よ€呯殑缁勫悎銆?/p>

ContinuationState: 杩欎釜鍙傛暟鐨勭涓€涓瓧鑺備唬琛ㄩ暱搴︼紝鐒跺悗鍚庨潰璺熻闀垮害涓瓧鑺傘€傝繖涓猻tate 鏄粠reponse涓繑鍥炵殑銆傜劧鍚庡啀涓€娆¤姹傜殑鏃跺€欐斁鍦ㄥ弬鏁伴噷闈€傚浣曟病鏈夊墿浣欑殑瀛楄妭闇€瑕佽鍙栵紝閭d箞璁剧疆涓?

 

涓嬮潰鏄搴旂殑response 鐨凱DU锛?/p>

 

鎶€鏈垎浜浘鐗? class=

鐩稿簲鐨勫弬鏁拌В閲婂涓嬶細

AttributeListsByteCount:杩欓噷鏄痗ount灏辨槸AttributeLists杩欓噷鐨勫瓧鑺傛暟銆?/p>

AttributeLists:杩欓噷鐨勫厓绱犻兘鏄痙ata element sequence锛屽畠鏄敱attribute IDs鍜宎ttribute values 鏉ョ粍鎴愮殑pair

 

杩欓噷鍏堢粨鍚坆tsnoop鏉ュ垎鏋愪竴涓嬶紝鍏蜂綋鐨凷DP 娴佺▼鏄€庝箞鏍风殑锛?/p>

鐩稿簲鐨刲og锛?a href="https://wiki.realtek.com/download/attachments/89963819/btsnoop_a2dp.cfa?version=1&modificationDate=1515486173187&api=v2">btsnoop_a2dp.cfa

鎶€鏈垎浜浘鐗? class=

浠庝笂闈㈢殑log 鍙互鐪嬪嚭锛屽叾PDU ID: SDP_ServiceSearchAttributeRequest 锛岃繖涓懡浠ゆ槸瑕佸厛鏍规嵁patterns鏉ユ悳绱㈢壒瀹氱殑service锛岀劧鍚庡湪鎼滅储鍒皊ervice閲岄潰杩涜attribute鐨勬悳绱€傞偅涔堟垜浠湅鐪嬭繖鏉″懡鍚嶅搴旂殑鍏蜂綋鍙傛暟銆?/p>

鎶€鏈垎浜浘鐗? class=

鎴戜滑搴旇杩樿寰?nbsp; pattern鏄涓€涓弬鏁帮紝鍏朵腑鍖呭惈鐨刄UID鏄疞2cap锛岄偅鎰忓懗鐫€鍙鍖呭惈L2cap鐨剆ervice閮戒細match杩欎釜pattern锛屾帴涓嬫潵鐨勫弬鏁版槸璇存渶澶氳繑鍥?56 涓瓧鑺傘€傛帴涓嬫潵鐨勫弬鏁癆ttributeLists涓婇潰璁茶繃锛屾棦鍙互鏄疷UID锛屼篃鍙互鏄疷UID鐨勮寖鍥淬€傝繖閲屽弬鏁版槸0x00 --0xFF

涔熷氨鏄 杩斿洖match pattern鐨剆ervice鐨勬墍鏈夌殑attribute銆?/p>

SDP閲岄潰鏄湁涓撻棬鐨凱DU鏉ュ仛browsing鐨勶紝杩欓噷涓嶄綔浠嬬粛銆備粠涓婇潰鐨勬弿杩板彲浠ョ湅鍑猴紝铏界劧瀹冩病鏈夊仛browsing锛屼絾鏄篃鐩稿綋浜庢槸browsing銆?/p>

 

鎺ヤ笅鏉ワ紝鎴戜滑鐪嬬湅瀵瑰簲杩欎釜request鐨剅esponse锛?/p>

鎶€鏈垎浜浘鐗? class=

 

 

鎴戜滑鎸夌収鏁版嵁鏍煎紡锛屾潵鍒嗘瀽涓€涓嬶紝濡傛灉蹇樿浜哖DU鐨勬暟鎹牸寮忥紝鍙互鍥炲ご鐪嬬湅涓婇潰鍐欑殑銆?/p>

07锛歅DU ID: SDP_ServiceSearchAttributeResponse

00 00 锛歍ransaction ID: 0x0000

00 2b锛歅arameter Length: 43

鏍规嵁 鏁版嵁鍖呮牸寮忥紝鎴戜滑鐭ラ亾鎺ヤ笅鏉ユ槸Parameters浜嗭紝鎴戜滑鍐嶆鎶婅繖涓猵arameter鐩稿叧鐨凱DU 鏀惧湪杩欓噷锛?/p>

鎶€鏈垎浜浘鐗? class=

00 26锛欰ttribute List Byte Count: 38 浠h〃杩欎竴鍖呮暟鎹殑AttributeLists 鐨刡yte鐨勬暟閲忋€?/p>

鎺ヤ笅鏉ュ氨鏄疉ttributeLists鐨勮〃杈炬柟寮忥細

鎶€鏈垎浜浘鐗? class=

浠庝笂闈㈢殑鍥惧彲浠ョ煡閬撳叾鏄疍ata Element Sequence

鎺ョ潃鍒嗘瀽锛?/p>

 0x36  0x01 0xd7 = 0b00110 0b110 0x01 0xd7

   鍏朵腑0b00110 璇存槑Type鏄?nbsp;Data element sequence 

0b110 璇存槑鍙傛暟鐨勯暱搴﹂儴鍒嗘槸鐢?6涓猙its鏉ヨ〃绀虹殑锛屼篃灏辨槸鍚庨潰鐨?x01 0xd7锛岃繖涓暱搴︿唬琛ㄦ墍鏈夌殑杩斿洖鐨勫弬鏁扮殑闀垮害锛岋紙鍚庣画鐨勫寘鏄垎鍖呰繑鍥烇級骞朵笉鏄繖涓寘鐨勯暱搴︺€傝繖閲岃繕闇€瑕佹敞鎰忎竴鐐圭殑鏄繖閲岀殑type鏄疍ata element sequence 锛屾剰鍛崇潃鎺ヤ笅鏉arameter閮ㄥ垎閮芥槸Data element鐨勬牸寮忋€?/p>

鎺ョ潃鍒嗘瀽锛?/p>

鎺ヤ笅鏉ヨ偗瀹氳繕鏄痙ata element鐨刪eader閮ㄥ垎

36 00 3b 锛?b00110 0b110 0x00 0x3b 璇存槑鎺ヤ笅鏉ョ殑 AttributeList 閲岄潰鐨勬暟鎹厓绱犺繕鏄疍ata Element锛屽苟涓?nbsp;杩欎釜AttributeList鐨勯暱搴︽槸鐨?x003b 锛?/p>

鎺ヤ笅鏉ョ殑鏁版嵁鏄?nbsp;锛?/p>

09 00 00  = 0b00001 0b001 00 00 瀵瑰簲涓婇潰鐨刣ata element璇存槑Attribute ID鐨凾ype鏄疷nsigned Integer锛岋紙娉ㄦ剰鏍规嵁涓婇潰鐨勬牸寮忥紝绗竴涓猠lement鏄疉ttribute ID锛屾帴鐫€鏄疉ttribute value锛夛紝Attribute ID鐨凷izeIndex鏄? bytes锛孉ttribute ID = 0x00 0x00

涓嬮潰鐪嬩笅涓€涓猠lement 杩欎釜element 鏄搴斾笂闈㈢殑Attribute ID鐨凙ttribute value锛?/p>

0a 00 01 00 00  = 0b00001 0b010 璇存槑杩欎釜data element鐨凾ype鏄疷nsigned Integer锛岀敤4涓瓧鑺傛潵琛ㄧず 涔熷嵆00 01 00 00

鎶€鏈垎浜浘鐗? class=

 

鎺ヤ笅鏉ョ殑灏辨槸 涓嬩竴涓?attribute 浜嗭紝鍏舵牸寮忛兘鏄被浼硷紝鍙槸浠h〃鐨刟ttribute涓嶅悓銆傚湪姝や笉鍐嶈禈杩般€?/p>

 

鏈€鍚庡啀涓句釜profile鐨勪緥瀛愶紝鐪嬬湅profile涓槸濡備綍瀹氫箟瀹冪殑service鐨勶細

杩欓噷鐪婣2dp 涓叧浜庡叾鑷韩service鐨勬弿杩帮細杩欓噷鍙弿杩皊ink鐨勬儏鍐碉細

鎶€鏈垎浜浘鐗? class=

鎶€鏈垎浜浘鐗? class=

浠庝笂闈㈢殑service class ID 鐪嬪嚭瀹冩槸涓€涓猘udio sink鐨剆ervice锛屾秹鍙婂埌protocol 鏈塋2cap鍜孉VDTP锛屼笌鍏剁浉瀵瑰簲鐨刾rofile 鏄疉2dp

Supported Features鏄畠鏈夊彲鑳芥敮鎸佺殑feature锛屾帴涓嬫潵杩樻湁provider name鍜孲ervice name鐨勬弿杩般€?/p>

涓嬮潰鐪嬩竴涓媗og瀹為檯鐨?nbsp;鎼滅储鐨勬儏鍐碉紝鍜屼笂闈㈢殑瑙勮寖鏄竴鑷达細

鎶€鏈垎浜浘鐗? class=

 

 


ed

 

以上是关于钃濈墮SDP鍗忚姒傝堪的主要内容,如果未能解决你的问题,请参考以下文章

win32姒傝堪

Newtonsoft.Json 姒傝堪

SpringCloud - 鍏ラ棬姒傝堪

鎺ュ彛娴嬭瘯 姒傝堪

绠楁硶鏁版嵁缁撴瀯01 /绠楁硶鏁版嵁缁撴瀯姒傝堪

webpack姒傝堪鈥斺€旇祫婧愩€佹牱寮忋€佸浘鐗囩殑鎵撳寘宸ュ叿