SIG MESH Profile 2.3.6 Models 翻译

2.3.6 Models

A model defines the basic functionality of a node. A node may include multiple models. A model defines the required states (as described in Section 2.3.1), the messages that act upon those states (as described in Section 2.3.3), and any associated behavior.

模型定义了节点的基本功能。一个节点可以包含多个模型。模型定义了所需的状态(如2.3.1节所述)、作用于这些状态的消息(如2.3.3节所述)以及任何相关的行为。

A mesh application is specified using a client-server architecture communicating with a publish-subscribe paradigm. Due to the nature of mesh networks and the recognition that the configuration of behavior is performed by a Configuration Client, an application is not defined in a single end-to-end specification such as a profile. Instead, an application is defined in a client model, a server model, and a control model.

mesh应用程序是使用与发布-订阅范式通信的客户机-服务器体系结构来指定的。由于MESH网络的性质以及对行为配置由配置客户机执行的认识,应用程序没有在单个端到端规范(如配置文件)中定义。相反,应用程序是在客户机模型、服务器模型和控制模型中定义的。

This specification defines three types of model: server models, client models, and control models:

该规范定义了三种类型的模型:服务器模型、客户端模型和控制模型:

  • Server model: A server model is composed of one or more states spanning one or more elements.The server model defines a set of mandatory messages that it can transmit or receive, the behavior required of the element when it transmits and receives such messages, and any additional behavior that occurs after messages are transmitted or received.
  • 服务器模型:服务器模型由跨越一个或多个元素的一个或多个状态组成。服务器模型定义了一组它可以传输或接收的强制消息、元素在传输和接收此类消息时所需的行为,以及在传输或接收消息后发生的任何附加行为。
  • Client model: A client model defines a set of messages (both mandatory and optional) that a client uses to request, change, or consume corresponding server states, as defined by a server model. The client model does not have state.
  • 客户端模型:客户端模型定义一组消息(强制的和可选的),客户端使用这些消息请求、更改或使用相应的服务器状态,这是由服务器模型定义的。客户端模型没有状态。
  • Control model: A control model may contain client model functionality to communicate with other server models and server model functionality to communicate with other client models. A control model may also contain control logic, which is a set of rules and behaviors that coordinate the interactions between other models that the control model connects to.
  • 控制模型:控制模型可以包含与其他服务器模型通信的客户端模型功能和与其他客户端模型通信的服务器模型功能。控制模型还可以包含控制逻辑,控制逻辑是一组规则和行为,用于协调控制模型连接到的其他模型之间的交互。

A single device may include server, client, and control models.

单个设备可以包括服务器、客户机和控制模型

For example, Figure 2.2 shows the element-model structure for a device that implements a server model (Device C) with a state and supporting messages R, S, T, X, Y, Z; and two devices that implement a client model, with Device A supporting messages X, Y, and Z and Device B supporting messages R, S, T, and Z.

例如,图2.2显示了一个设备的元素模型结构,该设备实现了一个具有状态的服务器模型(设备C),并支持消息R、S、T、X、Y、Z;和两个实现客户端模型的设备,设备a支持消息X、Y和Z,设备B支持消息R、S、T和Z。

In another example, Figure 2.3 shows the element-model structure of a device that implements a control model. Device C can communicate with server models as a client (supporting messages X, Y, and Z and messages R, S, and T respectively) and can communicate with client models as a server (supporting messages A, B, and C).

在另一个示例中,图2.3显示了实现控制模型的设备的元素-模型结构。设备C可以作为客户机与服务器模型通信(分别支持消息X、Y和Z以及消息R、S和T),也可以作为服务器与客户机模型通信(支持消息a、B和C)。

 A lighting controller is an example of an implementation of a control model. The lighting controller needs to function as a client to sensors (to measure occupancy and/or ambient light) and to light sources (such as lamps or other luminaires). The lighting controller also would function as a server to a settings client (such as a smartphone application that configures its parameters). Such a lighting controller may be included within a sensor or light source or it may a separate device.

照明控制器是控制模型实现的一个例子。照明控制器需要充当传感器(测量占用率和/或环境光)和光源(如灯具或其他灯具)的客户端。照明控制器还可以作为设置客户机(如配置其参数的智能手机应用程序)的服务器。这种照明控制器可以包括在传感器或光源内,也可以是单独的设备。

Models can define functions of a device as a network node, such as key management, address assignment, and relaying of messages. Models also define physical behaviors of a device built around a network node, such as power control, lighting control, and sensor data collection. There may be nodes implementing only network-related functions, such as Relay nodes or Proxy nodes, while the majority of nodes are able to interact with the physical world by means of controlling electrical power, controlling light emissions, or sensing environmental data.

