Mesh(一)----System Architecture

本文介绍了基于BLE的蓝牙mesh网络架构,包括不同层级的功能划分,如FoundationModel层负责状态和配置管理,AccessLayer定义加密控制等。此外还讨论了网络的特点、组成元素,以及关键概念如states、messages和models。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

架构

整体基于BLE,搭建一套上层体系。
clipboard.png

  • Model layer
    定义一个model,标准化一些操作或用户场景,例如灯和传感器
  • Foundation Model layer
    定义状态,消息和配置及管理整个mesh网络
  • Access layer
    应用层和较底层的交互接口。定义和控制加密等一些东西
  • Upper transport layer
    加密,解密,认证。
  • Lower transport layer
    数据的分段和重组
  • Network layer
    控制消息的接受和转发
  • Bearer layer
    控制消息如何在节点间传递,两个bearer,advertising和GATT。其实就是广播和连接两种方式。

特点

  • 一对一或一对多
  • 允许消息转发,拓展距离
  • 消息加密
  • 与已有BLE兼容
  • 消息发送及时
  • 一个或多个节点丢失后仍可以正常工作

组成

  • 地址
    确认消息的起点和终点
  • Network key
    在Network layer层加密和认证信息
  • application key
    在Access layer层加密和认证信息
  • IV index
    拓展网络的lifetime,避免重复消息的发生

一个网络可以有多个子网(比如酒店可以有多个房间),一个设备可以属于多个子网(通过拥有多个Network key)。
这里有一个primary NetKey的概念,在primary里,节点可以参与IV update procedure。其他子网则只能传播。
Network resource通常由model server来管理(一般是手机)。

Architectural concepts

几个概念

  • States
    设备的状态信息
  • Bound states
    绑定的状态信息。几个状态信息绑定在一起,一个发生改变,另一个也随之改变
  • Messages
    操作states的信息
  • Elements
    一个节点可以有多个elements
  • Models
    models定义一个节点的一些通用的信息。

    • Server model
      一个server model由一个或多个节点的一个或多个element组成
    • Client model
      client不含state,client通常去请求,改变,消费server的states。
    • Control model
      一个control大概含有client去与其他server或其他server的client交流。

    一个device可以有server,client和control。

  • Publish-subscribe和message change
    消息订阅机制

一个消息可以从推送消息到单播,组播或者虚拟地址上。其他节点如果对这些消息有兴趣,就可以订阅这些消息。

  • Friendship
    Friendship用于低功耗节点。通常低功耗节点不能持续监听mesh消息,所以低功耗节点可以和附近正常节点建立Friendship关系,由附近节点接收并缓存低功耗节点的mesh消息到队列中,灯带低功耗节点唤醒后,在推送这些消息过去。

一个低功耗节点只能有一个friend节点。

  • Feature
    一个节点有四种features:

    • Relay feature
    • Proxy feature
      支持GATT
    • Low Power feature
    • Friend feature
### ESP-IDF STA Mode Mesh Network Implementation and Configuration In the context of ESP-IDF, implementing a mesh network in Station (STA) mode involves configuring devices to connect as stations within a larger mesh topology. The ESP-MESH library supports both infrastructure-based and ad-hoc networks but primarily focuses on creating multi-hop wireless networks where nodes can relay data between each other[^1]. To set up an ESP-Mesh network with one or more nodes operating in station mode: #### Initialization Code Example ```c #include "esp_mesh.h" void init_mesh(void) { esp_err_t err; /* Initialize MESH */ err = esp_mesh_init(); if (err != ESP_OK) { printf("mesh initialization failed\n"); return; } /* Set MESH parameters */ mesh_cfg_t cfg = MESH_INIT_CONFIG_DEFAULT(); err = esp_mesh_set_config(&cfg); if (err != ESP_OK) { printf("set config failed\n"); return; } } ``` The `MESH_INIT_CONFIG_DEFAULT()` function initializes default settings suitable for most applications including those running exclusively in station mode. For specific configurations such as setting root node behavior when acting purely as a client/station rather than also being able to act as an access point (AP), adjustments need to be made through appropriate API calls provided by ESP-MESH SDK functions like `esp_mesh_set_router` which allows specifying whether this device should try connecting upstream via another router/AP[^2]. Additionally, developers must ensure proper handling of events related to connection status changes using event loop mechanisms supported by ESP-IDF framework so that application logic may respond appropriately based upon current connectivity state information received from lower layers during operation under different roles played within overall architecture design choices regarding hierarchical structure formation among participating entities forming part of intended deployment scenarios involving multiple interconnected units working together cooperatively towards achieving common objectives while maintaining robustness against failures at any single point along communication paths established throughout entire system lifetime cycle phases starting from initial setup until eventual decommissioning activities conclude successfully without compromising security aspects critical for protecting sensitive payload exchanges occurring over time across all involved parties regardless of their respective positions inside resulting topological arrangements created dynamically according to prevailing environmental conditions encountered locally around individual participants contributing collectively toward fulfilling desired functionality requirements specified beforehand by stakeholders responsible for overseeing project development efforts aimed at delivering reliable solutions capable enough meeting expected performance benchmarks consistently over extended periods even under adverse circumstances potentially arising unexpectedly due external factors beyond direct control exerted internally within managed boundaries defined explicitly prior initiation phase commencement actions taken proactively ahead schedule timelines agreed mutually amongst collaborating teams tasked specifically addressing technical challenges associated closely tied directly linked inherently intertwined inseparably bound interrelated correlated connected relevant pertaining concerning relating touching impacting affecting influencing shaping determining dictating governing regulating controlling managing supervising monitoring observing watching tracking tracing mapping charting plotting graphing diagramming schematizing conceptualizing visualizing imagining envisioning foreseeing predicting forecasting projecting estimating approximating gauging assessing evaluating appraising valuing rating scoring grading ranking positioning placing situating locating situate position place site cite sight site-specific location placement situation situated placed located positioned sited cited situatedly placedly locatedly positionedly.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值