SiteWhere物联网云平台架构
SystemArchitecture系统架构
Thisdocument describes the components that make up SiteWhere and how theyrelate to each other.
这个文档描写叙述了sitewhere组件和组件之间的关系。
ArchitectureDiagram架构图
Thefollowing diagram shows the main SiteWhere server components and howthey interact with externalsystems.下图展示了sitewhere服务器组件以及组件怎样与外部系统的交互。
GlobalComponents全局组件
Asshown in the architecture diagram, SiteWhere is composed of manydifferent components that are wired together to provide the coreplatform. In the sections below, we will cover the
components thatare global to the system. All tenants share these global settings.
如上面架构图所看到的,SiteWhere是由很多不同的组件组成,它们彼此连接共同组成核心平台。
以下我们将介绍这些全局性的系统组件。全部的租户共享这些全局配置。
WebApplication Container Web应用容器
SiteWhereis deployed as a Web Application Archive (WAR) file and is designedto run in a web container such as Apache Tomcat. SiteWhere will runon a vanilla version of Apache Tomcat
assuming the configurationfiles are copied into the Tomcatconffolder.
The configuration files may be altered to change the waySiteWhere processes device events and integrates with externalservices.
Web应用容器
SiteWhere採用WAR文件部署,设计在web容器中运行,如apachetomcat。Sitewhere将在apachetomcat
vanilla版本号上运行,tomcat採用的配置文件直接复制到tomcatconf目录。
配置文件做了一些更改,用来处理设备事件,与外部服务集成。
SiteWhereServer SiteWhere服务器
SiteWhereServer is the central application that controls all of the otherSiteWhere components. It is started automatically from the deployedWAR file and bootstraps using a Spring
configuration file located inconf/sitewhere/sitewhere-server.xml. The servermanages the common system components such as user management and theREST services. It also bootstraps one or moretenant engineswhich handle most of
the other processing logic.
SiteWhere服务器是核心应用。用来控制全部相关的组件。
SiteWhere服务器从WAR文件部署就自己主动开启,採用spring配置文件conf/sitewhere/sitewhere-server.xml进行初始化。服务器管理经常使用的组件,如用户管理。REST服务。也会启动一个或多个租户引擎用来处理其它的业务逻辑。
AdministrativeApplication后台管理应用
SiteWhereincludes an HTML5 administrative application that can be used tomanage how the system functions. The information that appears in theapplication is dependent on the login
credentials provided and thepermissions associated with that user. By default, a new SiteWhereinstance has a singleadmin user that has allpermissions and is associated with the default tenant.
SiteWhere包含了HTML5后台管理应用,能够用来管理系统怎样工作的。后台管理的信息依赖于提供给用户的登陆凭证以及用户相关的权限。普通情况下,一个新的sitewhere实例就有一个单独的admin用户拥有全部权限,并关联一个缺省租户。
Someaspects of the system such as users and tenants are managed globally.Changes made to these entities will be reflected across all tenants.Administrative access at this level should
be limited since theseusers can create new users and tenants as well as shutting downrunning tenants, deleting existing users and affecting other systemdata across the board.
像用户、租户一些都是全局管理。这些实体的改变会反映在全部租户中。后台管理的訪问要被限制。由于这些用户能够创建新用户、租户。也能关闭运行的租户,删除现有的用户,影响其它的系统数据。
Mostother aspects of the system are tenant-specific. Each user accountmay be associated with one or more tenants, allowing the user tomanage information for multiple tenants. When
logging in to thesystem, if a user is associated with more than one tenant, they areasked to choose which tenant to manage before proceeding. All othersystem data such as sites, device specifications, devices,assignments, etc are managed at a per-tenant level,
so most of thedata in the administrative interface depends on the user logged inand which tenant was selected.
系统大部分特性都是租户相关的。每一个用户帐号能够与一个或多个租户关联。同意用户管理多个租户的信息。当用户登陆到系统中时。假设与一个以上的租户关联,他将在处理前被要求选择哪个租户来管理。全部其它的系统数据,如网站,设备规格,设备,关联等等,都是在每一个租户层面上管理的,因此大部分后台管理界面的数据依赖于登陆的用户和选择的租户。
RESTServices
Mostof the core functionality related to the SiteWhere APIs is accessibleexternally via REST services. Using the services, an external entitycan create, view, update, or delete entities
in the system. Theservices can also interact with subsystems such as asset management.All REST calls are subject to authentication and use Spring Securityto verify that the user is authorized for the operation.
REST服务
sitewhereAPIs相关的大部分核心功能都能够通过REST服务訪问。通过REST服务,外部实体能够在系统中创建、查看、更新、删除系统中的实体。
服务也能够与诸如资产管理的子系统交互。全部的REST调用都须要认证,系统採用了spring安全机制确保用户操作的授权。
SiteWhereincludes a working version ofSwaggerwhich
adds a user interface around the REST services. Using theSwagger interface, you can interactively execute REST calls against arunning SiteWhere server and view the JSON responses. The defaultSwagger URL for a server is:
http://sitewhere.hostname/sitewhere/
wheresitewhere.hostname is the hostname of the serverrunning SiteWhere.
sitewhere包含了一个swagger的工作版本号,为REST服务添加用户界面。使用swagger界面,你能够运行REST调用,而不是查看sitewhere服务器,浏览JSOAN响应。
缺省的swaggerURL为:
sitewhere.hostname是运行sitewhere的服务器。
GlobalDatastore
Whenstoring and retrieving data, SiteWhere never deals directly with adatabase. Instead, the system defines Service Provider Interfaces(SPIs) for the data operations it needs to
operate and expectsdatastore implementations to comply with the required interfaces. Theuser management datastore is configured at the global level and isbased on the following APIs:IUserManagement:Contains
all of the core user management calls including CRUD methodsfor users, authorities, etc.全局数据存储
当存储和获取数据时。sitewhere不会直接处理数据库。系统为数据操作定义了服务提供接口(SPIs)。用来操作数据。用户管理的数据存储在全局配置,基于以下的APIs
IUserManagement:包含了全部核心用户管理调用。用户权限的CRUD操作。
Whenconfiguring a new SiteWhere server instance, you change settings inthe core Spring configuration file to indicate which type ofdatastore to use for the underlying data implementation.
The types ofdatastores currently supported include MongoDB and Apache Hbase.当配置新的sitewhere服务器实例时,你要改动核心的spring配置文件指出数据存储的类型。眼下数据存储的类型支持Mongodb和apacheHbase。
HazelcastServices
Hazelcastis an in-memory datagrid designed with high performance in mind. Bydefault, each SiteWhere Server instance also acts as a Hazelcastinstance. In the default global configuration,
the Hazelcastconfiguration is loaded from conf/sitewhere/hazelcast.xml.Hazelcast support can be removed by removing the corresponding entryfrom the configuration file.Hazelcast服务
hazelcast是一个分布式内存网络平台。高性能。通常,每一个sitewhere服务器实例也是Hazelcast实例。
全局配置下。hazelcast配置文件位于conf/sitewhere/hazelcast.xml。Hazelcast支持能够被去除。
SiteWherecan use Hazelcast to interactively broadcast event data to otherinterested systems. For example, the SiteWhere plugin for Mule Studiouses Hazelcast to connect to a SiteWhere
server instance and pullevents into the bus as they occur. The events can then be processedusing Mule flow logic in order to integrate event data with othercloud systems or perform other asynchronous processing tasks in realtime. Access to Hazelcast clients
can be limited by adjusting theSiteWhere server Hazelcast configuration so that, for instance, onlymachines in certain IP ranges can receive the event data.sitewhere能够使用hazelcast为其它关联的系统广播事件数据。比如。sitewhere插件mulestudio採用hazelcast连接sitewhere服务器实例。把时间推送至公车。
这些事件能够採用muleflow逻辑处理。与外部云系统集成数据,或者运行同步任务。
Hazelcast客户端訪问权限能够通过调整sitewhere服务器hazelcast的配置文件来限制。比如,仅仅有某个IP地址范围的机器能够接受事件数据。
TenantComponents
Mostcomponents of the system are configured at the per-tenant level. Thisallows for clean separation of data and processing logic from onetenant to the next.
租户组件
系统大部分组件都是在每一个租户层面上配置,这就实现了租户之间的数据和处理逻辑隔离。
TenantEngines
SiteWhere(starting with version 1.2.0) is designed as a multitenant systemwhich means that multiple IoT applications can be served from asingle SiteWhere instance. Each system tenant
has a separate datastore so data is not intermingled between tenants. Each tenant alsohas a separate processing pipeline that can be customized withoutaffecting the processing of other tenants. When SiteWhere Serverstarts for the first time, a default tenant
is created based on thedefault tenant folder found at conf/sitewhere/tenant-template.租户引擎
sitewhere(1.2.0版本号以后)就被设计成了多租户系统,意味着多个IOT应用能够被一个sitewhere实例服务。
每一个系统租户都有一个独立的数据存储,因此数据在租户之间不会混淆。每一个租户都有独立的处理管道。在不影响其它租户的情况下定制。
当sitewhere服务器第一次開始时,缺省租户依据缺省的租户文件conf/sitewhere/tenant-template被创建。
Thedefault folder structure including configuration is copied to atenant-specific configuration folder located atconf/sitewhere/tenants/xxx wherexxxis
the unique id for the tenant. The tenant configuration file isnamedsitewhere-tenant.xml and is located in theroot of the folder. Making changes to the configuration file for atenant will alter the processing logic for just that tenant. Newtenants
can be added from the SiteWhere administrative application.Once created, tenants can be started and stopped dynamically withoutshutting down the entire server. For instance, to make configurationchanges to one tenant, it may be shut down, reconfigured, and
broughtback up without affecting other running tenants.包含配置的缺省目录复制到租户的配置目录中conf/sitewhere/tenants/xxx,xxx是租户独一无二的ID浩。租户配置文件sitewhere-tenant.xml位于目录顶部。对于一个租户的配置改变将会改变那个租户的处理逻辑。新的租户能够通过管理应用加入。一旦创建,租户能够动态的開始和停止不须要关闭整个服务器。比如。改变一个租户的配置。可能关闭,又一次配置,回滚而不会影响到其它运行的租户。
Tenant Datastores
As with global datastores, tenant datastores configure SPI implementations that provide persistence of tenant-level information such as device and asset management. Service provider interfaces implemented include:
IDeviceManagement:
Contains all of the core device management calls including CRUD methods for sites, specifications, devices, events, etc.IAssetManagement:
Contains all of the core asset management calls including CRUD methods for asset categories and assets.Tenant datastores are configured in the conf/sitewhere/xxx-tenant.xml configuration file (where xxx is the tenant id).
租户数据存储
作为全局数据存储,租户数据存储配置了SPI接口实现用来提供租户级别信息的持久保存,比如设备、资产管理信息。
SPI服务提供接口实现包含:
IDeviceManagement:
包含了全部核心设备管理调用。包含网站、规格、设备、事件等CRUD增删改查方法操作。IAssetManagement:
包含了全部核心资产管理调用,包含资产分类和资产的CRUD增删改查方法操作。租户数据存储配置在 conf/sitewhere/xxx-tenant.xml 文件里。
Communication Engine
The SiteWhere communication engine handles all functionality related to interacting with devices. Its responsibilities include:
Registration of new or existing devices
SiteWhere devices can be created manually with API calls, but it is often preferable to have devices self-register. In that case, the device provides a unique hardware id and a specification token to the system which in turns creates a new device
record that can start accepting events. SiteWhere assumes that each device will have a unique id in the system so it can be independently addressed. The specification token passed at startup indicates the type of hardware the device is using and references
a device specification that already exists in the system. Devices send a registration event when they boot or connect to the network and SiteWhere either creates a new device record or finds an existing one. SiteWhere returns a response message to the device
indicating the registration status.通信引擎
SiteWhere通信引擎处理全部与设备交互相关的功能,主要作用包含:
新的设备或者已有设备的注冊
SiteWhere设备能够通过API调用手工创建,可是很多其它情况下设备自己注冊。
在这样的情况下。设备提供了独一无二的硬件id和规格token,系统依次创建新的设备记录。開始接收事件。
SiteWhere假定在系统中每一个设备都有一个独一无二的id。因此能够被独立寻址。在開始启动时传递的设备规格token指明了设备使用的硬件类型,系统中已经存在的设备规格。
当设备启动并连接到网络时,设备传送一个注冊事件,SiteWhere也会创建一个新设备记录或者找到已有的设备。SiteWhere返回一个相应消息给设备指明注冊状态。
Receipt of events from connected devices
Once registered with the system, devices can report any number or type of events to SiteWhere, which in turn stores the events. Event types include location updates, sensor measurements and other acquired data, or alerts in response to exceptional
events. Devices also have the ability to acknowledge receipt of commands issued by SiteWhere. Events are delivered to SiteWhere via an inbound event pipeline which provides a modular way of introducing new functionality for processing incoming data.Delivery of commands to connected devices
Each device registered with SiteWhere has an associated device specification which is tied to the type of hardware running on the device. Each device specification has a list of commands that can be executed against devices with that specification.
SiteWhere allows any number of commands to be added for a specification and each command can carry any number of arguments. The commands and arguments can be added via the administrative user interface or via REST calls. When commands are executed, they travel
through a pipeline that encodes them in an expected format and delivers them across an expected protocol.从已连接设备接收事件
设备一旦在系统中注冊,就能够向SiteWhere报告不论什么事件的类型和数字,并依次保存在事件中。
事件类型包含位置更新。传感器測量值和其它获得的数据,或者异常事件的告警。设备能够接收SiteWhere发起的命令。
事件通过入站事件管道传递给SiteWhere,入站事件管道提供了一种模块化的方法来添加新的功能,用来处理传入的数据。
公布命令到已连接的设备
每一个在SiteWhere中注冊的设备都有一个关联的设备规格,设备规格指明了设备中运行的硬件类型。
每一个设备规格都有一个命令列表。能够在关联该规格的设备中运行,SiteWhere同意在设备规格中加入指令。每一个指令能够有很多參数。
这样的指令和參数能够通过后台管理界面加入,或者通过REST调用。当指令运行时,他们通过管道,採用一定的编码格式,通过一定的协议传递。
The flow of data in the SiteWhere communication engine is shown below:
SiteWhere通信引擎中的数据流例如以下图所看到的:
---------------------------------------------------------------------------------------------------------------------------------------------
以下待翻译
---------------------------------------------------------------------------------------------------------------------------------------------Asset Modules
SiteWhere assets represent objects in the physical world – people, places, and things. Device specification assets are used to describe the hardware information/configuration for a type of device. Device assignment assets are used to describe an
entity associated with a device – a person associated with a badge or a bulldozer associated with a location tracker or a hospital ward associated with a piece of hospital equipment.Rather than hard-coding a schema for assets in the system, SiteWhere defines SPIs for general asset types and allows asset modules to be plugged in to provide asset definitions. This allows existing identity management systems to be used in providing
a list of available person assets. It also allows product catalog systems to be used in defining available hardware assets. SiteWhere uses asset modules in a read-only manner and only ever references entities based on a unique id understood by the underlying
asset module. Maintaining the list of available assets is left to the systems behind the asset modules (which usually already have a user interface specific to the features they provide).SiteWhere also provides the concept of asset categories which reside in the SiteWhere datastore. Asset categories are containers for assets of a given type and may be added/edited from
within the administrative console. Asset categories are loaded as asset modules at runtime, allowing assets to be pulled from the datastore in addition to modules loaded from other sources such as XML files or third-party systems.资产模块
SiteWhere资产模块是指物理世界中的对象,人、地点和物体。设备规格资产是用来描写叙述一种设备的硬件信息或配置,设备关联资产是用来描写叙述与设备关联的实体。如与徽章关联的人、与位置跟踪器关联的挖掘机、与某件医院设备相关联的医院病房。
SiteWhere不是在系统中为资产硬编码一个模式。而是为通用资产类型定义了SPIs接口,同意资产模块插入并提供资产定义。
这就同意现有的认证管理系统用来提供人员资产的列表,也同意设备分类系统用来定义能够提供的硬件资产。
SiteWhere已仅仅读方式使用资产模块。仅仅依据唯一的能够被底层资产模块理解的ID进行实体引用。
现有资产的维护就交给系统来完毕(通常实用户界面描写叙述资产的特征)。
Object Model
SiteWhere provides a comprehensive object model that captures the relationships between all of the various concepts in tracking device data. The diagram below shows some of the core objects in the model and their relationships:
对象模型
SiteWhere提供了广泛的对象模型用来理解设备数据跟踪的各种概念之间的关系。下图展现了模型和它们之间关系的核心对象。
Sites
Sites are used to organize devices that are related so that their events can be looked at from a grouped perspective. The primary use case for sites is in location-aware devices. A site provides a containing entity to which a map can be assigned
so that location data can be viewed in the context of that map. When creating a site in the administrative application, you can assign a map type and initial location/zoom so that location events for that site are rendered on the given map. The map rendering
code uses the Leaftlet JavaScript map library and is able to create a dynamic overlay layer based directly on SiteWhere REST calls. Currently supported map types include:Mapquest World Map
Used to render location data on a world map using MapQuest tiles.
网站
网站用来组织相关联的设备,从而数据能够从分组的视角查看。网站的基本用途是位置感知的设备,网站提供了与地图关联的容器实体。因此位置数据能够在地图上展示。在后台管理应用中创建一个网站时,你能够指定地图类型和初始位置,网站的位置事件在给定的地图中展现。地图渲染代码使用Leaftlet JavaScript地图库,能够直接基于SiteWhere REST调用创建一个动态的图层。
眼下支持的地图类型包含:
Mapquest World Map
採用Mapquest图块在世界地图上渲染位置数据。
GeoServer Custom Map (Custom Tileset)
Used to render data on a custom GeoServer tile layer. This allows unique maps and floor plans to be used as the background for SiteWhere location rendering. The maps can include custom vector or raster data specific to the location data being visualized.
More map types will be added in the near future, but most use cases are covered by the existing map types.
SiteWhere was originally written as a system to track location-aware devices. Sites provided a way to group devices in the same physical vicinity (for instance in the same office building). There are some use cases that do not necessarily
require the location-based aspects of sites, but they can still benefit from being able to view events across a group of related devices.GeoServer Custom Map (Custom Tileset)
GeoServer 定制化地图(定制图块)
用来在定制化的GeoServer图层上渲染数据。同意使用独一无二的地图和地理规划作为SiteWhere位置渲染的背景。这样的地图能够包含定制化的矢量数据或者栅格数据,用于位置数据显示。未来会加入很多其它的地图类型,但现有的地图类型能够覆盖大部分使用案例。SiteWhere初始是作为设备位置跟踪的系统开发的,网站为在相邻区域的设备提供了分组的方法,比如在同一栋办公楼。有一些使用情况不须要网站方面的位置信息,可是他们能够通过相关设备的分组方便的查看事件。Zones
Another important feature for location-aware applications is the concept of zones that carry special meanings. For instance, in an airport, there are secure areas where only certain personnel should be allowed. In an application that monitors airport
security, it makes sense to be able to fire an alert if an unauthorized person enters a secure zone.The SiteWhere administrative application allows zones to be defined based on the map associated with a site. In the zone editor, you can click points on the map to set the boundaries of the zone. You can also specify the border and background colors
as well as the opacity of the overlay when shown on the map. The Leaflet overlays automatically load the list of zones for a site when displaying its map. On the integration side of things, SiteWhere provides a node in Mule Studio that will compare locations
coming into the system against defined zones, allowing the developer to react to devices entering or exiting zones.区域
对位置敏感应用的另外一个重要特征是区域的概念,区域带有特殊的意义,比如,在机场里,有安全区域,仅仅有特定的人员同意进入,在一个监控机场安全的应用里。假设非授权人员进入安全区,能够发出告警就很实用。
SiteWhere后台管理应用同意基于网站相关的地图定义区域。在区域编辑器中。你能够在地图上打点设定区域边界。你也能够指定边界和背景颜色,以及图层在地图上显示的透明度。当网站在地图上显示时。Leaflet图层自己主动为网站载入区域列表。在集成时。SiteWhere在MuleStudio中提供了一个节点,用来比較进入系统的位置与定义的区域。同意开发人员依据设备输入和现有的区域做出反应。
Device Specifications
Specifications are used to capture characteristics of a given hardware configuration. This is not necessarily a one-to-one mapping to a part number or SKU since some peripheral devices may have been added or certain characteristics upgraded. A device
specification contains a reference to a hardware asset which provides the basic information about the hardware including name, description, image URL, etc.Device Specification Commands
A device specification contains a list of commands that may be invoked by SiteWhere on the device. Commands can be added, updated, viewed, and deleted in the admin UI or via the REST services. It is perfectly acceptable for two device specifications
to point to the same asset type, but have a different set of commands, reflecting different configurations of the given device.Device Command Invocations
SiteWhere provides APIs for invoking commands on a device based on the list available in its device specification. Each command invocation is captured as an event associated with the current device assignment. The admin UI and REST services allow
commands to be invoked and previous invocations for an assignment to be searched.设备规格
规格被用来描写叙述特定硬件配置的特征。由于一些外围设备加入进来,特定特征的升级,所以没有必要与SKU一一相应。
设备规格包含了硬件资产的參考信息。提供了基本信息,如硬件的名称,描写叙述。图片URL等等。
设备规格指令
一个设备规格包含了很多指令,能够被SiteWhere上的设备运行。指令能够通过管理UI或者REST服务加入、更新、显示和删除。接受两个设备规格指向同一个资产类型,可是具有不同的指令,反映出给定的设备的配置不同。
设备指令运行
SiteWhere提供了APIs用来调用设备的指令。指令调用是基于设备规格中可提供的列表。每一个指令调用都能够作为与当前设备关联的事件被捕获。管理UI和REST服务同意指令调用。和先前的指令查询。
Device Command Responses
After a device processes a command invocation, it may return a response to SiteWhere. Command invocation messages carry an originator event id that can be sent back with any responses to tie responses back to the event that they are responding to.
SiteWhere provides a simple ack event that acknowledges receipt of an event. Devices can also return locations, measurements, or alerts in responses to commands and use the originator id to associate those with a command as well. From an API perspective, a
user can list the responses for a given command (any number of responses can be associated) and act on the responses to initiate other actions.Devices
Devices are a SiteWhere representation of connected physical hardware that conforms to an assigned device specification. Each device is addressable by a unique hardware id that identifies it uniquely in the system. A new device can register itself
in the system by providing a hardware id and device specification token. SiteWhere in turn creates a new device record via the APIs and (optionally) creates a placeholder unassociated device assignment (see below) to allow events to be collected for the device.
Devices can be manually added via the REST services or via the admin UI.设备指令响应
设备处理指令调用之后,将会返回一个响应到SiteWhere。指令调用消息携带最初的事件id和响应一起传回。
SiteWhere提供一个简单的ack事件。表示接收到了事件。设备依据指令也能传回位置、測量值、告警,採用初始id与命令关联。
从API来看。用户列出给定指令的响应,而且运行响应。
设备
设备在sitewhere中就是与设备规格关联的所连接的物理硬件,每一个设备都有一个独一无二的硬件id在系统中进行标识。
新设备通过提供硬件id和规格token自己注冊。Sitewhere能够通过APIs接口创建一个新的设备记录,也能够创建一个无关联的设备备用,同意採用事件进行收集。设备也能够通过REST服务手工加入,也能够通过管理后台。
Device Groups
Device groups allow multiple related devices or subgroups to be organized into logical units. The groups can then be used for performing operations collectively rather than performing them on a per-device basis. Each group can have zero or more
roles assigned to it, allowing arbitrary groupings based on application needs. Devices may belong to multiple groups and may be assigned zero or more roles within the group. This structure allows queries such as “find all devices from the ‘heavy-equipment’
group that have the role ‘leased-equipment’ and issue a ‘getCurrentLocation’ command”.设备组
设备组同意多个相关的设备或者子设备组组成一个逻辑单元。
设备组能够用来进行组操作,而不是单个设备操作。每一个设备组没有或者有多个角色关联。依据英语需求进行分组。设备能够属于多个组。也能够不属于不论什么一个组。或者在组内多个角色。
这样的结构同意“从重型装备中找到全部的设备“这样的查询语句,或者租用装备。或公布一个获取当前地址的指令。
Device Assignments
Events are not logged directly against devices, since a given device may serve in a number of contexts. For instance, a visitor badge may be assigned to a new person every day. Rather than intermingle event data from all the people a badge has been
assigned to, the concept of a device assignment allows events to be associated with the asset they relate to. A device assignment is an association between a device, a site, and (optionally) a related asset. Some assignments do not specify an asset and are
referred to as unassociated. A real-world example of this is a vending machine that has wireless connectivity to report inventory. The device is the asset, so there is no need to associate
an external asset.设备关联
事件不会和设备一起被记录,由于一个设备能够在多种场景下使用。
比如,訪问者徽章能够每天都与一个新的人员关联。不是记录与徽章关联的全部人员的混合数据,设备关联的概念是让事件与它相关的资产关联。
一个设备关联能够是与设备之间,与网站之间,或者与相关资产之间。
一些关联并没有描写叙述资产,被觉得无关联。真实世界的样例,无线连接报告库存的机器,这个设备是资产,因此,也没有必要与外界资产关联。
Current Device State
Device assignments also act as a storage bin for recent device state. As events are processed for an assignment it can keep a record of the most recent event values. By default, the assignment stores the most recent location measurement, the most
recent value for each measurement identifier, and the most recent alert for each alert type. Using this stored state, SiteWhere can infer the current state of a device without having to send a command to request new data. Included in the state information
is the date on which the data was stored, so logic can intelligently choose when to request an update of the data.当前设备状态
设备关联也表示近期设备状态的存储。当一个事件由于关联进行了处理,它能够记录近期事件的记录。通常。关联存储了近期位置測量。每一个測量器的近期值。使用这样的存储的状态,sitewhere能够通知设备的当前状态,不须要发送请求数据。时间信息也在状态信息里,因此逻辑上当请求更新数据时就选择了时间戳。
Assignment Status Indicator
Each device assignment also holds a status of the assignment itself. By default, an assignment is marked active immediately after it is created. Using the REST services or admin UI, the status can be changed to missing if
the device or associated asset have been reported missing. Processing logic can be altered for missing assignments. The assignment status is updated to released when an assignment is terminiated. This indicates the device is no longer
assigned and may be reassigned.关联状态指示器
每一个设备关联自身也有一个关联状态,普通情况下,关联在创建后马上标识为活跃状态。假设设备或者关联的资产被报告丢失,能够通过REST服务或者关联界面改动状态。丢失的关联设备能够改变处理逻辑,关联终止时关联状态被更新为停止。这也指明设备不再关联。能够被又一次关联。
Device Events
Device events are the data generated by connected devices interacting with SiteWhere. They are the core data that SiteWhere revolves around. SiteWhere captures many types of events including:
Meaurements
Measurement events send measured values from a device to SiteWhere. Measurements are name/value pairs that capture information gathered by the device. For instance, a weather sensing device might send measurements for temperature, humidity, and
barometric pressure. A single measurements event can send any number of measurements to SiteWhere (to prevent the overhead of having to repeatedly send multiple events to capture state).Locations
Location events are used to reflect geographic location (latitude, longitude, and elevation) for devices that have the ability to measure it. Location events are stored with a geospatial index when added to Solr so that they may be queried as such.
Alerts
Alert events are sent from a device to indicate exceptional conditions that SiteWhere may need to act on. For instance, a fire alarm might send a smoke detected alert to indicate it has been triggered. Alerts contain two
primary pieces of information: a type and a message. The alert type is used to identify which class of alert is being fired. The alert message is a human-readable message suitable for displaying in a monitoring application.设备事件
设备事件是与sitewhere交互的连接设备所产生的数据,是sitewhere重点解决的核心数据。sitewhere能够捕获的设备类型包含:
測量值
測量事件从设备向sitewhere发送測量值,測量值是健-值对,是设备採集的信息。比如,天气传感器能够传送温度、湿度、和大气压測量值。单个測量事件能够向sitewhere发送随意数量的值()。
位置
位置事件用来反映能够检測到位置的设备所处的地理位置。经度。纬度。海拔。
位置事件存储在地理空间索引中,加入到了solr中,因此能够被搜索。
告警
告警事件从设备发来表示异常,比如。火警能够在触发后发送一个烟雾探測告警,告警包含两种主要的信息。类型和消息。
告警类型用来指示哪种火警类型。告警信息是人们能够读懂的信息。在监控应用中使用的。
Command Invocations
Each time a command is invoked via SiteWhere, the information about the invocation is stored as an event for the current device assignment. The invocation captures which command was executed, when it was executed, values for command parameters,
etc.Command Responses
If a device generates a response to a command invocation, the response is stored as an event. Responses may be in the form of measurements, locations, alerts, or acks. If the device passes an originating event id with the response, the response
is tied back to the original command invocation. The REST APIs allow all responses for a given command invocation to be enumerated so that they can be processed.All event types share some common information that applies more generally to events. Each event records an event date and a received date. The event date is the timestamp for when the data was gathered by the device. It is important to understand
that some devices cache events to prevent the battery drain of network access. Because of this, the event date may differ significantly from the received date, which is the date that the event was processed by SiteWhere. All events also contain an area for
arbitrary metadata. This allows application-specific information to be piggy-backed on events so it can be used in later processing.指令调用
每次指令通过sitewhere调用时。调用信息也作为事件存储在当前设备关联中。调用信息採集了哪个指令被调用了。什么时候运行的,指令的參数值等等。
指令响应
假设设备对指令调用产生了响应,响应也作为事件被保存下来。
响应能够是測量值形式。位置。告警或者ack值。假设设备传递了一个初始事件id,响应与初始指令调用一起传回。REST APIs同意特定的指令调用响应被枚举到,因此它们也能够处理到。
全部事件类型共享同样的信息,每一个事件记录事件日期和接收日期。事件日期是设备採集数据的时间戳。对于理解设备事件。避免网络问题很重要。因此。事件日期与接收日期不同,接收日期是sitewhere处理的日期。
全部事件都包含必要的元数据。这就同意应用信息日后能够使用。
SiteWhere物联网云平台架构的更多相关文章
- EasyDarwin流媒体云平台架构
EasyDarwin目前正在做的开源流媒体云平台架构:
- 【原创】基于Docker的CaaS容器云平台架构设计及市场分析
基于Docker的CaaS容器云平台架构设计及市场分析 ---转载请注明出处,多谢!--- 1 项目背景---概述: “在移动互联网时代,企业需要寻找新的软件交付流程和IT架构,从而实现架构平台化,交 ...
- 微服务与K8S容器云平台架构
微服务与K8S容器云平台架构 微服务与12要素 网络 日志收集 服务网关 服务注册 服务治理- java agent 监控 今天先到这儿,希望对技术领导力, 企业管理,系统架构设计与评估,团队管理, ...
- SAP云平台架构概述
在我们开始SAP云平台的架构之旅之前,让我们先看看SAP已经发布的一些其他云产品.这些云产品方案可以分为公有云和私有云两种. SAP公有云解决方案见下图最右侧,比较著名的有SAP SuccessFac ...
- 微服务架构:基于微服务和Docker容器技术的PaaS云平台架构设计(微服务架构实施原理)
版权声明:本文为博主原创文章,转载请注明出处,欢迎交流学习! 基于微服务架构和Docker容器技术的PaaS云平台建设目标是给我们的开发人员提供一套服务快速开发.部署.运维管理.持续开发持续集成的流程 ...
- Docker容器技术的PaaS云平台架构设计***
基于微服务架构和Docker容器技术的PaaS云平台建设目标是给我们的开发人员提供一套服务快速开发.部署.运维管理.持续开发持续集成的流程.平台提供基础设施.中间件.数据服务.云服务器等资源,开发人员 ...
- ESP8266-向物联网云平台发送数据--dweet
方法一: //向物联网平台发送数据 //发送数据格式: https://dweet.io/dweet/for/my-thing-name?hello=world 免费平台 //my-thing-nam ...
- YY游戏私有云平台实践 (转自InfoQ )
作者 风河 发布于 2016年1月13日 | 讨论 编者按:YY游戏的页游早在2013年就在云平台上运行,其Cloud 1.0已经支撑几十万的同时在线用户.日前,YY游戏云平台进行了Cloud 2 ...
- eKing Cloud基础云平台演进之路
出口转内销.首发于公司微信公众号,作者本人,现转载到此.本来写得比较技术,还算有点干货,但是结果被编辑咔咔咔,就只剩下下面这些内容. 大型企业如何开启自己的快速上云之路? 2017-12-08 易建科 ...
随机推荐
- Ucenter添加新应用
最近手头上有个项目需要用到Ucenter跟Discuz和UcHome整合到一起,使用同步登录.注册,使用同一的用户数据. 以前没用过Ucenter,第一次接触,看过官网的教程感觉不难.于是开始动手,下 ...
- JavaScript基础入门教程(一)
本系列教程的说明 本教程说白了可以说是我自己学习JavaScript的笔记,主要内容参考自<JavaScript权威指南>,部分内容可能来自互联网,本系列教程假设学者之前学过c或者其它的编 ...
- 如何破解linux用户帐号密码一
ENCRYPT_METHOD SHA512 定义帐号密码的加密方式 1.第一步拿到散列,也就是加密后的密码hash值 2.可以去一些彩虹表(rainbow)网站查询这些hash对应的密码明文,稍微花些 ...
- 通过JSONP实现完美跨域
通过JSONP实现完美跨域 三水清 2010-06-11 20:17:47 以前我经常在博客说JSONP,例如我的WordPress天气插件就是通过JSONP来调用的天气数据,今天就说说通过JSONP ...
- 关于TagHelper的那些事情——自定义TagHelper(TagHelper的Attributes)
接上 Attributes 在最新的VS2015RC版,开始支持了TagHelper的智能提示,主要体现在在写TagHelper有Attributes的提示,正确的Tag和Attribute会变成粗体 ...
- MySQL建表时,日期时间类型选择
MySQL(5.5)所支持的日期时间类型有:DATETIME. TIMESTAMP.DATE.TIME.YEAR. 几种类型比较如下: 日期时间类型 占用空间 日期格式 最小值 最大值 零值表示 D ...
- 关于判断语句中如:while not xx: 或者:if not xx: 的含义及用法解析
关于判断语句中如:while not xx: 或者:if not xx: 的含义及用法解析 name='' while not name: name=raw_input(u'请输入姓名:') prin ...
- vue中引入第三方字体图标库iconfont,及iconfont引入彩色图标
iconfont字体图标使用就不多说了,大致是几部: 1.在iconfont官网选图标,加入购物车,加入项目,下载到本地,解压 2.在项目assets目录新建目录iconfont,用于存放刚才下载解压 ...
- Chrome DevTools快捷键
- 登录Tomcat控制台
在http://localhost:8080界面中,右上角有三个按纽对应着三个控制台:Server Status控制台,Manager App控制台和Host Manager控制台.Server St ...