藍牙mesh Spec學習記錄

目前在學習和研究mesh,看mesh specification,總會遇到暫時不太理解的地方,或者重要的地方記錄一下免得忘記。

目錄

(一) Mesh Profile Spec V1.0.1

1、Configuration Mode

2、Configuration client

3、 bearers (advertising bearer 和 GATT bearer)

4、vitual address

5、the Configuration Server model

6、AppKey Index and Netkey Index

7、藍牙mesh的廣播包

8、Mesh GATT services (Mesh Provisioning Service 和 Mesh Proxy Service)

9、security material(master security material 和 friendship security material)

10、NID 和 Network ID

11、Composition data中Model Opcode如何獲取?

12、Device Key如何產生,用來幹什麼?

13、Application key (Appkey)何時產生?


 


 

(一) Mesh Profile Spec V1.0.1

1、Configuration Mode

         詳見foundation models這一章

2、Configuration client

Section 1.3.5

          Configuration Client:a node that implements the Configuration Client model

Section 2.2.1

          The network resources are managed by a node that implements the Configuration Client model, known
as the Configuration Client, (typically a smart phone or other mobile computing device) and are allocated
to nodes at the time of configuration (see Section 5) using the Configuration Server model (see Section
4.4.1)

section 2.2.2

          A node can send or receive mesh messages and is managed by a Configuration Client, that may also be
the same device as the Provisioner, over the mesh network to configure how the node communicates
with other nodes. A Configuration Client can remove a node from a mesh network, which reverts it back
to an unprovisioned device.

 in Mesh Profile Spec V1.0.1 P32:

          A node may have knowledge of a single device key, multiple application keys, and multiple network keys.

a device key is only known by a Configuration Client and the single node. The Configuration Client knows the device keys for all nodes

Section 5

A Provisioner is typically a smart phone or other mobile computing device. Although only a single
Provisioner is required on a network to do provisioning, multiple Provisioners may be used.


