Skip to content

Commit

Permalink
Adding example templates
Browse files Browse the repository at this point in the history
  • Loading branch information
jsantos98 committed May 12, 2023
1 parent 2cd5edd commit 3a7f228
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
>
Expand All @@ -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
<!-- ## tasksPackage
Use this app to create a new custom package structure help you getting started. Of course, you still need to implement the tasks and converters (there are also apps to help you)
In a terminal window with the path where the entire package directory will be created, run:
Expand All @@ -76,7 +76,7 @@ To create a new converter, make sure you have a terminal window open on the path
yo @criticalmanufacturing/iot:converter
```
Answer all questions and the converter will be created on the `src/converters` directory of the package.
The code generated is the skeleton on the converter (base structure), so you have to implement the logic before it is usable.
The code generated is the skeleton on the converter (base structure), so you have to implement the logic before it is usable. -->

## driver
The driver is the implementation of a protocol.
Expand All @@ -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
<!-- ## fontgen
Tasks Packages can have their own set of icons to assign to each of the custom tasks. This generator is necessary to convert a set of `svg` files into a web font compatible with `Critical Manufacturing MES`.
Expand Down Expand Up @@ -131,7 +131,7 @@ To run the app, execute the following command under the `svg` directory:
```
yo @criticalmanufacturing/iot:fontgen
```
``` -->



Expand Down
2 changes: 2 additions & 0 deletions generators/driver/templates/packConfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"type": "Component",

"templates": "${Source}/templates/",

"postActions": [
{ "type": "DeleteFile", "source": "${Temp}/completion.sh.hbs" },
{ "type": "DeleteDirectory", "source": "${Temp}/src" },
Expand Down
25 changes: 25 additions & 0 deletions generators/driver/templates/templates/exampleCommand.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
]
}
53 changes: 53 additions & 0 deletions generators/driver/templates/templates/exampleEvent.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
]
}
]
}

0 comments on commit 3a7f228

Please sign in to comment.