Endpoint configuration collection
The endpoint configuration collection object represents a collection of endpoints for which initial configuration is to be established, typically in device model configuration scripts.
The getEndpoints 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.
Methods
### addEndpoint(address, description, endpointType [, endpointSubType]) The addEndpoint method allows adding a new endpoint to the collection.
Parameters
- 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 addEndpoint method returns an endpoint configuration object, which represents the endpoint that was just added to the collection.
Example 1
This example 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);
}Device model configuration
The device model configuration object allows establishing the basic configuration for a device model, typically used in device model configuration scripts.
Endpoint configuration
The endpoint configuration object represents the initial configuration of an endpoint, typically in device model configuration scripts. Objects of this type are created...