3、 bearers (advertising bearer 和 GATT bearer

This specification defines two mesh bearers over which mesh messages may be transported:
• An advertising bearer (see Section 3.3.1)
• A GATT bearer (see Section 3.3.2)
個人理解:advertising bearer是藍牙mesh 網絡中一般的node所使用到的,它們可以receive和中繼廣播;

GATT bearer是藍牙mesh 網絡中proxy node需要使用到的,比如下圖所示的S節點作爲proxy node,當然S節點也使用到了advertising bearer。spec中有這樣一句話:A node shall support the advertising bearer or the GATT bearer or both.
 

如下是對3.3.2 GATT bearer (P38)部分的翻譯和個人理解:

GATT bearer被提供用來使不支持advertising bearer的設備參與到mesh網絡中。GATT bearer使用Proxy protocol在基於GATT連線之上的兩個設備間傳輸和接收Proxy PDUs。

通過使用ATT協議,GATT beraer使用characteristic來寫入、接收mesh message的notification。

GATT bearer定義了兩個角色:GATT Bearer Client和GATT Bearer Server.

GATT Bearer Client應該是一個GATT Client;GATT Bearer Server應該是一個GATT Server.

GATT Bearer Server需要實例化一個並且僅有一個 Mesh Proxy Service,GATT Bearer client應該支持Mesh Proxy Service。

GATT Bearer client應該運行primary service discovery(使用GATT Discover All Primary Services或者GATT Discover Primary Services)來發現 Mesh Proxy Service,並使用對應的procedures來發現GATT Bearer Server中與此Mesh Proxy Service關聯的characteristics和descriptors。

GATT Bearer client應該發現the Mesh Proxy Data In characteristic, Mesh Proxy Data Out characteristic 和它的 Client Characteristic Configuration descriptor.一旦發現Client Characteristic Configuration descriptor,GATT Bearer client應該使能Mesh Proxy Data Out的notification。

爲發送Proxy PDU,GATT Bearer Client 應該使用Write Without Response procedure來向GATT Bearer Server中的Mesh Proxy data In characterister寫入Proxy PDU數據。

爲接收Proxy PDU,GATT Bearer Client 應該能夠接收Mesh Proxy Data Out characteristic的多個notification.每個notification包含一個Proxy PDU數據。

上圖Figure 2.8中所示的S節點,使用到了Proxy protocol,T節點使用S節點和mesh網絡中的其它節點進行通信。

S節點作爲GATT Bearer Server,T節點作爲GATT Bearer Client。

4、vitual address

label UUID

to do

5、the Configuration Server model

詳見foundation models這一章
 

6、AppKey Index and Netkey Index

在mesh網絡中,Network keys和Application keys被組織成兩個List:network key list和application key list;這兩個list由一個Configuration Client維護,每個list都是mesh網絡中的共享資源(shared resource)。通過全局的key index (Netkey Index 和Appkey index)來引用Netkey和Appkey。

每個全局的key index 長度爲12 bits。一些message包含1個、2個或多個key index 。爲高效傳輸,2個keys可以打包成3個Bytes。在奇數個key index需要被打包的地方,(除了最後一個key index之外的) 前面偶數個key index被打包爲連續的"3 Bytes",最後一個key index被打包爲2個bytes。在偶數個key index需要被打包的地方,它們被打包爲連續的"3 Bytes"。

將2個key index打包爲3個Bytes方法如下:

將1個key index打包爲2個Bytes方法如下:

 

7、藍牙mesh的廣播包

1、PB-ADV的包是用在Provisioning過程的,Provisioning是一個設備加入Mesh網絡的過程。
2、Mesh Message,這個是在設備入網後,進行數據通信的時候大量使用的包。節點間通信就是使用這種包進行的。
3、Mesh Beacon包含兩種類型:Unprovisioned Device beacon和Secure Network beacon,其中Unprovisioned Device Beacon是用來被Provisioner發現設備用的,也就是在Provisioning之前設備發送的包,這個包裏會包含Manufacturer相關的Device UUID(128bits),這個Device UUID是用來區分設備的,因此需要保證唯一性。而Secure Network beacon則是設備入網後用來發送一些安全相關的包,比如IV index更新包。Key Refresh procedure、IV Update procedure 和 IV Index Recovery procedure都基於Secure Network beacon。
4、Mesh GATT services章節中也會使用特定的mesh廣播包。

8、Mesh GATT services (Mesh Provisioning Service 和 Mesh Proxy Service)

Spec描述如下:
The Mesh Provisioning Service allows a Provisioning Client to provision a Provisioning Server to allow it to participate in the mesh network.
The Mesh Proxy Service is used to enable a server to send and receive Proxy PDUs with a client.

從Spec的表述可以看出,

Mesh Provisioning Service是用來讓一個Device變成Mesh Node的;

Mesh Proxy Service是用來使Server和Client通過Proxy PDU收發數據的 (此時Server和Client均爲Mesh網絡中的Node)。

比如 Figure 2.8中的S和T,S已經加入mesh網絡的前提下,

T成爲mesh Node的方式是:

T作爲GATT Server,包含Mesh Provisioning Service,發廣播包(包含 «Mesh Provisioning Service» UUID),S掃描後通過GATT連上T,交互後T成爲此mesh 網絡中的一員;

而T成爲mesh node之後只能通過S和網絡中其他Node交互;相對於T,S作爲GATT Server,包含 Mesh Proxy Service,發廣播包(包含«Mesh Proxy Service» UUID),T掃描後通過GATT連上S.

上面下劃線部分是個人理解,大家有新的想法的話非常歡迎指出、補充,一起探討

發現一種case:

Nordic 

9、security material(master security material 和 friendship security material)

  

10、NID 和 Network ID

這是兩個完全不一樣的東西,容易弄混淆。

NID :長度爲7個bits,在Network PDU中會使用到。

Network ID :長度爲8個Bytes,源自Network  key, 在Secure Network beacon中會用到。

 

11、Composition data中Model Opcode如何獲取?

Composition Data 狀態中的Composition Data Page 0關於element Model只含有Model Id信息,那麼其opcode如何獲取?

12、Device Key如何產生,用來幹什麼?

Device key在對provisionee做完provision之後產生的,只會保存在和provisionee中;Device Key的作用是:Configuration Client對provisionee進行configure過程中的message,使用Device key進行加密。

13、Application key (Appkey)何時產生,使用場景?

to do

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章