diff --git a/README.md b/README.md index 5b9b555..159b905 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,7 @@ Whenever a new IoT Agent wants to register itself into the IoTAgent Manager, it the following path: ``, indicating the following information: * *protocol*: Name of the protocol served by the IoTAgent. * *description*: Textual description for its display in portals. +* *transports*: List of transport protocols supported by the IoT Agent. * *iotagent*: URL address where requests for this IoT Agent will be redirected. * *resource*: Unique string used to identify different IoT Agents for the same protocol. * *services*: List of device Configurations available in the IoT Agent. The IoTA Manager saves a cache for all the @@ -139,6 +140,7 @@ IoT Agent: { "protocol": "GENERIC_PROTOCOL", "description": "A generic protocol", + "transports": ["HTTP", "MQTP"], "iotagent": "http://smartGondor.com/iot", "resource": "/iot/d", "services": [ @@ -174,6 +176,7 @@ response from the server: { "protocol" : "PDI-IoTA-UltraLight", "description" : "UL2", + "transports" : ["HTTP", "MQTP"], "endpoints" : [ { "endpoint" : "http://127.0.0.1:8080/iot", "identifier" : "idcl1:8080", diff --git a/lib/model/Configuration.js b/lib/model/Configuration.js index 169312e..491193c 100644 --- a/lib/model/Configuration.js +++ b/lib/model/Configuration.js @@ -35,6 +35,7 @@ var Configuration = new Schema({ service: String, protocol: String, description: String, + transports: Array, subservice: String, cbHost: String, timezone: String, diff --git a/lib/model/Protocol.js b/lib/model/Protocol.js index 94c717e..3cf807a 100644 --- a/lib/model/Protocol.js +++ b/lib/model/Protocol.js @@ -29,7 +29,8 @@ var Protocol = new Schema({ iotagent: String, resource: String, protocol: String, - description: String + description: String, + transports: Array }); function load(db) { diff --git a/lib/services/configurationData.js b/lib/services/configurationData.js index 24df463..c39f105 100644 --- a/lib/services/configurationData.js +++ b/lib/services/configurationData.js @@ -98,7 +98,7 @@ function createGetWithFields(fields) { }; } -function save(protocol, description, iotagent, resource, configuration, oldConfiguration, callback) { +function save(protocol, description, transports, iotagent, resource, configuration, oldConfiguration, callback) { var configurationObj = oldConfiguration || new Configuration.model(), attributeList = [ 'name', @@ -123,6 +123,7 @@ function save(protocol, description, iotagent, resource, configuration, oldConfi configurationObj.protocol = protocol; configurationObj.description = description; + configurationObj.transports = transports; configurationObj.iotagent = iotagent; configurationObj.resource = resource; diff --git a/lib/services/configurations.js b/lib/services/configurations.js index 0cba0ae..593e423 100644 --- a/lib/services/configurations.js +++ b/lib/services/configurations.js @@ -65,6 +65,7 @@ function translateToApi(configurations) { 'resource', 'iotagent', 'description', + 'transports', 'protocol', 'internalAttributes', 'attributes', diff --git a/lib/services/protocolData.js b/lib/services/protocolData.js index 2f31b4b..510a106 100644 --- a/lib/services/protocolData.js +++ b/lib/services/protocolData.js @@ -35,7 +35,7 @@ var Protocol = require('../model/Protocol'), op: 'IoTAManager.ProtocolAPI' }; -function processConfiguration(protocol, description, iotagent, resource, configuration, callback) { +function processConfiguration(protocol, description, transports, iotagent, resource, configuration, callback) { configurations.get(configuration.apikey, resource, protocol, function(error, oldConfiguration) { if (error) { callback(error); @@ -43,6 +43,7 @@ function processConfiguration(protocol, description, iotagent, resource, configu configurations.save( protocol, description, + transports, iotagent, resource, configuration, @@ -52,6 +53,7 @@ function processConfiguration(protocol, description, iotagent, resource, configu configurations.save( protocol, description, + transports, iotagent, resource, configuration, @@ -129,7 +131,7 @@ function save(newProtocol, callback) { callback(error); } else { var protocolObj = protocol || new Protocol.model(), - attributeList = ['iotagent', 'resource', 'protocol', 'description'], + attributeList = ['iotagent', 'resource', 'protocol', 'description', 'transports'], actions = []; for (var i = 0; i < attributeList.length; i++) { @@ -149,6 +151,7 @@ function save(newProtocol, callback) { processConfiguration, newProtocol.protocol, newProtocol.description, + newProtocol.transports, newProtocol.iotagent, newProtocol.resource))); } diff --git a/lib/templates/protocol.json b/lib/templates/protocol.json index cc62ae8..0e57d88 100644 --- a/lib/templates/protocol.json +++ b/lib/templates/protocol.json @@ -14,6 +14,11 @@ "type": "string", "required": true }, + "transports": { + "description": "The transport protocols supported by the IoT Agent", + "type": "array", + "required": false + }, "iotagent": { "description": "URL Where the IoTAgent is listening", "type": "string", @@ -74,4 +79,4 @@ } } } -} \ No newline at end of file +}