diff --git a/Pepperdash Core/Pepperdash Core/Comm/ControlPropertiesConfig.cs b/Pepperdash Core/Pepperdash Core/Comm/ControlPropertiesConfig.cs index 0c9940e..a07e747 100644 --- a/Pepperdash Core/Pepperdash Core/Comm/ControlPropertiesConfig.cs +++ b/Pepperdash Core/Pepperdash Core/Comm/ControlPropertiesConfig.cs @@ -13,7 +13,6 @@ namespace PepperDash.Core /// public class ControlPropertiesConfig :PropertiesConfigBase { - /// /// The control method for the device /// @@ -38,6 +37,9 @@ namespace PepperDash.Core [JsonProperty("controlPortName", NullValueHandling = NullValueHandling.Ignore)] // In case "null" is present in config on this value public string ControlPortName { get; set; } + /// + /// ConfigurationProperties for IP connections + /// [JsonProperty("tcpSshProperties")] public TcpSshPropertiesConfig TcpSshProperties { get; set; } @@ -78,119 +80,11 @@ namespace PepperDash.Core [JsonProperty("deviceReadyResponsePattern")] public string DeviceReadyResponsePattern { get; set; } + /// + /// Constructor + /// public ControlPropertiesConfig() { - SchemaJson = @" -{ - 'definitions': {}, - '$schema': 'http://json-schema.org/draft-07/schema#', - '$id': 'http://example.com/root.json', - 'type': 'object', - 'title': 'The Root Schema', - 'properties': { - 'tcpSshProperties': { - '$id': '#/properties/tcpSshProperties', - 'type': 'object', - 'title': 'The Tcpsshproperties Schema', - 'default': null - }, - 'method': { - '$id': '#/properties/method', - 'type': 'string', - 'title': 'The Method Schema', - 'default': '', - 'examples': [ - 'ssh' - ], - 'pattern': '^(.*)$' - }, - 'controlPortDevKey': { - '$id': '#/properties/controlPortDevKey', - 'type': 'string', - 'title': 'The Controlportdevkey Schema', - 'default': '', - 'examples': [ - 'processor' - ], - 'pattern': '^(.*)$' - }, - 'controlPortNumber': { - '$id': '#/properties/controlPortNumber', - 'type': 'integer', - 'title': 'The Controlportnumber Schema', - 'default': 0, - 'examples': [ - 1 - ] - }, - 'controlPortName': { - '$id': '#/properties/controlPortName', - 'type': 'string', - 'title': 'The Controlportname Schema', - 'default': '', - 'examples': [ - 'hdmi1' - ], - 'pattern': '^(.*)$' - }, - 'irFile': { - '$id': '#/properties/irFile', - 'type': 'string', - 'title': 'The Irfile Schema', - 'default': '', - 'examples': [ - 'Comcast Motorola DVR.ir' - ], - 'pattern': '^(.*)$' - }, - 'ipid': { - '$id': '#/properties/ipid', - 'type': 'string', - 'title': 'The Ipid Schema', - 'default': '', - 'examples': [ - '13' - ], - 'pattern': '^(.*)$' - }, - 'endOfLineChar': { - '$id': '#/properties/endOfLineChar', - 'type': 'string', - 'title': 'The Endoflinechar Schema', - 'default': '', - 'examples': [ - '\\x0d' - ], - 'pattern': '^(.*)$' - }, - 'endOfLineString': { - '$id': '#/properties/endOfLineString', - 'type': 'string', - 'title': 'The Endoflinestring Schema', - 'default': '', - 'examples': [ - '\n' - ], - 'pattern': '^(.*)$' - }, - 'deviceReadyResponsePattern': { - '$id': '#/properties/deviceReadyResponsePattern', - 'type': 'string', - 'title': 'The Devicereadyresponsepattern Schema', - 'default': '', - 'examples': [ - '.*>' - ], - 'pattern': '^(.*)$' - } - }, - 'required': [ - 'method' - ] -} -"; - - EndOfLineString = CrestronEnvironment.NewLine; } } diff --git a/Pepperdash Core/Pepperdash Core/Comm/Schema/ControlPropertiesConfigSchema.json b/Pepperdash Core/Pepperdash Core/Comm/Schema/ControlPropertiesConfigSchema.json new file mode 100644 index 0000000..ec74fc9 --- /dev/null +++ b/Pepperdash Core/Pepperdash Core/Comm/Schema/ControlPropertiesConfigSchema.json @@ -0,0 +1,106 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "title": "ControlPropertiesConfig", + "$ref": "#/definitions/ControlPropertiesConfig", + "definitions": { + "ControlPropertiesConfig": { + "properties": { + "method": { + "type": "string", + "title": "Communication Method", + "enum": [ + "none", + "com", + "ipid", + "ipidtcp", + "ir", + "ssh", + "tcpip", + "telnet", + "cresnet", + "cec", + "udp" + ] + }, + "tcpSshProperties": { + "$ref":"TcpSshPropertiesConfigSchema.json#definitions/TcpSshPropertiesConfig", + "title": "Properties for IP based communication", + "default": null + }, + "comm": { + + }, + "controlPortDevKey": { + "type": "string", + "title": "Key of the device where the control port is found", + "examples": [ + "processor" + ] + }, + "controlPortNumber": { + "type": "integer", + "title": "Control Port Number on the device referenced by controlPortDevKey", + "examples": [ + 1 + ] + }, + "controlPortName": { + "type": "string", + "title": "Control Port Name on the device referenced by controlPortDevKey", + "examples": [ + "hdmi1" + ] + }, + "irFile": { + "type": "string", + "title": "IR Filename", + "default": "", + "examples": [ + "Comcast Motorola DVR.ir" + ], + "pattern": "^(.*).ir$" + }, + "ipid": { + "type": "string", + "title": "IPID of the device", + "default": "", + "examples": [ + "13", + "03", + "0A", + "F1" + ], + "pattern": "^(?!00|01|02|FF)[0-9,A-F,a-f][0-9,A-F,a-f]$" + }, + "endOfLineChar": { + "type": "string", + "title": "End of Line Character", + "default": "", + "examples": [ + "\\x0d" + ] + }, + "endOfLineString": { + "type": "string", + "title": "End of Line String", + "default": "", + "examples": [ + "\\n" + ] + }, + "deviceReadyResponsePattern": { + "type": "string", + "title": "Response Pattern that indicates the device is ready to communicate", + "default": "", + "examples": [ + ".*>" + ] + } + }, + "required": [ + "method" + ] + } + } +} \ No newline at end of file diff --git a/Pepperdash Core/Pepperdash Core/Comm/Schema/TcpSshPropertiesConfigSchema.json b/Pepperdash Core/Pepperdash Core/Comm/Schema/TcpSshPropertiesConfigSchema.json new file mode 100644 index 0000000..60d278f --- /dev/null +++ b/Pepperdash Core/Pepperdash Core/Comm/Schema/TcpSshPropertiesConfigSchema.json @@ -0,0 +1,78 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "title": "ControlPropertiesConfig", + "$ref": "#/definitions/TcpSshPropertiesConfig", + "definitions": { + "TcpSshPropertiesConfig": { + "properties": { + "username": { + "type": "string", + "title": "Username Credential", + "default":"", + "examples": [ + "admin" + ], + "pattern": "^(.*)$" + }, + "port": { + "type": "integer", + "title": "Port Number", + "minimum": 1, + "maximum": 65535, + "examples": [ + 22, + 23, + 1515 + ] + }, + "address": { + "type": "string", + "title": "IP address or hostname", + "examples": [ + "192.168.99.100", + "myDeviceHostname" + ], + "pattern": "^(.*)$" + }, + "password": { + "type": "string", + "title": "Password Credential", + "default":"", + "examples": [ + "password" + ], + "pattern": "^(.*)$" + }, + "autoReconnect": { + "type": "boolean", + "title": "Auto Reconnect", + "default": true, + "examples": [ + true + ] + }, + "autoReconnectIntervalMs": { + "type": "integer", + "title": "Auto Reconnect Interval in Ms", + "default": 5000, + "examples": [ + 2000 + ] + }, + "bufferSize": { + "type": "integer", + "title": "Receive Buffer Size", + "default": 32768, + "examples": [ + 32768 + ] + } + }, + "required": [ + "port", + "address" + ] + } + } +} \ No newline at end of file diff --git a/Pepperdash Core/Pepperdash Core/Comm/TcpSshPropertiesConfig.cs b/Pepperdash Core/Pepperdash Core/Comm/TcpSshPropertiesConfig.cs index 0940fe8..0a27002 100644 --- a/Pepperdash Core/Pepperdash Core/Comm/TcpSshPropertiesConfig.cs +++ b/Pepperdash Core/Pepperdash Core/Comm/TcpSshPropertiesConfig.cs @@ -9,9 +9,8 @@ using Newtonsoft.Json; namespace PepperDash.Core { /// - /// Configuration properties for TCP/SSH Connections - /// - + /// Configuration properties for IP Connections + /// public class TcpSshPropertiesConfig : PropertiesConfigBase { /// @@ -51,91 +50,11 @@ namespace PepperDash.Core /// public int AutoReconnectIntervalMs { get; set; } + /// + /// Construtor + /// public TcpSshPropertiesConfig() { - SchemaJson = @" -{ - 'definitions': {}, - '$schema': 'http://json-schema.org/draft-07/schema#', - '$id': 'http://example.com/root.json', - 'type': 'object', - 'title': 'The Root Schema', - 'properties': { - 'username': { - '$id': '#/properties/username', - 'type': 'string', - 'title': 'The Username Schema', - 'default': '', - 'examples': [ - 'admin' - ], - 'pattern': '^(.*)$' - }, - 'port': { - '$id': '#/properties/port', - 'type': 'integer', - 'title': 'The Port Schema', - 'default': 0, - 'examples': [ - 22 - ] - }, - 'address': { - '$id': '#/properties/address', - 'type': 'string', - 'title': 'The Address Schema', - 'default': '', - 'examples': [ - '10.11.50.135' - ], - 'pattern': '^(.*)$' - }, - 'password': { - '$id': '#/properties/password', - 'type': 'string', - 'title': 'The Password Schema', - 'default': '', - 'examples': [ - 'password' - ], - 'pattern': '^(.*)$' - }, - 'autoReconnect': { - '$id': '#/properties/autoReconnect', - 'type': 'boolean', - 'title': 'The Autoreconnect Schema', - 'default': false, - 'examples': [ - true - ] - }, - 'autoReconnectIntervalMs': { - '$id': '#/properties/autoReconnectIntervalMs', - 'type': 'integer', - 'title': 'The Autoreconnectintervalms Schema', - 'default': 0, - 'examples': [ - 2000 - ] - }, - 'bufferSize': { - '$id': '#/properties/bufferSize', - 'type': 'integer', - 'title': 'The Buffersize Schema', - 'default': 0, - 'examples': [ - 32768 - ] - } - }, - 'required': [ - 'port', - 'address' - ] -} -"; - - BufferSize = 32768; AutoReconnect = true; AutoReconnectIntervalMs = 5000; diff --git a/Pepperdash Core/Pepperdash Core/PepperDash_Core.csproj b/Pepperdash Core/Pepperdash Core/PepperDash_Core.csproj index 292619f..d4b36d2 100644 --- a/Pepperdash Core/Pepperdash Core/PepperDash_Core.csproj +++ b/Pepperdash Core/Pepperdash Core/PepperDash_Core.csproj @@ -123,6 +123,12 @@ + + Always + + + Always +