模型可以将设备的功能定义为一个网络节点,例如密钥管理、地址分配和消息转发。模型还定义了围绕网络节点构建的设备的物理行为,如电源控制、照明控制和传感器数据收集。有些节点只实现与网络相关的功能,如中继节点或代理节点,而大多数节点能够通过控制电力、控制光发射或感知环境数据与物理世界交互。消息可以由多个不同的模型使用。

A message can be used by multiple different models. Message behavior is the same in each model,enabling a common understanding among client, server, and control models because the behavior is consistent regardless of the models that send and process the message.

消息可以由多个不同的模型使用。在每个模型中,消息行为是相同的,这使得客户机、服务器和控制模型之间能够达成共识,因为无论发送和处理消息的模型是什么,消息行为都是一致的。

Model specifications are designed to be very small and self-contained. A model can, at the specification definition time, require other models that must also be instantiated within the same node. This is called extending, which means a model can extend other models.

模型规范被设计为非常小且独立的。在规范定义时,模型可能需要在同一节点内实例化其他模型。这称为扩展,这意味着一个模型可以扩展其他模型。

 Models that do not extend other models are referred to as root models.

 不扩展其他模型的模型称为根模型(ROOT MODEL)

Model specifications are immutable: it is not possible to remove or add behavior to a model, whether the desired behavior is optional behavior or mandatory. Models are not versioned and have no feature bits. If additional behavior is required in a model, then a new extended model is defined that exposes the required behavior and can be implemented alongside the original model.

模型规范是不可变的:不可能删除或添加行为到模型中,不管期望的行为是可选的还是强制的。模型没有版本控制,也没有特性位。如果模型中需要额外的行为,则定义一个新的扩展模型,该模型公开所需的行为,并且可以与原始模型一起实现。

Therefore, knowledge of the models supported by an element determines the exact behavior exposed by that element.

因此,元素所支持的模型的知识决定了该元素所公开的确切行为。

Models may be defined and adopted by Bluetooth SIG and may be defined by vendors. Models defined by Bluetooth SIG are known as SIG adopted models, and models defined by vendors are known as vendor models. Models are identified by unique identifiers, which can be either 16 bits, for SIG adopted models, or 32 bits, for vendor models.

模型可以由蓝牙联盟定义和采用,也可以由厂商定义。由蓝牙联盟定义的模型称为SIG采用的模型,由供应商定义的模型称为供应商模型。模型由唯一标识符标识,对于SIG采用的模型可以是16位,对于供应商模型可以是32位。

For example, Figure 2.4 shows the element-model structure of a device that implements a root model with two bound states and a set of messages operating on each state. The root model is within the primary element and is extended by the extended model that adds another state on a secondary element.Messages are not capable of differentiating among multiple instances of the same state on the same element. Therefore, when more than one instance of a given state is present on a device, each instance is required to be in a separate element. In this example, the second instance of State X is required to be located on the second element because it is the same type of a state and thus has the same types of messages serving it.

例如,图2.4显示了设备的元素-模型结构,该设备实现了具有两个绑定状态和一组在每个状态上操作的消息的根模型。根模型在主元素中,由扩展模型扩展,该扩展模型在次元素上添加另一个状态。消息无法区分同一元素上相同状态的多个实例。因此,当设备上存在给定状态的多个实例时,需要将每个实例放在单独的元素中。在本例中,状态X的第二个实例需要位于第二个元素上,因为它是相同类型的状态,因此具有相同类型的消息服务于它。

This example structure may be multiplied for a composite device. For example, a composite device may have multiple instances of the same root model (or extended models), each on a separate element (or set of elements). Also, if a model (root or extended) needs more than one instance of a particular state, the states must be distributed across several elements so that, at most, a single instance of any given state is on an element.

此示例结构可用于复合设备。例如,一个复合设备可能具有相同根模型(或扩展模型)的多个实例,每个实例位于一个单独的元素(或一组元素)上。另外,如果一个模型(根或扩展)需要一个特定状态的多个实例,那么这些状态必须分布在多个元素上,这样,一个元素上最多只能有一个给定状态的实例。

Figure 2.5 illustrates how the element-model structure of the device in Figure 2.4 might be implemented in a composite device. The element-model structure of the device is described by the Composition Data (see Section 4.2.1) that is read by a Configuration Client after provisioning (see Section 5), using the Configuration Server model and the Configuration Client model (see Sections 4.4.1 and 4.4.2).

图2.5说明了图2.4中设备的元素-模型结构如何在复合设备中实现。设备的元素-模型结构由配置服务器模型和配置客户机模型(参见4.4.1和4.4.2节)在配置后由配置客户机读取的组合数据(参见4.2.1节)描述(参见第5节)

 

posted @ 2020-02-07 10:23  gancai  阅读(303)  评论(0编辑  收藏  举报