跳转至主要内容
CloudStudio

端点 configuration collection

The endpoint configuration collection object represents a collection of endpoints for which initial configuration is to be established, typically in 设备模型配置 scripts.

The get端点 function receives an object of this type as a parameter, which allows establishing the list of endpoints that should be included within a newly created device, as well as their basic initial configuration. This function is included in the device model script being created.

方法

add端点(address, description, endpointType [, endpointSubType]) The add端点 method allows adding a new endpoint to the collection.

参数

  • address (string): indicates the address of the endpoint within the device. The address must be unique within the device, although endpoints with the same address can exist in different devices.
  • description (string): indicates the description to be used for this endpoint.
  • endpointType (enum): indicates the type of the endpoint being added. To learn more about endpoint types, see the endpoint object reference, especially the endpointType property.
  • endpointSubType (enum, optional): this parameter indicates the endpoint subtype, and can be optionally specified only for certain endpoint types. To learn more about endpoint types and subtypes, see the endpoint object reference, especially the endpointSubType property.

Return value

The add端点 method returns an endpoint configuration object, which represents the endpoint that was just added to the collection.

示例 1

此示例 shows how to create 2 endpoints within the device, one of temperature sensor type with address "1", and another of carbon dioxide sensor type with address "2".

function getEndpoints(deviceAddress, endpoints)
{
	endpoints.addEndpoint("1", "Temperature sensor", endpointType.TemperatureSensor);
	endpoints.addEndpoint("2", "CO2 sensor", endpointType.PpmConcentrationSensor, ppmConcentrationSensorSubType.CarbonDioxide);
}

最后更新于

本页内容