diff --git a/README.md b/README.md index eb62722..c25c0cf 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ npm i -g yo To start using this generator, it is advisable to have it installed globally (-g setting in NPM). ``` -npm i -g @criticalmanufacturing/generator-iot@80x +npm i -g @criticalmanufacturing/generator-iot@100x ``` > **Note** Starting from 7.2.0, each combination of Critical Manufacturing MES version (Major + Minor) will have a dedicated generator to make it easier to keep compatibility. > @@ -51,7 +51,7 @@ For both multiple and single choice, use the cursor (Up/Down) to move between th All questions are considered answered when the Enter key is pressed. -## tasksPackage + ## driver The driver is the implementation of a protocol. @@ -89,7 +89,7 @@ yo @criticalmanufacturing/iot:driver ``` Answer all questions and a new directory with the protocol driver will be available and ready for you to implement the communication logic. -## fontgen + diff --git a/generators/driver/templates/packConfig.json b/generators/driver/templates/packConfig.json index 9c88640..7f6f7ff 100644 --- a/generators/driver/templates/packConfig.json +++ b/generators/driver/templates/packConfig.json @@ -1,6 +1,8 @@ { "type": "Component", + "templates": "${Source}/templates/", + "postActions": [ { "type": "DeleteFile", "source": "${Temp}/completion.sh.hbs" }, { "type": "DeleteDirectory", "source": "${Temp}/src" }, diff --git a/generators/driver/templates/templates/exampleCommand.json b/generators/driver/templates/templates/exampleCommand.json new file mode 100644 index 0000000..3033802 --- /dev/null +++ b/generators/driver/templates/templates/exampleCommand.json @@ -0,0 +1,25 @@ +{ + "command": [ + { + "Name": "Valid Event Setting", + "Description": "Valid Event Setting", + "DeviceCommandId": "SETEV", + "ExtendedData": { + "executionMode": "SendRequest", + "destination": "TargetDevice" + }, + "CommandParameters": [ + { + "Name": "machineName", + "DataType": "String", + "AutomationProtocolDataType": "String" + }, + { + "Name": "eventList", + "DataType": "Object", + "AutomationProtocolDataType": "Object" + } + ] + } + ] +} \ No newline at end of file diff --git a/generators/driver/templates/templates/exampleEvent.json b/generators/driver/templates/templates/exampleEvent.json new file mode 100644 index 0000000..0319228 --- /dev/null +++ b/generators/driver/templates/templates/exampleEvent.json @@ -0,0 +1,53 @@ +{ + "property": [ + { + "Name": "newState", + "Description": "New State", + "DevicePropertyId": "NewState", + "DataType": "Integer", + "IsWritable": true, + "IsReadable": true, + "AutomationProtocolDataType": "Integer", + "ExtendedData": { + "propertyType": "NewState", + "identifierType": "None" + } + }, + { + "Name": "oldState", + "Description": "Old State", + "DevicePropertyId": "OldState", + "DataType": "Integer", + "IsWritable": true, + "IsReadable": true, + "AutomationProtocolDataType": "Integer", + "ExtendedData": { + "propertyType": "OldState", + "identifierType": "None" + } + } + ], + "event": [ + { + "Name": "StationStateChanged", + "Description": "Station State Changed", + "DeviceEventId": "CFX.ResourcePerformance.StationStateChanged", + "IsEnabled": true, + "ExtendedData": { + "eventTrigger": "CFX.ResourcePerformance.StationStateChanged" + }, + "EventProperties": [ + { + "Property": "newState", + "Order": 1, + "ExtendedData": {} + }, + { + "Property": "oldState", + "Order": 2, + "ExtendedData": {} + } + ] + } + ] +} \ No newline at end of file