Updating - shredder/asterix-pp

This commit is contained in:
lovebird 2024-01-20 20:28:40 +01:00
parent 54d50958d4
commit 58fd8f5061
254 changed files with 8671 additions and 321946 deletions

View File

@ -1,117 +0,0 @@
## Features
- Jam detection / Auto-Reverse
- Rigid, flexible and modular framework enabling hacking and extensions
- Electronics and wiring according to standards
- Auto-Stop after being idle
- Visual feedback
#### Brief
- **Status**: Testing : Testing RevA
- [**Last Change**](https://git.osr-plastic.org/osr-plastic/osr-machines/commit/f3c2fa23d8106f532c0638b27c0ae6b80d1fb475) : Sunday, July 30, 2023 8:28 PM by [ lovebird ](https://git.osr-plastic.org/osr-plastic/osr-machines/lovebird) - ```dh shredder v2.1 | lucy-clamp-30mm | discourse meta```
[wrap="center"]
<img src="upload://yfUkcg7Z3WsHzrEgh17Rrdk1jDT.jpeg">
[/wrap]
## Specification
<table>
<thead>
<tr>
<th>Weight</th>
<th>70 Kg</th>
</tr>
</thead>
<tbody>
<tr>
<td>Knife Material</td>
<td>Stainless</td>
</tr>
<tr>
<td>Shaft</td>
<td>35mm</td>
</tr>
<tr>
<td>Voltage</td>
<td>220V or 380V</td>
</tr>
<tr>
<td>Motor Power</td>
<td>2.2kW</td>
</tr>
<tr>
<td>Type</td>
<td>Single Shaft</td>
</tr>
<tr>
<td>License</td>
<td><a href="https://ohwr.org/cernohl">CERN Open Source Hardware License</a></td>
</tr>
<tr>
<td>Compliance</td>
<td>CE</td>
</tr>
<tr>
<td>Control</td>
<td>PLC Auto-Reverse</td>
</tr>
<tr>
<td>Sieve</td>
<td>5mm</td>
</tr>
<tr>
<td>Hexbar</td>
<td>32mm</td>
</tr>
<tr>
<td>Chamber</td>
<td>Steel Powder coated</td>
</tr>
<tr>
<td>Housing</td>
<td>Powder coated</td>
</tr>
</tbody>
</table>
[Source : http://files.osr-plastic.org/files/osr-machines/shredder/asterix-pp/specs.xlsx](http://files.osr-plastic.org/files/osr-machines/shredder/asterix-pp/specs.xlsx)
## Authors
- [ PlasticHub S.L. ]( https://osr-plastic.org )
- [ Jason Knight ]( https://www.mandin.earth/ )
#### Resources
- [Firmware](http://files.osr-plastic.org/files/firmware/zoe_min-sm/)
- [Files](http://files.osr-plastic.org/files/osr-machines/shredder/asterix-pp)
- [Git Source](https://git.osr-plastic.org/osr-plastic/osr-machines/src/branch/master/shredder/asterix-pp)
- [3D Preview](https://assets.osr-plastic.org/machines//shredder/asterix-pp/resources/edrawings.html)
- [Gallery](http://files.osr-plastic.org/files/osr-machines/shredder/asterix-pp/media/gallery)

View File

@ -1,202 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "Shredder",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "COM22",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": true,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "aa504ee4-6cd3-8a5e-4654-56294ef78fd6",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 3,
"uid": -1,
"value": "serial",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "xxx1",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "21201d2f-6d4f-99f9-5d10-873c9d629150",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 28,
"uid": -1,
"value": "{\n \"baudRate\": \"57600\",\n \"databits\": 8,\n \"stopbits\": 1,\n \"parity\": \"none\",\n \"rtscts\": false,\n \"xon\": false,\n \"xoff\": false,\n \"flowcontrol\": false,\n \"buffersize\": 65536\n}",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver Options",
"type": 5,
"uid": -1,
"value": 16,
"visible": true
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{\n \"Response\": 51,\n \"Send Command\": 51,\n \"Device Disonnected\": 55,\n \"Device Connected\": 55\n}",
"visible": true
}
]
}

View File

@ -1,204 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "CNC",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "COM19",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": false,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "e208711c-a51c-8d8a-41f2-883cd95ac7c4",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 3,
"uid": -1,
"value": "serial",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "85d635a0-5b24-dae7-2b86-71556acbd587",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 28,
"uid": -1,
"value": "",
"visible": true,
"enumType": "-1"
},
false,
false,
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver Options",
"type": 5,
"uid": -1,
"value": 16,
"visible": true
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": "Logging",
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{\n \"Response\": 35,\n \"Send Command\": 35,\n \"Device Connected\": 37,\n \"Device Error\": 39\n}",
"visible": true
}
]
}

View File

@ -1,139 +0,0 @@
{
"inputs": [
{
"name": "Title",
"value": "Lydia-v3",
"type": 13,
"enumType": "-1",
"visible": true,
"active": false,
"changed": true,
"group": "Common",
"user": null,
"dst": null,
"id": "Title",
"params": null
},
{
"name": "Host",
"value": "Search",
"type": 13,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Host",
"params": null
},
{
"name": "Enabled",
"value": false,
"type": 0,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Common",
"user": null,
"dst": null,
"id": "Enabled",
"params": null
},
{
"name": "Driver",
"value": "b22efaaa-0122-63df-c073-63b9784e7b1d",
"type": 3,
"enumType": "Driver",
"visible": true,
"active": false,
"changed": false,
"group": "Common",
"user": null,
"dst": null,
"id": "Driver",
"params": null
},
{
"name": "Protocol",
"value": "serial",
"type": 3,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Protocol",
"params": null
},
{
"name": "Port",
"value": "23",
"type": 13,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Port",
"params": null
},
{
"name": "Id",
"value": "0c7d0820-afeb-170c-0006-7e225a67f8be",
"type": 13,
"enumType": "-1",
"visible": false,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Id",
"params": null
},
{
"name": "Options",
"value": "{\n \"baudRate\": \"19200\",\n \"databits\": 8,\n \"stopbits\": 1,\n \"parity\": \"none\",\n \"rtscts\": false,\n \"xon\": false,\n \"xoff\": false,\n \"flowcontrol\": true,\n \"buffersize\": 65536\n}",
"type": 21,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Options",
"params": null
},
{
"name": "DriverOptions",
"value": 0,
"type": 5,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Driver",
"user": null,
"dst": null,
"id": "DriverOptions",
"params": null
},
{
"id": "Logging Flags",
"name": "Logging Flags",
"parentId": -1,
"title": "Logging Flags",
"type": "Logging Flags",
"value": "{\n \"Device Connected\": 47,\n \"Response\": 35,\n \"Send Command\": 51,\n \"Device Disonnected\": 39,\n \"Device Error\": 1\n}",
"visible": true
}
]
}

View File

@ -1,204 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "Security-Cam",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "mqtt:\/\/localhost",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": false,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "cd3956ce-2fcb-d674-d59e-b903db3a4296",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 3,
"uid": -1,
"value": "mqtt",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "1883",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "96bc14d5-8d0e-8bb9-f7cf-648fa3ad7e42",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 28,
"uid": -1,
"value": "{}",
"visible": true,
"enumType": "-1"
},
false,
false,
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver Options",
"type": 5,
"uid": -1,
"value": 65812,
"visible": true
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": "Logging",
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{\n \"Response\": 55,\n \"Device Connected\": 55,\n \"Device Disonnected\": 55\n}",
"visible": true
}
]
}

View File

@ -1,204 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "iPhone",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "192.168.1.33",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": false,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "117554bc-f6ef-3442-f163-901d5d35d158",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 3,
"uid": -1,
"value": "ssh",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "22",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "1b53dd5c-bda3-a45b-27ea-b1adb876d729",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 28,
"uid": -1,
"value": "{\n \"username\": \"root\",\n \"password\": \"alpine\"\n}",
"visible": true,
"enumType": "-1"
},
false,
false,
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver Options",
"type": 5,
"uid": -1,
"value": 0,
"visible": true
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": "Logging",
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{\n \"Response\": 51,\n \"Send Command\": 55\n}",
"visible": true
}
]
}

View File

@ -1,204 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "KODI-JSON-RPC",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "http:\/\/192.168.1.34:8080\/jsonrpc?tm=1481624757945",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": false,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "55ad4a31-2f0c-bfde-2338-b31bac6e56e5",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 3,
"uid": -1,
"value": "driver",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "c486a884-1e85-0d19-42a6-3089191d889d",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 21,
"uid": -1,
"value": "{\n \"interface\": \"http\"\n}",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "DriverOptions",
"enabled": true,
"flags": -1,
"group": "Driver",
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "DriverOptions",
"type": 5,
"uid": -1,
"value": 0,
"visible": true,
"enumType": "-1"
},
false,
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": "Logging",
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{\n \"Response\": 33,\n \"Send Command\": 33\n}",
"visible": true
}
]
}

View File

@ -1,203 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "Marantz-Serial",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "\/dev\/ttyUSB0",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": false,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "ffa5d764-cb4c-e6b7-2d5e-7d0a97994dc0",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 3,
"uid": -1,
"value": "serial",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "59fed2f8-5289-9ae3-0243-7e347efc6965",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 28,
"uid": -1,
"value": "{}",
"visible": true,
"enumType": "-1"
},
false,
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver Options",
"type": 5,
"uid": -1,
"value": 0,
"visible": true
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{\n \"Response\": 33,\n \"Send Command\": 0,\n \"Device Disonnected\": 0,\n \"Device Error\": 0,\n \"Device Connected\": 0\n}",
"visible": true
}
]
}

View File

@ -1,202 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "Marantz",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "192.168.1.20",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": false,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "235eb680-cb87-11e3-9c1a-0800200c9a66",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 13,
"uid": -1,
"value": "tcp",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "23",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "e5a06e24-6aa4-c8c5-3ffc-9d84d8528a91",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "",
"type": 5,
"uid": -1,
"value": 0,
"visible": true
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 28,
"uid": -1,
"value": "{\n \"allowHalfOpen\": true,\n \"readable\": true,\n \"writable\": true\n}",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{\n \"Device Connected\": 47,\n \"Response\": 35,\n \"Send Command\": 51,\n \"Device Disonnected\": 39,\n \"Device Error\": 1\n}",
"visible": true
}
]
}

View File

@ -1,202 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "PI-GPIO",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "0.0.0.0",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": false,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "91e6a9e2-d2cd-4258-c647-3e708ce4a749",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 3,
"uid": -1,
"value": "driver",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "xxx2",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "8b2e512a-51d0-dc9d-60ee-f30281e0d691",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 28,
"uid": -1,
"value": "{}",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver Options",
"type": 5,
"uid": -1,
"value": 16,
"visible": true
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": "Logging",
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{\n \"Device Disonnected\": 39,\n \"Response\": 35,\n \"Send Command\": 35\n}",
"visible": true
}
]
}

View File

@ -1,202 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "Raspberry-One",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "192.168.1.36",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": false,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "40276f07-b0a8-f6bb-56f3-124b76262d5c",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 3,
"uid": -1,
"value": "ssh",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "22",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "7da7b6a8-8ec1-4f2e-c10a-c414edb34adb",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 28,
"uid": -1,
"value": "{\"username\":\"pi\",\"password\":\"asdasd\",\"html\":true}",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver Options",
"type": 5,
"uid": -1,
"value": 0,
"visible": true
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{}",
"visible": true
}
]
}

View File

@ -1,203 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "Raspberry-Build",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "192.168.1.33",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": false,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "f445e66f-467c-e7df-926d-f5694302ee5b",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 3,
"uid": -1,
"value": "ssh",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "22",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "6f007f98-4770-f53a-3761-c052ca7db89a",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 28,
"uid": -1,
"value": "{\n \"username\": \"root\",\n \"password\": \"asdasd\"\n}",
"visible": true,
"enumType": "-1"
},
false,
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver Options",
"type": 5,
"uid": -1,
"value": 0,
"visible": true
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{}",
"visible": true
}
]
}

View File

@ -1,202 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "SSH-Local",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "192.168.1.37",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": false,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "b08405ac-a878-351f-7bab-f4174de7e669",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 3,
"uid": -1,
"value": "ssh",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "22",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "83a2e4ab-27b0-6c89-23c9-743ad6c40031",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 28,
"uid": -1,
"value": "{\n \"username\": \"mc007\",\n \"password\": \"214,,asd\",\n \"localhostName\": \"\",\n \"tryKeyboard\": false,\n \"keepaliveInterval\": 0,\n \"keepaliveCountMax\": 3,\n \"readyTimeout\": 11102,\n \"strictVendor\": true\n}",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "",
"type": 5,
"uid": -1,
"value": 0,
"visible": true
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{\n \"Response\": 51,\n \"Send Command\": 49\n}",
"visible": true
}
]
}

View File

@ -1,203 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "SSH-Pearls-Media",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "pearls-media.com",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": false,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "ae5e86ab-3183-7dc9-4300-74e6cad50ac6",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 3,
"uid": -1,
"value": "ssh",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "22",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "0592a125-227c-f0eb-ee46-4d3e1661729c",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 28,
"uid": -1,
"value": "{\n \"username\": \"vu2003\",\n \"privateKeyPath\": \"\/home\/mc007\/.ssh\/id_rsa\"\n}",
"visible": true,
"enumType": "-1"
},
false,
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver Options",
"type": 5,
"uid": -1,
"value": 16,
"visible": true
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{}",
"visible": true
}
]
}

View File

@ -1,202 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "SSH-Windows",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "192.168.1.99",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": false,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "c8451d91-9167-ac64-92f8-25fda925d659",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 3,
"uid": -1,
"value": "ssh",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "22",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "41cf1120-2ddb-9ad0-71fd-534df87203e6",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 28,
"uid": -1,
"value": "{\"username\":\"Admin\",\"password\":\"admin\",\"debug\":false,\"html\":false,\"waitForEOF\":true,\"ansiUp\":false}",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "",
"type": 5,
"uid": -1,
"value": 0,
"visible": true
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{}",
"visible": true
}
]
}

View File

@ -1,139 +0,0 @@
{
"inputs": [
{
"name": "Title",
"value": "Asterix",
"type": 13,
"enumType": "-1",
"visible": true,
"active": false,
"changed": true,
"group": "Common",
"user": null,
"dst": null,
"id": "Title",
"params": null
},
{
"name": "Host",
"value": "COM21",
"type": 13,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Host",
"params": null
},
{
"name": "Enabled",
"value": true,
"type": 0,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Common",
"user": null,
"dst": null,
"id": "Enabled",
"params": null
},
{
"name": "Driver",
"value": "5bd99163-aeac-c16e-baab-4fce4fc5803c",
"type": 3,
"enumType": "Driver",
"visible": true,
"active": false,
"changed": false,
"group": "Common",
"user": null,
"dst": null,
"id": "Driver",
"params": null
},
{
"name": "Protocol",
"value": "serial",
"type": 3,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Protocol",
"params": null
},
{
"name": "Port",
"value": "23",
"type": 13,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Port",
"params": null
},
{
"name": "Id",
"value": "349e4b1c-451a-61e8-4178-a976f9c8392e",
"type": 13,
"enumType": "-1",
"visible": false,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Id",
"params": null
},
{
"name": "Options",
"value": "{\n \"baudRate\": \"19200\",\n \"databits\": 8,\n \"stopbits\": 1,\n \"parity\": \"none\",\n \"rtscts\": false,\n \"xon\": false,\n \"xoff\": false,\n \"flowcontrol\": true,\n \"buffersize\": 65536\n}",
"type": 21,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Options",
"params": null
},
{
"name": "DriverOptions",
"value": 16,
"type": 5,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Driver",
"user": null,
"dst": null,
"id": "DriverOptions",
"params": null
},
{
"id": "Logging Flags",
"name": "Logging Flags",
"parentId": -1,
"title": "Logging Flags",
"type": "Logging Flags",
"value": "{\n \"Device Connected\": 47,\n \"Response\": 35,\n \"Send Command\": 51,\n \"Device Disonnected\": 39,\n \"Device Error\": 1\n}",
"visible": true
}
]
}

View File

@ -1,139 +0,0 @@
{
"inputs": [
{
"name": "Title",
"value": "Plunger",
"type": 13,
"enumType": "-1",
"visible": true,
"active": false,
"changed": true,
"group": "Common",
"user": null,
"dst": null,
"id": "Title",
"params": null
},
{
"name": "Host",
"value": "COM19",
"type": 13,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Host",
"params": null
},
{
"name": "Enabled",
"value": false,
"type": 0,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Common",
"user": null,
"dst": null,
"id": "Enabled",
"params": null
},
{
"name": "Driver",
"value": "6657b4bc-c41a-144b-ef4f-f9a8045eb457",
"type": 3,
"enumType": "Driver",
"visible": true,
"active": false,
"changed": false,
"group": "Common",
"user": null,
"dst": null,
"id": "Driver",
"params": null
},
{
"name": "Protocol",
"value": "serial",
"type": 3,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Protocol",
"params": null
},
{
"name": "Port",
"value": "23",
"type": 13,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Port",
"params": null
},
{
"name": "Id",
"value": "3eebdb07-1a76-2adb-6b43-d244faf2e00e",
"type": 13,
"enumType": "-1",
"visible": false,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Id",
"params": null
},
{
"name": "Options",
"value": "{\n \"baudRate\": \"250000\",\n \"databits\": 8,\n \"stopbits\": 1,\n \"parity\": \"none\",\n \"rtscts\": false,\n \"xon\": false,\n \"xoff\": false,\n \"flowcontrol\": true,\n \"buffersize\": 65536\n}",
"type": 21,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Network",
"user": null,
"dst": null,
"id": "Options",
"params": null
},
{
"name": "DriverOptions",
"value": 16,
"type": 5,
"enumType": "-1",
"visible": true,
"active": false,
"changed": false,
"group": "Driver",
"user": null,
"dst": null,
"id": "DriverOptions",
"params": null
},
{
"id": "Logging Flags",
"name": "Logging Flags",
"parentId": -1,
"title": "Logging Flags",
"type": "Logging Flags",
"value": "{\n \"Device Connected\": 47,\n \"Response\": 35,\n \"Send Command\": 51,\n \"Device Disonnected\": 39,\n \"Device Error\": 1\n}",
"visible": true
}
]
}

View File

@ -1,204 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "Loopback-Client",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "127.0.0.1",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": false,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "1961a5bd-29da-807c-affa-b59cba74b6cb",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 3,
"uid": -1,
"value": "tcp",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "9999",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "e5644c28-542c-2475-8870-03ca02960e41",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 28,
"uid": -1,
"value": "{}",
"visible": true,
"enumType": "-1"
},
false,
false,
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver Options",
"type": 5,
"uid": -1,
"value": 0,
"visible": true
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": "Logging",
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{\n \"Device Disonnected\": 39,\n \"Response\": 0,\n \"Send Command\": 0\n}",
"visible": true
}
]
}

View File

@ -1,204 +0,0 @@
{
"inputs": [
{
"dataRef": null,
"description": "Title",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Title",
"name": "Title",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Title",
"type": 13,
"uid": -1,
"value": "Loopback",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Host",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Host",
"name": "Host",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Host",
"type": 13,
"uid": -1,
"value": "127.0.0.1",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Enabled",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Enabled",
"name": "Enabled",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Enabled",
"type": 0,
"uid": -1,
"value": false,
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Driver",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Driver",
"name": "Driver",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver",
"type": 3,
"uid": -1,
"value": "0f4a9e08-1def-f9ba-e996-b56c86e74524",
"visible": true,
"enumType": "Driver"
},
{
"dataRef": null,
"description": "Protocol",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Protocol",
"name": "Protocol",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Protocol",
"type": 3,
"uid": -1,
"value": "tcp",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Port",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Port",
"name": "Port",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Port",
"type": 13,
"uid": -1,
"value": "9999",
"visible": true,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Id",
"enabled": true,
"flags": -1,
"group": "Common",
"id": "Id",
"name": "Id",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Id",
"type": 13,
"uid": -1,
"value": "3b687086-1613-9704-5e86-15c93ff54bf2",
"visible": false,
"enumType": "-1"
},
{
"dataRef": null,
"description": "Options",
"enabled": true,
"flags": -1,
"group": "Network",
"id": "Options",
"name": "Options",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Options",
"type": 28,
"uid": -1,
"value": "{}",
"visible": true,
"enumType": "-1"
},
false,
false,
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": -1,
"id": "DriverOptions",
"name": "DriverOptions",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Driver Options",
"type": 5,
"uid": -1,
"value": 65552,
"visible": true
},
{
"dataRef": null,
"description": "",
"enabled": true,
"flags": -1,
"group": "Logging",
"id": "Logging Flags",
"name": "Logging Flags",
"order": -1,
"params": null,
"parentId": -1,
"platform": null,
"storeDestination": null,
"title": "Logging Flags",
"type": "Logging Flags",
"uid": -1,
"value": "{\n \"Response\": 51,\n \"Send Command\": 51,\n \"Device Disonnected\": 55,\n \"Device Connected\": 55\n}",
"visible": true
}
]
}

View File

@ -1,636 +0,0 @@
define([
"dcl/dcl",
"xide/utils",
"xide/types",
"xide/console",
"xcf/model/Command",
"xdojo/has!host-node?nxapp/protocols/ProtocolBase",
"xdojo/has!host-node?dojo/node!yargs-parser"
], function (dcl,utils,types, console,Command,ProtocolBase,yargs) {
var five = null;
var debug = true;
// The returning module
var Module = null;
//the johnny-five module, set when connected.
var JohnnyFive = null;
// client side, return nothing
if (!ProtocolBase) {
//create dummy module
Module = dcl(null, {});
patchModule();
return Module;
}
Module = dcl(ProtocolBase, {
isNodeJS: true,
board: null,
context:null,
inputs: {
A0: {pin: {}, value: 0},
A1: {pin: {}, value: 0},
A2: {pin: {}, value: 0},
A3: {pin: {}, value: 0},
A4: {pin: {}, value: 0},
A5: {pin: {}, value: 0}
},
outputs: {
D1: {pin: {}, value: 0},
D2: {pin: {}, value: 0},
D3: {pin: {}, value: 0},
D4: {pin: {}, value: 0},
D5: {pin: {}, value: 0},
D6: {pin: {}, value: 0},
D7: {pin: {}, value: 0},
D8: {pin: {}, value: 0},
D9: {pin: {}, value: 0},
D10: {pin: {}, value: 0},
D11: {pin: {}, value: 0},
D12: {pin: {}, value: 0},
D13: {pin: {}, value: 0}
},
get: function(field) {
if(this.inputs[field]){
return this.inputs[field].value;
}else{
console.error('pin doesnt exists : ' + field,this.inputs);
}
},
set: function(field, value) {
value = parseInt(value,10);
if(this.inputs[field] != undefined) {
if(parseInt(this.inputs[field].value, 10) !== parseInt( value, 10 )) {
this.inputs[field].value = value;
//this.emit('change', {field: field, value: this.inputs[field].value});
}
}
else if(this.outputs[field] !== undefined) {
if(parseInt(this.outputs[field].value,10) !== parseInt(value,10)) {
this.outputs[field].value = value;
if(this.connected) {
this.setHardwarePin(field, value);
}
}
}
return this;
},
setHardwarePin: function(field, value) {
var outputField = this.outputs[field];
if(outputField && outputField.pin) {
var pinMode = outputField.pin.mode;
}
if(outputField !== undefined && (field === 'D3'
|| field === 'D5'
|| field === 'D6'
|| field === 'D9'
|| field === 'D10'
|| field === 'D11') ) {
var pinMode = outputField.pin.mode;
// Check which pinmode is set on the pin to determine which method to call
if (pinMode === this.PINMODES.PWM || pinMode === this.PINMODES.OUTPUT) {
this.outputs[field].pin.brightness(value);
} else if(pinMode === this.PINMODES.SERVO) {
this.outputs[field].pin.to(value);
}
// For reference:
//MODES:
//{ INPUT: 0,
//OUTPUT: 1,
//ANALOG: 2,
//PWM: 3,
//SERVO: 4,
//SHIFT: 5,
//I2C: 6,
//ONEWIRE: 7,
//STEPPER: 8,
//IGNORE: 127,
//UNKOWN: 16 },
}
else if(pinMode == this.PINMODES.OUTPUT) {
var pinMode = outputField.pin.mode;
if(value >= 255) {
this.outputs[field].pin.on();
}
else {
this.outputs[field].pin.off();
}
}
},
addDefaultPins:function(){
var self = this;
// Store all pin mode mappings (string -> integer)
this.PINMODES = this.board.io.MODES;
var pollFreq = 100;
// Instantiate each sensor listed on the model to the sensors array
for(var input in this.inputs) {
(function() {
if(!parseInt(input, 10)) {
var sensor = JohnnyFive.Sensor({
pin: input,
freq: pollFreq
});
this.inputs[input].pin = sensor;
sensor.scale([0, 1023]).on("data", function() {
self.set('A'+this.pin, Math.floor(this.value));
//console.log('sensor data '+'A'+this.pin,Math.floor(this.value));
});
}
else {
this.board.pinMode(input, JohnnyFive.Pin.INPUT);
}
}.bind(this))();
}
// Cycle through and add all the outputs here
for(var output in this.outputs) {
(function() {
// hack for right now to hard code pin <3 as pwm, pin 9 as servo
var pin = parseInt(output.substr(1),10);
var outputPin;
if (pin === 3 || pin === 5 || pin === 6 || pin === 10 || pin === 11 || pin === 9) {
outputPin = new JohnnyFive.Led(pin);
}
//else if(pin === 9) {
//outputPin = new five.Servo({
//pin: pin,
//range: [0,180],
//});
//}
this.outputs[output].pin = outputPin;
}.bind(this))();
}
},
constructor:function(options){
utils.mixin(this,options);
},
_sendError: function (data, command, options) {
if(!options){
console.error('have no options',options);
options = {};
}
if(!options.params){
console.error('have no params',options);
options.params = {wait:true};
}
var wait = options.params.wait;
var self = this;
var outString = JSON.stringify(utils.mixin({
command: command
}, data, null, 2));
if (wait) {
self.owner.onError(command, options, new Buffer(outString));
} else {
self.owner.onData(outString, new Buffer(outString));
}
},
setMode:function(nr,mode,options){
var board = this.board;
//nr = parseInt(nr,10);
mode = parseInt(mode,10);
//this.context.pinMode(nr,mode);
this.setHardwarePin(nr,mode);
},
digitalWrite:function(nr,value,options){
this.board.digitalWrite(parseInt(nr,10), parseInt(value,10));
},
digitalRead:function(nr,options){
this.board.digitalRead(parseInt(nr,10),function(value){
console.log('digitalRead: ',value);
this._send({
value:value,
gpio:nr
},'digitalRead',options);
}.bind(this));
},
_send: function (data, command, options) {
var wait = options.params.wait;
var self = this;
var outString = JSON.stringify(utils.mixin({
command: command
}, data, null, 2));
if (wait) {
self.owner.onFinish(command, options, new Buffer(outString));
} else {
self.owner.onData(outString, new Buffer(outString));
}
},
analogRead:function(nr,options){
var self = this;
/*
var handler = function(value){
console.log('analogRead: ',value);
self._send({
value:value,
gpio:nr
},'analogRead',options);
}.bind(this);
//this.board.analogRead.apply(this.board,[parseInt(nr,10),handler]);
this.context.analogRead(parseInt(nr,10),handler);*/
self._send({
value:this.get(nr,10),
gpio:parseInt(nr,10)
},'analogRead',options);
},
/**
*
* @param what {string} A string encoded byte array in the 01,02,... format
* @returns {null}
*/
write:function(what,options){
var _parsed = null;
//convert buffer from byte array string to string
var intArray = utils.bufferFromDecString(what);
var buffer = new Buffer(intArray);
what = buffer.toString();
var args = what.split(" ");
var cmd = "" + args[0];
args.shift();
this.isDebug() && console.log('write : ' + what, args);
if (typeof this[cmd] === 'function') {
args.push(options);
try {
return this[cmd].apply(this, args);
}catch(e){
console.error('Error running '+cmd + " : " + e.message);
this._sendError({
error:e.message
},cmd,options);
}
}else{
console.error('cant find command '+cmd);
}
return;
try {
_parsed = (new Function("{\n" + what + "\n}")).apply(this.context,[console,this]);
}catch(e) {
console.error('Arduino: Error running code : ' + e.message, e);
console.trace();
this.owner.onError(what, e);
utils.stack();
}
debug && console.log('Arduino,result '+_parsed);
return null;
},
onButton:function(){
console.log('on button');
//send to IDE or clients
this.owner.onData("on button");
},
onConnected:function(){
this.owner.onConnected();
},
onInfo:function(evt){
var owner=this.owner;
var connectionManager = owner.delegate;
connectionManager.onData(owner,evt);
},
connect: function () {
var five = null;
var self = this;
try {
five = require(["dojo/node!johnny-five"],function(_five){
JohnnyFive = _five;
five = _five;
var myBoard;
try {
//if(global['_j5_context']) {
if(global['_j5_context'] && global['_j5_context'][self.options.host]){
console.error('re-use!');
self.context = global['_j5_context'][self.options.host].context;
self.board = global['_j5_context'][self.options.host].board;
self.inputs = global['_j5_context'][self.options.host].inputs;
self.outputs = global['_j5_context'][self.options.host].outputs;
self.connected = true;
self.onConnected();
return;
}
myBoard = new five.Board({
repl: false,
debug: false,
port: self.options.host
});
myBoard.on("error", function (e) {
console.error('johnny-five ', e);
self._sendError(e['class'] + ':' + e.message, 'connect', self.options);
})
myBoard.on("ready", function () {
self.context = this;
self.context.j5 = _five;
self.context.log = console.log;
self.board = myBoard;
self.addDefaultPins();
self.connected = true;
self.onConnected();
if(!global['_j5_context']){
global['_j5_context'] = {}
}
global['_j5_context'][self.options.host] = {
context:self.context,
board:myBoard,
inputs : self.inputs,
outputs : self.outputs
};
});
myBoard.on("info", function (event) {
self.onInfo(event);
//console.log("%s sent an 'info' message: %s", event.class, event.message);
});
}catch(e){
console.error('----'+ e.message,e.stack);
utils.stack();
}
});
}catch(e){
console.error('error requiring '+ e.message,e);
}
},
/***
* Standard callback when we have a message from the device we're bound to (specified in profile).
* 1. put the message in the incoming queue, tag it as 'unread'
* 2. in case we have messages to send and we are in 'onReply' mode, trigger outgoing queue
*
* @param data {Object} : Message struct build by the device manager
* @param data.device {Object} : Device info
* @param data.device.host {String} : The host
* @param data.device.port {String} : The host's port
* @param data.device.protocol {String} : The host's protocol
* @param data.message {String} : RAW message, untreated
*/
onMessage: function (data) {},
end:function(){
console.error('disconnect');
if(this.context){
this.context.disconnect();
this.board = null;
}
},
destroy: function () {
console.error('disconnect');
if(this.context){
this.board = null;
}
}
});
Module.is = function(){
return types.PROTOCOL.SERIAL;
};
function patchModule(){
var PIN_MODES = {
INPUT: 0x00,
OUTPUT: 0x01,
ANALOG: 0x02,
PWM: 0x03,
SERVO: 0x04
};
Module.getFields = function (command, fields) {
var result = [];
//add a GPIO field
if(command._isGPIO) {
command._gpio = command._gpio || 17;
result.push(utils.createCI('test', types.ECIType.STRING, command._gpio, {
group: 'GPIO',
title: 'GPIO',
dst: '_gpio',
order: 197
}));
}
//add gpio mode field
if(command._gpioFunc === 'setMode') {
command._mode = command._mode || "OUTPUT";
result.push(utils.createCI('test', types.ECIType.ENUMERATION, command._mode, {
group: 'GPIO',
title: 'Mode',
dst: '_mode',
order: 198,
widget:{
options:[
{value:PIN_MODES.INPUT,label:"INPUT"},
{value:PIN_MODES.OUTPUT,label:"OUTPUT"},
{value:PIN_MODES.ANALOG,label:"ANALOG"},
{value:PIN_MODES.PWM,label:"PWM"},
{value:PIN_MODES.SERVO,label:"SERVO"}
]
}
}));
}
if(command._gpioFunc === 'digitalWrite') {
command._value = command._value || 1;
result.push(utils.createCI('test', types.ECIType.ENUMERATION, command._value, {
group: 'GPIO',
title: 'Value',
dst: '_value',
order: 199,
widget:{
options:[
{value:0,label:"0"},
{value:1,label:"1"}
]
}
}));
}
if(command._gpioFunc === 'analogWrite') {
command._value = command._value || 1;
result.push(utils.createCI('test', types.ECIType.ENUMERATION, command._value, {
group: 'GPIO',
title: 'Value',
dst: '_value',
order: 199,
widget:{
options:[
{value:0,label:"0"},
{value:1,label:"1"}
]
}
}));
}
return result;
};
/**
*
* @param label
* @param icon
* @param ctrAgs
* @param variables
* @param send
* @param func
* @param description
* @param scope
* @param owner
* @param target
* @param group
*/
function createBlock(label,icon,ctrAgs,variables,send,func,description,scope, owner, target, group){
return {
name: label,
owner: owner,
icon: icon,
proto: Command,
target: target,
ctrArgs: utils.mixin({
icon:icon,
flags:0,
name:label,
scope: scope,
group: group,
variables:variables ? JSON.stringify(variables) : "{}",
send:send,
_isGPIO:true,
_gpioFunc:func,
description:description
},ctrAgs)
};
}
/**
* Extend xblox for new blocks/commands.
* @param scope
* @param owner
* @param target
* @param group
* @param items
* @returns {*}
*/
Module.getNewBlocks=function(scope, owner, target, group, items){
if(!items){
return null;
}
items.push({
name: 'Johnny-Five',
iconClass: 'fa-code',
items: [
createBlock('Set GPIO Mode','fa-cogs',null,
{ 'GPIO': '_gpio','GPIO_MODE': '_mode'},
"setMode {{GPIO}} {{GPIO_MODE}}","setMode",
"Set the mode of a specific pin, one of INPUT, OUTPUT, ANALOG, PWM, SERVO. Mode constants are exposed via the Pin class",
scope,owner,target,group),
createBlock('Digital Write','fa-send',null,
{ 'GPIO': '_gpio','GPIO_VALUE': '_value'},
"digitalWrite {{GPIO}} {{GPIO_VALUE}}","digitalWrite",
"Write a digital value (0 or 1) to a digital pin.",
scope,owner,target,group),
createBlock('Digital Read','fa-send',null,
{ 'GPIO': '_gpio'},
"digitalRead {{GPIO}}","digitalRead",
"Returns the GPIO level",
scope,owner,target,group),
createBlock('Analog Read','fa-send',null,
{ 'GPIO': '_gpio'},
"analogRead {{GPIO}}","analogRead",
"Register a handler to be called whenever the board reports the voltage value (0-1023) of the specified analog pin.",
scope,owner,target,group),
createBlock('Analog Write','fa-send',null,
{ 'GPIO': '_gpio'},
"analogWrite {{GPIO}} {{GPIO_VALUE}}","analogWrite",
"Write an unsigned, 8-bit value (0-255) to an analog pin.",
scope,owner,target,group)
]
});
return items;
};
/**
* Override interface for "toText"
* @param command
* @param text
* @returns {*}
*/
Module.toText = function (command, text) {
if(!command._isGPIO){
return;
}
if(command.variables){
var commandVariables = utils.fromJson(command.variables);
var variables = {};
for(var variable in commandVariables){
variables[variable]=command[commandVariables[variable]] || " ";
}
text = utils.replace(text,null,variables,{
begin:'{{',
end:'}}'
});
return text;
}
};
Module.resolveAfter = function (command,inputString) {
if(!command._isGPIO){
return;
}
if(command.variables){
var commandVariables = utils.fromJson(command.variables);
var variables = {};
for(var variable in commandVariables){
variables[variable]=command._resolve(command[commandVariables[variable]],{
flags:0x00000800
},false);
}
inputString = utils.replace(inputString,null,variables,{
begin:'{{',
end:'}}'
});
}
return inputString;
};
}
patchModule();
return Module;
});

View File

@ -1,170 +0,0 @@
{
"inputs": [
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_NAME",
"name": "CF_DRIVER_NAME",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Display Name",
"type": 13,
"uid": "-1",
"value": "Arduino",
"visible": true,
"changed": true,
"_active": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_ID",
"name": "CF_DRIVER_ID",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Id",
"type": 13,
"uid": "-1",
"value": "aa504ee4-6cd3-8a5e-4654-56294ef78fd6",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Visual",
"id": "CF_DRIVER_ICON",
"name": "CF_DRIVER_ICON",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Icon",
"type": 18,
"uid": "-1",
"value": "./project1/318i.jpg",
"visible": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_CLASS",
"name": "CF_DRIVER_CLASS",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Class",
"type": 4,
"uid": "-1",
"value": "./Arduino/Arduino.js",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Settings",
"id": "CommandSettings",
"name": "CF_DRIVER_COMMANDS",
"order": 1,
"params": "{\"constants\":{\"start\":\"<<\",\"end\":\">>\"},\"send\":{\"mode\":false,\"interval\":\"2000\",\"timeout\":\"500\",\"onReply\":\"\"}}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Commands",
"type": "CommandSettings",
"uid": "-1",
"value": "",
"visible": true,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Variables",
"id": "VariableSettings",
"name": "CF_DRIVER_VARIABLES",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Variables",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Responses",
"id": "ResponseSettings",
"name": "CF_DRIVER_RESPONSES",
"order": 1,
"params": "{\"start\":false,\"startString\":\"\",\"cTypeByte\":false,\"cTypePacket\":false,\"cTypeDelimiter\":true,\"cTypeCount\":false,\"delimiter\":\"\\\\r\",\"count\":\"\",\"wDelimiter\":\"\\\\r\",\"wCount\":\"\"}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Responses",
"type": 13,
"uid": "-1",
"value": "",
"visible": false,
"view": true
}
]
}

View File

@ -1,186 +0,0 @@
{
"blocks": [
{
"_containsChildrenIds": [],
"name": "LED STATUS",
"group": "basicVariables",
"id": "569e8f22-e470-ef80-27d8-70b4b04e3485",
"type": "added",
"icon": "fa-bullseye",
"declaredClass": "xcf.model.Variable",
"gui": "off",
"cmd": "off",
"save": false,
"target": "None",
"value": -1,
"register": true,
"readOnly": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"isVariable": true,
"flags": 4096,
"outlet": 0
},
{
"_containsChildrenIds": [],
"id": "18c655ff-f9f1-66a5-504b-89034fe3f274",
"name": "value",
"type": "added",
"group": "processVariables",
"gui": false,
"cmd": false,
"declaredClass": "xcf.model.Variable",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"isVariable": true,
"flags": 4096,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"name": "A3",
"group": "basicVariables",
"id": "77b335c4-0a6c-942e-81d4-3f01c550179d",
"value": 396,
"type": "added",
"declaredClass": "xcf.model.Variable",
"gui": "off",
"cmd": "off",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"isVariable": true,
"flags": 4096,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"group": "basic",
"condition": "",
"name": "PowerOff",
"id": "075f0201-74a7-9470-63b4-a69f32c8899a",
"send": "1;2;32;1;Power:off:1",
"type": "added",
"flags": 0,
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": 0,
"icon": "fa-exclamation",
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": ""
},
{
"_containsChildrenIds": [],
"group": "basic",
"condition": "",
"name": "PowerOn",
"id": "dc862aaf-b934-d9a7-93e2-48a538bfda4c",
"send": "1;2;32;1;Power:on:1",
"type": "added",
"flags": 0,
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": 0,
"icon": "fa-exclamation",
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": ""
},
{
"_containsChildrenIds": [],
"group": "basic",
"condition": "",
"name": "Reverse",
"id": "d8739058-ad1b-3c9f-a202-c0a50e4bc43f",
"send": "1;2;32;1;VFD:rev:1",
"type": "added",
"flags": 0,
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": 0,
"icon": "fa-exclamation",
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": ""
},
{
"_containsChildrenIds": [],
"group": "basic",
"condition": "",
"name": "Forward",
"id": "ed847438-9f8e-c8ec-cce7-10a97a4a1da3",
"send": "1;2;32;1;VFD:fwd:1",
"type": "added",
"auto": false,
"interval": "1600",
"flags": 0,
"declaredClass": "xcf.model.Command",
"startup": false,
"icon": "fa-exclamation",
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": ""
},
{
"_containsChildrenIds": [],
"group": "basic",
"condition": "",
"name": "Stop",
"id": "c77785cc-4821-0fae-ba62-03333b6fd65a",
"send": "1;2;32;1;VFD:stop:1",
"type": "added",
"flags": 0,
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": 0,
"icon": "fa-exclamation",
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": ""
},
{
"_containsChildrenIds": [],
"group": "conditionalProcess",
"id": "89318503-6ae3-d7a0-cac2-5100ab7fefd5",
"type": "added",
"method": "var message = arguments[0].string;\nconsole.log(\"message: \", message);\n\n",
"declaredClass": "xblox.model.code.RunScript",
"name": "Run Script",
"args": "",
"deferred": false,
"icon": "fa-code",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description"
}
],
"variables": null
}

View File

@ -1,24 +0,0 @@
define(["dcl/dcl"], function(dcl){
return dcl(null, {
/***
* Standard callback when we have a message from the device we're bound to (specified in profile).
* 1. put the message in the incoming queue, tag it as 'unread'
* 2. in case we have messages to send and we are in 'onReply' mode, trigger outgoing queue
*
* @param data {Object} : Message Struct build by the device manager
* @param data.device {Object} : Device info
* @param data.device.host {String} : The host
* @param data.device.port {String} : The host's port
* @param data.device.protocol {String} : The host's protocol
* @param data.message {String} : RAW message, untreated
*/
onMessage:function(data){
},
test:function(){
//send a message :
this.sendMessage('pwon',true);//sends message to device , respecting start & end settings . forcing now!
}
});
});

View File

@ -1,170 +0,0 @@
{
"inputs": [
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_NAME",
"name": "CF_DRIVER_NAME",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Display Name",
"type": 13,
"uid": "-1",
"value": "CNC",
"visible": true,
"changed": true,
"_active": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_ID",
"name": "CF_DRIVER_ID",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Id",
"type": 13,
"uid": "-1",
"value": "e208711c-a51c-8d8a-41f2-883cd95ac7c4",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Visual",
"id": "CF_DRIVER_ICON",
"name": "CF_DRIVER_ICON",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Icon",
"type": 18,
"uid": "-1",
"value": "./project1/318i.jpg",
"visible": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_CLASS",
"name": "CF_DRIVER_CLASS",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Class",
"type": 4,
"uid": "-1",
"value": "./Arduino/CNC.js",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Settings",
"id": "CommandSettings",
"name": "CF_DRIVER_COMMANDS",
"order": 1,
"params": "{\"constants\":{\"start\":\"\",\"end\":\"0x0d\"},\"send\":{\"mode\":false,\"interval\":\"300\",\"timeout\":\"500\",\"onReply\":\"\"}}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Commands",
"type": "CommandSettings",
"uid": "-1",
"value": "",
"visible": true,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Variables",
"id": "VariableSettings",
"name": "CF_DRIVER_VARIABLES",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Variables",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Responses",
"id": "ResponseSettings",
"name": "CF_DRIVER_RESPONSES",
"order": 1,
"params": "{\"start\":false,\"startString\":\"\",\"cTypeByte\":false,\"cTypePacket\":false,\"cTypeDelimiter\":true,\"cTypeCount\":false,\"delimiter\":\"0x0a\",\"count\":\"\",\"wDelimiter\":\"\\\\r\",\"wCount\":\"\"}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Responses",
"type": 13,
"uid": "-1",
"value": "",
"visible": false,
"view": true
}
]
}

View File

@ -1,311 +0,0 @@
{
"blocks": [
{
"_containsChildrenIds": [],
"id": "292a3664-6002-d77f-3a56-dfd7df94b33f",
"name": "value",
"value": "ok",
"type": "added",
"group": "processVariables",
"gui": false,
"cmd": false,
"declaredClass": "xcf.model.Variable",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"group": "basic",
"id": "52289d34-f411-2658-014c-c9afa36df11c",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "M101",
"name": "Extruder on, fwd",
"interval": 0,
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [],
"group": "basic",
"id": "b311f313-eeec-f5a1-7cb5-63fb0fb96691",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "M103",
"name": "Extruder off,",
"interval": 0,
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [],
"group": "basic",
"id": "b2576b63-15f6-91b6-6eda-09a624dcb96e",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "M128",
"name": "Get Postion",
"interval": 0,
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [],
"group": "basic",
"id": "dc056e30-0b3e-3b50-2902-dbdd8b51dcda",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "M106",
"name": "FAN On",
"interval": 0,
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [],
"group": "basic",
"id": "190ba358-b460-5881-e943-4c720fe35009",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "M107",
"name": "FAN Off",
"interval": "0",
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [
"items"
],
"group": "basic",
"id": "119ecf16-5744-1d96-78b0-205a024d1229",
"items": [
"e566a3b2-a6e6-7fcb-5073-c3728567040d",
"7a23a3cf-48ee-33f6-da04-1855df9461aa",
"3f5f6894-65c3-f4aa-5967-e93649bdb063",
"3d9b7428-9852-fceb-2b8c-53ba3b39b64c"
],
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "",
"name": "Test Move X",
"interval": 0,
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [],
"id": "e566a3b2-a6e6-7fcb-5073-c3728567040d",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "G91",
"name": "G91",
"interval": 0,
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "Set Relative Positioning",
"order": 0,
"type": "added",
"parentId": "119ecf16-5744-1d96-78b0-205a024d1229"
},
{
"_containsChildrenIds": [],
"id": "7a23a3cf-48ee-33f6-da04-1855df9461aa",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "G0 X10.0 F3000",
"name": "Move 1 on X",
"interval": 0,
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "Set Absolute Positioning",
"order": 0,
"type": "added",
"parentId": "119ecf16-5744-1d96-78b0-205a024d1229"
},
{
"_containsChildrenIds": [],
"id": "3f5f6894-65c3-f4aa-5967-e93649bdb063",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "G90",
"name": "G90",
"interval": 0,
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "Set Absolute Positioning",
"order": 0,
"type": "added",
"parentId": "119ecf16-5744-1d96-78b0-205a024d1229"
},
{
"_containsChildrenIds": [],
"id": "3d9b7428-9852-fceb-2b8c-53ba3b39b64c",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "M114",
"name": "Get Current Position",
"interval": "0",
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"parentId": "119ecf16-5744-1d96-78b0-205a024d1229"
},
{
"_containsChildrenIds": [
"items"
],
"group": "basic",
"id": "2fb7c3a8-8f34-8cae-0213-46deda3555c0",
"items": [
"a5c56481-03c3-38a7-b58c-e5d128930421",
"eff574ed-4959-2efc-e076-25b5c6f7501b",
"a9426989-3564-7ab8-60c3-8d611b5e4a03",
"4852cb65-9bca-fb63-6510-1b84dde39b84"
],
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "",
"name": "Test Move Y",
"interval": 0,
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [],
"id": "a5c56481-03c3-38a7-b58c-e5d128930421",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "G91",
"name": "G91",
"interval": 0,
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "Set Relative Positioning",
"order": 0,
"type": "added",
"parentId": "2fb7c3a8-8f34-8cae-0213-46deda3555c0"
},
{
"_containsChildrenIds": [],
"id": "eff574ed-4959-2efc-e076-25b5c6f7501b",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "G0 Y10.0 F3000",
"name": "Move 1 on Y",
"interval": 0,
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "Set Absolute Positioning",
"order": 0,
"type": "added",
"parentId": "2fb7c3a8-8f34-8cae-0213-46deda3555c0"
},
{
"_containsChildrenIds": [],
"id": "a9426989-3564-7ab8-60c3-8d611b5e4a03",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "G90",
"name": "G90",
"interval": 0,
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "Set Absolute Positioning",
"order": 0,
"type": "added",
"parentId": "2fb7c3a8-8f34-8cae-0213-46deda3555c0"
},
{
"_containsChildrenIds": [],
"id": "4852cb65-9bca-fb63-6510-1b84dde39b84",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "M114",
"name": "Get Current Position",
"interval": "0",
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"parentId": "2fb7c3a8-8f34-8cae-0213-46deda3555c0"
}
],
"variables": null
}

View File

@ -1,15 +0,0 @@
{
"name": "CF-Raspberry",
"version": "1.0.0",
"description": "",
"main": "PI-GPIO.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"johnny-five": "^0.10.6"
}
}

View File

@ -1,97 +0,0 @@
/** @module xcf/driver/DefaultDriver */
define([
"dcl/dcl",
'xdojo/has',
'xide/utils'
], function (dcl, has, utils) {
// The returning module
var Module = null;
//////////////////////////////////////////////////////////
//
// Constants
//
var isServer = has('host-node'); // We are running server-side ?
var isIDE = has('xcf-ui'); // We are running client-side and in the IDE?
/**
* Default driver template. This will used for new drivers!
*
* @class module:xcf/driver/DefaultDriver
* @extends module:xcf/driver/DriverBase
* @augments module:xide/mixins/EventedMixin
* @link http://rawgit.com/net-commander/windows-dist/master/docs/Driver/modules/module-xcf_driver_DriverBase.html
*/
Module = dcl(null, {
/***
* Standard callback when we have a message from the device we're bound to (specified in profile).
* 1. put the message in the incoming queue, tag it as 'unread'
* 2. in case we have messages to send and we are in 'onReply' mode, trigger outgoing queue
*
* @param data {Object} : Message Struct build by the device manager
* @param data.device {Object} : Device info
* @param data.device.host {String} : The host
* @param data.device.port {String} : The host's port
* @param data.device.protocol {String} : The host's protocol
* @param data.message {String} : RAW message, untreated
*/
//onMessage: function (data) {}
});
//////////////////////////////////////////////////////////
//
// Optional: An example implementation to extend commands in the interface for additional fields
//
if (isIDE) {
/**
*
* @param command {module:xcf/model/Command} The command which for which want to populate the fields.
* @param fields {Object[]}
* @link http://rawgit.com/net-commander/windows-dist/master/docs/Driver/modules/xcf_model_Command.js.html
*/
Module.getFields = function (command, fields) {
/*
return [utils.createCI('test', 0, command.test, {
group: 'General',
title: 'test',
dst: 'test',
order: 198
})];
*/
return [];
};
}
//////////////////////////////////////////////////////////
//
// Optional: An example implementation to modify the string sent to a advice. This makes sense if you added additional fields as shown above.
//
/**
* Callback when a command is before parsing the expression in the "send" field.
* @param command {module:xcf/model/Command}
* @param inputString {string}
* @returns {string}
*/
/*
Module.resolveBefore = function (command,inputString) {
return inputString;
};
*/
/**
* Callback when a command was parsing the expression in the "send" field.
* @param command {module:xcf/model/Command}
* @param inputString {string}
* @returns {string}
*/
/*
Module.resolveAfter = function (command,inputString) {
return inputString;
};
*/
return Module;
});

View File

@ -1,168 +0,0 @@
{
"inputs": [
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_NAME",
"name": "CF_DRIVER_NAME",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Display Name",
"type": 13,
"uid": "-1",
"value": "Lydia-v3",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_ID",
"name": "CF_DRIVER_ID",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Id",
"type": 13,
"uid": "-1",
"value": "b22efaaa-0122-63df-c073-63b9784e7b1d",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Visual",
"id": "CF_DRIVER_ICON",
"name": "CF_DRIVER_ICON",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Icon",
"type": 18,
"uid": "-1",
"value": "./project1/318i.jpg",
"visible": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_CLASS",
"name": "CF_DRIVER_CLASS",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Class",
"type": 4,
"uid": "-1",
"value": "./Extrusion/Lydia-v3.js",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Settings",
"id": "CommandSettings",
"name": "CF_DRIVER_COMMANDS",
"order": 1,
"params": "{\"constants\":{\"start\":\"\",\"end\":\"\"},\"send\":{\"mode\":false,\"interval\":\"300\",\"timeout\":\"500\",\"onReply\":\"\"}}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Commands",
"type": "CommandSettings",
"uid": "-1",
"value": "",
"visible": true,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Variables",
"id": "VariableSettings",
"name": "CF_DRIVER_VARIABLES",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Variables",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Responses",
"id": "ResponseSettings",
"name": "CF_DRIVER_RESPONSES",
"order": 1,
"params": "{\"start\":false,\"startString\":\"\",\"cTypeByte\":false,\"cTypePacket\":false,\"cTypeDelimiter\":true,\"cTypeCount\":false,\"delimiter\":\"\\\\r\",\"count\":\"\",\"wDelimiter\":\"\\\\r\",\"wCount\":\"\"}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Responses",
"type": 13,
"uid": "-1",
"value": "",
"visible": false,
"view": true
}
]
}

View File

@ -1,62 +0,0 @@
{
"blocks": [
{
"_containsChildrenIds": [],
"group": "basic",
"condition": "",
"name": "Extrude",
"id": "d5c11168-db1e-5d66-0091-9bfcce710ccd",
"type": "added",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "fwd",
"interval": 0,
"flags": 2048,
"icon": "fa-exclamation",
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": ""
},
{
"_containsChildrenIds": [],
"group": "basic",
"condition": "",
"name": "Stop",
"id": "f9473067-0159-9e1f-5308-9cc51580ad39",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "rev",
"interval": 0,
"flags": 2048,
"icon": "fa-exclamation",
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"type": "added"
},
{
"_containsChildrenIds": [],
"group": "basic",
"condition": "",
"name": "Velocity",
"id": "c56e0a6f-e5dc-1ef6-6551-86102fdd3318",
"send": "vsi-%speed%",
"type": "added",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": 0,
"flags": 2048,
"icon": "fa-exclamation",
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": ""
}
],
"variables": null
}

View File

@ -1,24 +0,0 @@
define(["dcl/dcl"], function(dcl){
return dcl(null, {
/***
* Standard callback when we have a message from the device we're bound to (specified in profile).
* 1. put the message in the incoming queue, tag it as 'unread'
* 2. in case we have messages to send and we are in 'onReply' mode, trigger outgoing queue
*
* @param data {Object} : Message Struct build by the device manager
* @param data.device {Object} : Device info
* @param data.device.host {String} : The host
* @param data.device.port {String} : The host's port
* @param data.device.protocol {String} : The host's protocol
* @param data.message {String} : RAW message, untreated
*/
onMessage:function(data){
},
test:function(){
//send a message :
this.sendMessage('pwon',true);//sends message to device , respecting start & end settings . forcing now!
}
});
});

View File

@ -1,170 +0,0 @@
{
"inputs": [
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_NAME",
"name": "CF_DRIVER_NAME",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Display Name",
"type": 13,
"uid": "-1",
"value": "WebCam",
"visible": true,
"changed": true,
"_active": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_ID",
"name": "CF_DRIVER_ID",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Id",
"type": 13,
"uid": "-1",
"value": "cd3956ce-2fcb-d674-d59e-b903db3a4296",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Visual",
"id": "CF_DRIVER_ICON",
"name": "CF_DRIVER_ICON",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Icon",
"type": 18,
"uid": "-1",
"value": ".\/project1\/318i.jpg",
"visible": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_CLASS",
"name": "CF_DRIVER_CLASS",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Class",
"type": 4,
"uid": "-1",
"value": ".\/House\/WebCam.js",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Settings",
"id": "CommandSettings",
"name": "CF_DRIVER_COMMANDS",
"order": 1,
"params": "{\"constants\":{\"start\":\"\",\"end\":\"\"},\"send\":{\"mode\":false,\"interval\":\"300\",\"timeout\":\"500\",\"onReply\":\"\"}}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Commands",
"type": "CommandSettings",
"uid": "-1",
"value": "",
"visible": true,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Variables",
"id": "VariableSettings",
"name": "CF_DRIVER_VARIABLES",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Variables",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Responses",
"id": "ResponseSettings",
"name": "CF_DRIVER_RESPONSES",
"order": 1,
"params": "{\"start\":false,\"startString\":\"\",\"cTypeByte\":false,\"cTypePacket\":false,\"cTypeDelimiter\":true,\"cTypeCount\":false,\"delimiter\":\"\\\\r\",\"count\":\"\",\"wDelimiter\":\"\\\\r\",\"wCount\":\"\"}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Responses",
"type": 13,
"uid": "-1",
"value": "",
"visible": false,
"view": true
}
]
}

View File

@ -1,143 +0,0 @@
{
"blocks": [
{
"_containsChildrenIds": [
"items"
],
"group": "init",
"id": "105c6870-86ce-a275-bbd3-2dd158b1074d",
"declaredClass": "xblox.model.mqtt.Subscribe",
"name": "Cam move",
"topic": "camMove",
"args": "",
"deferred": false,
"icon": "fa-bell",
"path": "camMove",
"qos": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"items": [
"9fc90c77-3cbf-1dec-0dab-6a65534d3ea0",
"bf7f0b01-2f08-8750-4ef7-dd439fa5f974",
"d932e1ab-f0ae-6b87-8149-42be007247bc"
]
},
{
"_containsChildrenIds": [],
"id": "c8f38e6e-2697-bedd-42bc-069e184036e6",
"name": "value",
"type": "added",
"group": "processVariables",
"gui": false,
"cmd": false,
"declaredClass": "xcf.model.Variable",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"isVariable": true,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"condition": "",
"parentId": "105c6870-86ce-a275-bbd3-2dd158b1074d",
"id": "9fc90c77-3cbf-1dec-0dab-6a65534d3ea0",
"declaredClass": "xblox.model.functions.CallBlock",
"command": "command://deviceScope=user_devices&device=deda59c1-0386-bb6c-548d-8b0300736e0e&driver=52f4b5dd-889d-a5c9-0221-edaa0dce1a6f&driverScope=user_drivers&block=6253e301-a9ee-f03c-87a4-cb4666ce00f8",
"icon": "",
"_timeout": 100,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [
"items"
],
"group": "init",
"id": "5ad2654e-d325-007d-f7ee-1f2e8a022753",
"items": [
"aa830cbe-8870-dd00-9ad4-ba10ade4baf3"
],
"declaredClass": "xblox.model.mqtt.Subscribe",
"name": "Subscribe",
"topic": "camMoveStopped",
"args": "",
"deferred": false,
"icon": "fa-bell",
"path": "",
"qos": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [],
"parentId": "5ad2654e-d325-007d-f7ee-1f2e8a022753",
"id": "aa830cbe-8870-dd00-9ad4-ba10ade4baf3",
"declaredClass": "xblox.model.code.RunScript",
"name": "Run Script",
"method": "console.error('not moving');",
"args": "",
"deferred": false,
"icon": "fa-code",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"description": "No Description"
},
{
"_containsChildrenIds": [],
"condition": "",
"parentId": "105c6870-86ce-a275-bbd3-2dd158b1074d",
"id": "bf7f0b01-2f08-8750-4ef7-dd439fa5f974",
"declaredClass": "xblox.model.functions.CallBlock",
"command": "command://deviceScope=user_devices&device=1b53dd5c-bda3-a45b-27ea-b1adb876d729&driver=117554bc-f6ef-3442-f163-901d5d35d158&driverScope=user_drivers&block=2d2ce608-9a1f-18d6-5298-fefcd85f8bc9",
"icon": "",
"_timeout": 100,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [],
"parentId": "105c6870-86ce-a275-bbd3-2dd158b1074d",
"id": "d932e1ab-f0ae-6b87-8149-42be007247bc",
"declaredClass": "xblox.model.logging.Log",
"name": "Log Message",
"level": "info",
"message": "return \"Something Moved \";",
"_type": "XBlox",
"host": "this host",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"icon": "fa-play"
}
],
"variables": null
}

View File

@ -1,24 +0,0 @@
define(["dcl/dcl"], function(dcl){
return dcl(null, {
/***
* Standard callback when we have a message from the device we're bound to (specified in profile).
* 1. put the message in the incoming queue, tag it as 'unread'
* 2. in case we have messages to send and we are in 'onReply' mode, trigger outgoing queue
*
* @param data {Object} : Message Struct build by the device manager
* @param data.device {Object} : Device info
* @param data.device.host {String} : The host
* @param data.device.port {String} : The host's port
* @param data.device.protocol {String} : The host's protocol
* @param data.message {String} : RAW message, untreated
*/
onMessage:function(data){
},
test:function(){
//send a message :
this.sendMessage('pwon',true);//sends message to device , respecting start & end settings . forcing now!
}
});
});

View File

@ -1,170 +0,0 @@
{
"inputs": [
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_NAME",
"name": "CF_DRIVER_NAME",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Display Name",
"type": 13,
"uid": "-1",
"value": "iphone",
"visible": true,
"changed": true,
"_active": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_ID",
"name": "CF_DRIVER_ID",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Id",
"type": 13,
"uid": "-1",
"value": "117554bc-f6ef-3442-f163-901d5d35d158",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Visual",
"id": "CF_DRIVER_ICON",
"name": "CF_DRIVER_ICON",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Icon",
"type": 18,
"uid": "-1",
"value": ".\/project1\/318i.jpg",
"visible": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_CLASS",
"name": "CF_DRIVER_CLASS",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Class",
"type": 4,
"uid": "-1",
"value": ".\/House\/iphone.js",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Settings",
"id": "CommandSettings",
"name": "CF_DRIVER_COMMANDS",
"order": 1,
"params": "{\"constants\":{\"start\":\"\",\"end\":\"\"},\"send\":{\"mode\":false,\"interval\":\"300\",\"timeout\":\"500\",\"onReply\":\"\"}}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Commands",
"type": "CommandSettings",
"uid": "-1",
"value": "",
"visible": true,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Variables",
"id": "VariableSettings",
"name": "CF_DRIVER_VARIABLES",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Variables",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Responses",
"id": "ResponseSettings",
"name": "CF_DRIVER_RESPONSES",
"order": 1,
"params": "{\"start\":false,\"startString\":\"\",\"cTypeByte\":false,\"cTypePacket\":false,\"cTypeDelimiter\":true,\"cTypeCount\":false,\"delimiter\":\"\\\\r\",\"count\":\"\",\"wDelimiter\":\"\\\\r\",\"wCount\":\"\"}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Responses",
"type": 13,
"uid": "-1",
"value": "",
"visible": false,
"view": true
}
]
}

View File

@ -1,63 +0,0 @@
{
"blocks": [
{
"_containsChildrenIds": [],
"group": "basic",
"id": "2d2ce608-9a1f-18d6-5298-fefcd85f8bc9",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "return \"sh /install/alarm.sh\"",
"name": "Alarm",
"interval": "0",
"flags": 2048,
"icon": "fa-exclamation",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [],
"id": "c615e748-66fa-5638-dde7-bb82fdc08231",
"name": "value",
"type": "added",
"group": "processVariables",
"gui": false,
"cmd": false,
"declaredClass": "xcf.model.Variable",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"isVariable": true,
"flags": 4096,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"group": "basic",
"id": "4bfd6f39-e95c-edfc-cd19-f8dff7a2a78b",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "ls",
"name": "ls",
"interval": "0",
"flags": 2048,
"icon": "fa-exclamation",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
}
],
"variables": null
}

View File

@ -1,290 +0,0 @@
/** @module nxapp/protocols/JSON-RPC */
define([
'dcl/dcl',
"xide/utils",
"xide/types",
'xdojo/has!host-node?nxapp/protocols/ProtocolBase',
"dojo/Deferred",
'xdojo/has',
"xcf/model/Command"
],function(dcl,utils,types,ProtocolBase,Deferred,has,Command){
var debug = true;
var debugData = true;
// The returning module
var Module = null;
//////////////////////////////////////////////////////////
//
// Constants
//
var isServer = has('host-node'); // We are running server-side ?
var isIDE = has('xcf-ui'); // We are running client-side and in the IDE?
//No ProtocolBase means we're running on client side
if (!ProtocolBase) {
//create dummy module
Module = dcl(null, {});
patchModule();
return Module;
}
/**
* MQTT protocol mqttClient
* @class module:nxapp/protocols/MQTT
* @extends module:nxapp/protocols/ProtocolBase
*/
Module = dcl(ProtocolBase,{
declaredClass:"nxapp.protocols.JSON-RPC",
_socket:null,
protocolName:'json-rpc',
instance:null,
getOptions:function(host,port,deviceOptions){
var options = {
};
return utils.mixin(options,deviceOptions);
},
onConnected:function(){
this.owner.onConnected();
},
onError:function(error,options) {
this.delegate.onError(this.connection,utils.mixin({
code:error
},options),this.options);
},
onClose:function(data) {
this.delegate.onClose(this.connection,data);
},
_client:null,
connect:function(){
var _options = this.options;
if(!_options || !_options.driver){
debug || this.isDebug() && console.error('no driver in options',_options);
return this;
}
var host = _options.host;
var port = _options.port;
var deviceOptions = utils.getJson(_options.options || {});
if(deviceOptions.debug===true){
debug = true;
}
var self = this;
this.getModule('jayson').then(function(jayson){
try {
self._client = jayson.client[deviceOptions.interface](host);
self.onConnected();
}catch(e){
console.error('error creating client',e);
}
});
this.host = host;
this.port = port;
this.protocol = this.protocolName;
this._socket = {};
this._socket.writable=true;
return this;
},
onData:function(evt,buffer){
debugData || this.isDebug() && console.log('MQTT->onData ' + evt.topic,utils.inspect(evt));
this.delegate.onData(this.connection,evt,buffer);
},
onCommandError:function(cmd,options){
debug || this.isDebug() && console.log('MQTT->CommandError ' + cmd + ' id ' + options.id + ' src ' + options.src);
try {
this.delegate.onData(this.connection, utils.mixin({
cmd: cmd,
event: types.EVENTS.ON_COMMAND_ERROR
},options));
}catch(e){
console.error('---',e);
}
},
onFinish:function(cmd,options,buffer){
debug || this.isDebug() && console.log('MQTT onFinish ' + cmd + ' id ' + options.id + ' src ' + options.src);
try {
this.delegate.onData(this.connection, utils.mixin({
cmd: cmd,
event: types.EVENTS.ON_COMMAND_FINISH
},options),buffer);
}catch(e){
console.error('onFinish-Error:',e);
}
},
/**
*
* @param data {string} A string encoded byte array in the 01,02,... format
* @param command
* @param options
* @private
*/
_send: function (data, command, options) {
var wait = options.params.wait;
var self = this;
var outString = JSON.stringify(utils.mixin({
command: command
}, data, null, 2));
if (wait) {
self.owner.onFinish(command, options, new Buffer(outString));
} else {
self.owner.onData(outString, new Buffer(outString));
}
},
write:function(what,options) {
var _parsed = null;
//convert buffer from byte array string to string
var intArray = utils.bufferFromDecString(what);
var buffer = new Buffer(intArray);
what = buffer.toString();
var self = this;
try {
var args = utils.getJson(options.params.args);
if(!_.isArray(args)){
args = [];
}
this._client.request(what,args, function (err, response) {
if (err) {
console.error('error: ', err);
}
self._send({
value: response.result
}, 'request ' + what + '(' + JSON.stringify(args)+')', options);
});
}catch(e){
console.error("error making client request");
}
},
send:function(cmd,options) {
return;
},
close:function() {
}
});
function patchModule(){
/**
*
* @param label
* @param icon
* @param ctrAgs
* @param variables
* @param send
* @param func
* @param description
* @param scope
* @param owner
* @param target
* @param group
*/
function createBlock(label,icon,ctrAgs,variables,send,func,description,scope, owner, target, group){
return {
name: label,
owner: owner,
icon: icon,
proto: Command,
target: target,
ctrArgs: utils.mixin({
icon:icon,
flags:32768,
name:label,
scope: scope,
group: group,
send:send,
_isJSONRPC:true,
_func:func,
description:description
},ctrAgs)
};
}
Module.getFields = function (command, fields) {
var result = [];
if (command._isJSONRPC) {
command._args = command._args || {};
result.push(utils.createCI('arguments',types.ECIType.ARGUMENT,command._args,{
group:'Arguments',
title:'Arguments',
dst:'_args'
}));
}
return result;
};
/**
* @param command
* @returns {*|{}}
*/
Module.getCommandArgs = function (command) {
return command._args;
};
/**
* Extend xblox for new blocks/commands.
* @param scope
* @param owner
* @param target
* @param group
* @param items
* @returns {*}
*/
Module.getNewBlocks=function(scope, owner, target, group, items){
if(!items){
return null;
}
items.push({
name: 'JSON-RPC',
iconClass: 'fa-code',
items: [
createBlock('Request','fa-send',null,
{ 'GPIO': '_gpio'},
"request","request",
"",
scope,owner,target,group)
]
});
return items;
};
Module.options = function (query) {
try {
var dfd = new Deferred();
var ECIType = types.ECIType;
var NetworkGroup = 'Network';
function createOption(label, value) {
return {
label: label,
value: value
}
}
var cis = [
utils.createCI('interface', ECIType.ENUMERATION,'', {
group: NetworkGroup,
title:'Interface',
description:"",
value:'http',
options:[
createOption('Tcp','tcp'),
createOption('Tls','tls'),
createOption('HTTP','http'),
createOption('HTTPS','https')
]
})
];
dfd.resolve(cis);
return dfd;
} catch (e) {
console.error('error', e);
}
return dfd;
};
}
Module._is=function(){
return types.PROTOCOL.TCP;
};
patchModule();
return Module;
});

View File

@ -1,170 +0,0 @@
{
"inputs": [
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_NAME",
"name": "CF_DRIVER_NAME",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Display Name",
"type": 13,
"uid": "-1",
"value": "JSON_RPC",
"visible": true,
"_active": false,
"changed": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_ID",
"name": "CF_DRIVER_ID",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Id",
"type": 13,
"uid": "-1",
"value": "55ad4a31-2f0c-bfde-2338-b31bac6e56e5",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Visual",
"id": "CF_DRIVER_ICON",
"name": "CF_DRIVER_ICON",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Icon",
"type": 18,
"uid": "-1",
"value": "./project1/318i.jpg",
"visible": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_CLASS",
"name": "CF_DRIVER_CLASS",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Class",
"type": 4,
"uid": "-1",
"value": "./JSON_RPC/JSON_RPC.js",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Settings",
"id": "CommandSettings",
"name": "CF_DRIVER_COMMANDS",
"order": 1,
"params": "{\"constants\":{\"start\":\"\",\"end\":\"\"},\"send\":{\"mode\":false,\"interval\":\"300\",\"timeout\":\"500\",\"onReply\":\"\"}}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Commands",
"type": "CommandSettings",
"uid": "-1",
"value": "[]",
"visible": true,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Variables",
"id": "VariableSettings",
"name": "CF_DRIVER_VARIABLES",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Variables",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Responses",
"id": "ResponseSettings",
"name": "CF_DRIVER_RESPONSES",
"order": 1,
"params": "{\"start\":false,\"startString\":\"\",\"cTypeByte\":false,\"cTypePacket\":false,\"cTypeDelimiter\":true,\"cTypeCount\":false,\"delimiter\":\"\\\\r\",\"count\":\"\",\"wDelimiter\":\"\\\\r\",\"wCount\":\"\"}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Responses",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
}
]
}

View File

@ -1,72 +0,0 @@
{
"blocks": [
{
"_containsChildrenIds": [
"items"
],
"icon": "fa-send",
"flags": 32768,
"name": "Request",
"group": "basic",
"variables": "{\"GPIO\":\"_gpio\"}",
"send": "Player.GetActivePlayers",
"_isJSONRPC": true,
"_func": "request",
"description": "",
"id": "7596452c-d283-6463-1ebc-781e780c6e94",
"type": "added",
"_args": "[]",
"items": [
"e7931261-cf51-2fe9-1018-297e6a9ace36"
],
"startup": true,
"auto": false,
"declaredClass": "xcf.model.Command",
"interval": 0,
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": ""
},
{
"_containsChildrenIds": [],
"id": "197d85f1-f8b0-3ab0-4960-dd49d5929dfd",
"name": "value",
"value": "",
"type": "added",
"group": "processVariables",
"gui": false,
"cmd": false,
"declaredClass": "xcf.model.Variable",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"isVariable": true,
"flags": 4096,
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"parentId": "7596452c-d283-6463-1ebc-781e780c6e94",
"id": "e7931261-cf51-2fe9-1018-297e6a9ace36",
"method": "console.log('result',arguments);",
"outlet": 8,
"type": "added",
"declaredClass": "xblox.model.code.RunScript",
"name": "Run Script",
"args": "",
"deferred": false,
"icon": "fa-code",
"order": 0,
"enabled": true,
"shareTitle": ""
}
],
"variables": null
}

View File

@ -1,33 +0,0 @@
define(["module","dcl/dcl"], function(module,dcl){
return dcl(null, {
/***
* Standard callback when we have a message from the device we're bound to (specified in profile).
* 1. put the message in the incoming queue, tag it as 'unread'
* 2. in case we have messages to send and we are in 'onReply' mode, trigger outgoing queue
*
* @param data {Object} : Message Struct build by the device manager
* @param data.device {Object} : Device info
* @param data.device.host {String} : The host
* @param data.device.port {String} : The host's port
* @param data.device.protocol {String} : The host's protocol
* @param data.message {String} : RAW message, untreated
*/
onMessage:function(data){
//let driver base do its job:
//this.inherited(arguments);
console.log('message : 2',data);
},
test:function(){
//send a message :
this.sendMessage('pwon',true);//sends message to device , respecting start & end settings . forcing now!
}
});
});

View File

@ -1,170 +0,0 @@
{
"inputs": [
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_NAME",
"name": "CF_DRIVER_NAME",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Display Name",
"type": 13,
"uid": "-1",
"value": "Kodi-MQTT",
"visible": true,
"changed": true,
"_active": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_ID",
"name": "CF_DRIVER_ID",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Id",
"type": 13,
"uid": "-1",
"value": "8fec6dd4-f647-291d-0a9b-27eea266f6d0",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Visual",
"id": "CF_DRIVER_ICON",
"name": "CF_DRIVER_ICON",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Icon",
"type": 18,
"uid": "-1",
"value": ".\/project1\/318i.jpg",
"visible": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_CLASS",
"name": "CF_DRIVER_CLASS",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Class",
"type": 4,
"uid": "-1",
"value": ".\/Kodi\/MQTT.js",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Settings",
"id": "CommandSettings",
"name": "CF_DRIVER_COMMANDS",
"order": 1,
"params": "{\"constants\":{\"start\":\"\",\"end\":\"\"},\"send\":{\"mode\":false,\"interval\":\"300\",\"timeout\":\"500\",\"onReply\":\"\"}}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Commands",
"type": "CommandSettings",
"uid": "-1",
"value": "",
"visible": true,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Variables",
"id": "VariableSettings",
"name": "CF_DRIVER_VARIABLES",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Variables",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Responses",
"id": "ResponseSettings",
"name": "CF_DRIVER_RESPONSES",
"order": 1,
"params": "{\"start\":false,\"startString\":\"\",\"cTypeByte\":false,\"cTypePacket\":false,\"cTypeDelimiter\":true,\"cTypeCount\":false,\"delimiter\":\"\\\\r\",\"count\":\"\",\"wDelimiter\":\"\\\\r\",\"wCount\":\"\"}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Responses",
"type": 13,
"uid": "-1",
"value": "",
"visible": false,
"view": true
}
]
}

View File

@ -1,407 +0,0 @@
{
"blocks": [
{
"_containsChildrenIds": [],
"parentId": "eda78a69-707f-2841-9418-66311495c955",
"id": "42c1fc32-f30b-8480-1774-077ec433dc63",
"declaredClass": "xblox.model.code.RunScript",
"name": "log",
"method": "console.log('mqtt message ' + arguments[0]);",
"args": "",
"deferred": false,
"icon": "fa-code",
"enabled": true,
"shareTitle": "",
"description": "Runs an expression.<br/>\n\n<b>Behaviour</b>\n\n<pre>\n\n //to abort execution (child blocks), return something negative as -1 or false.\n return false;\n\n</pre>",
"order": 0,
"type": "added",
"outlet": 0
},
{
"_containsChildrenIds": [],
"id": "c09e8c2d-9b1d-b7cf-1f9e-13a78215b13c",
"name": "value",
"type": "added",
"group": "processVariables",
"gui": false,
"cmd": false,
"declaredClass": "xcf.model.Variable",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"isVariable": true,
"flags": 4096,
"outlet": 0,
"value": -1,
"icon": "fa-play"
},
{
"_containsChildrenIds": [
"items"
],
"group": "init",
"id": "eda78a69-707f-2841-9418-66311495c955",
"items": [
"42c1fc32-f30b-8480-1774-077ec433dc63"
],
"declaredClass": "xblox.model.mqtt.Subscribe",
"name": "Subscribe",
"topic": "192.168.1.20/23/Variable/Volume",
"args": "",
"deferred": false,
"icon": "fa-bell",
"path": "value",
"qos": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"outlet": 0
},
{
"_containsChildrenIds": [
"items"
],
"group": "init",
"id": "540ed71b-8f87-d9fd-a900-085d2ba7ae0f",
"items": [
"704253d9-1352-0ab6-8f89-51d51d6725fc"
],
"declaredClass": "xblox.model.mqtt.Subscribe",
"name": "Subscribe",
"topic": "kodi/connected",
"args": "",
"deferred": false,
"icon": "fa-bell",
"path": "",
"qos": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"outlet": 0
},
{
"_containsChildrenIds": [],
"name": "Kodi-Connected",
"group": "basicVariables",
"id": "a782d2ff-200c-5262-d21f-79fc4012fae2",
"declaredClass": "xcf.model.Variable",
"gui": "off",
"cmd": "off",
"save": false,
"target": "None",
"value": "0",
"register": true,
"readOnly": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"isVariable": true,
"flags": 4096,
"outlet": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"variable": "a782d2ff-200c-5262-d21f-79fc4012fae2",
"variableId": "c09e8c2d-9b1d-b7cf-1f9e-13a78215b13c",
"value": "",
"parentId": "540ed71b-8f87-d9fd-a900-085d2ba7ae0f",
"id": "704253d9-1352-0ab6-8f89-51d51d6725fc",
"declaredClass": "xblox.model.variables.VariableAssignmentBlock",
"name": "Set Variable",
"icon": "",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"flags": 4,
"outlet": 0
},
{
"_containsChildrenIds": [
"items"
],
"group": "init",
"id": "b061bd8c-3045-03c7-0dfb-e284422c1202",
"items": [
"72660613-080c-d93d-ba08-97fda3dfc4d4"
],
"declaredClass": "xblox.model.mqtt.Subscribe",
"name": "Subscribe",
"topic": "kodi/status/playbackstate",
"args": "",
"deferred": false,
"icon": "fa-bell",
"path": "kodi_state",
"qos": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"outlet": 0
},
{
"_containsChildrenIds": [],
"name": "Kodi-Playbackstate",
"group": "basicVariables",
"id": "3cb668c3-5b50-e200-f51f-bf7a22a437f3",
"declaredClass": "xcf.model.Variable",
"gui": "off",
"cmd": "off",
"save": false,
"target": "None",
"value": "started",
"register": true,
"readOnly": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"isVariable": true,
"flags": 4096,
"outlet": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"variable": "3cb668c3-5b50-e200-f51f-bf7a22a437f3",
"variableId": "c09e8c2d-9b1d-b7cf-1f9e-13a78215b13c",
"value": "",
"parentId": "b061bd8c-3045-03c7-0dfb-e284422c1202",
"id": "72660613-080c-d93d-ba08-97fda3dfc4d4",
"declaredClass": "xblox.model.variables.VariableAssignmentBlock",
"name": "Set Variable",
"icon": "",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"flags": 4,
"outlet": 0
},
{
"_containsChildrenIds": [
"items"
],
"group": "init",
"id": "89ea751f-b00c-6d60-387c-c5c85eb1d20e",
"items": [
"90d07af1-d300-863c-23d0-8de48ea45b1d"
],
"declaredClass": "xblox.model.mqtt.Subscribe",
"name": "Subscribe",
"topic": "kodi/status/title",
"args": "",
"deferred": false,
"icon": "fa-bell",
"path": "kodi_details.label",
"qos": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"outlet": 0
},
{
"_containsChildrenIds": [],
"name": "Kodi-Playing Title",
"group": "basicVariables",
"id": "d8dd613c-2b71-05b7-adcc-ec0dc82f8d87",
"declaredClass": "xcf.model.Variable",
"gui": "off",
"cmd": "off",
"save": false,
"target": "None",
"value": "return YOKOO - REACTIONS - RADIO VENAO",
"register": true,
"readOnly": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"isVariable": true,
"flags": 4096,
"outlet": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"variable": "d8dd613c-2b71-05b7-adcc-ec0dc82f8d87",
"variableId": "c09e8c2d-9b1d-b7cf-1f9e-13a78215b13c",
"value": "",
"parentId": "89ea751f-b00c-6d60-387c-c5c85eb1d20e",
"id": "90d07af1-d300-863c-23d0-8de48ea45b1d",
"declaredClass": "xblox.model.variables.VariableAssignmentBlock",
"name": "Set Variable",
"icon": "",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"flags": 4,
"outlet": 0
},
{
"_containsChildrenIds": [],
"group": "basic",
"id": "07e7b04f-c6ec-a04d-6e9d-732b4e8462cb",
"declaredClass": "xblox.model.mqtt.Publish",
"name": "Next",
"topic": "kodi/command/playbackstate",
"args": "next",
"deferred": false,
"icon": "fa-arrow-circle-right",
"qos": "1",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"retain": false,
"startup": false,
"send": "",
"interval": "0",
"waitForResponse": false,
"flags": 0,
"outlet": 0
},
{
"_containsChildrenIds": [],
"group": "basic",
"id": "98007916-03a9-0457-c2cd-54e33dea311d",
"declaredClass": "xblox.model.mqtt.Publish",
"name": "Prev",
"topic": "kodi/command/playbackstate",
"args": "previous",
"deferred": false,
"icon": "fa-arrow-circle-left",
"qos": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"retain": false,
"startup": false,
"send": "",
"interval": 0,
"waitForResponse": false,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [],
"group": "basic",
"id": "d0f70902-8122-e57f-4bb4-5b4495a730dd",
"declaredClass": "xblox.model.mqtt.Publish",
"name": "Pause",
"topic": "kodi/command/playbackstate",
"args": "2",
"deferred": false,
"icon": "fa-pause",
"qos": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"retain": false,
"startup": false,
"send": "",
"interval": 0,
"waitForResponse": false,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [],
"group": "basic",
"id": "33681f61-5309-f884-0395-4ec42ed47e5f",
"declaredClass": "xblox.model.mqtt.Publish",
"name": "Stop",
"topic": "kodi/command/playbackstate",
"args": "0",
"deferred": false,
"qos": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"retain": false,
"startup": false,
"send": "",
"interval": 0,
"waitForResponse": false,
"flags": 2048,
"outlet": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"group": "basic",
"id": "b892d78a-000e-0c82-17e4-f43b1d23716d",
"declaredClass": "xblox.model.mqtt.Publish",
"name": "Resume",
"topic": "kodi/command/playbackstate",
"args": "1",
"deferred": false,
"icon": "fa-stop",
"qos": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"retain": false,
"startup": false,
"send": "",
"interval": "0",
"waitForResponse": false,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [],
"group": "basic",
"id": "0c7d9511-eb8c-3f26-b5f9-14669497c862",
"declaredClass": "xblox.model.mqtt.Publish",
"name": "Play-Sonica",
"topic": "kodi/command/play",
"args": "plugin://plugin.audio.shoutcast/resolve/9480264",
"deferred": false,
"icon": "fa-send",
"qos": 0,
"retain": false,
"startup": false,
"send": "",
"interval": "0",
"flags": 2048,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
}
],
"variables": null
}

View File

@ -1,248 +0,0 @@
define([
"dcl/dcl",
"nxapp/protocols/Tcp",
"xide/mixins/EventedMixin",
"dojo/node!net",
"dojo/node!util",
"dojo/node!events",
"dojo/has",
"xide/utils"
], function(dcl,Tcp,EventedMixin,net,util,events,has,utils){
var EventEmitter = events.EventEmitter;
var MPD_SENTINEL = /^(OK|ACK|list_OK)(.*)$/m;
var OK_MPD = /^OK MPD /;
function noop(err) {
if (err) {
console.error('error : ',err);
this.emit('error', err);
}
}
function Command(name, args) {
this.name = name;
this.args = args;
}
Command.prototype.toString = function() {
return this.name + " " + this.args.map(argEscape).join(" ");
};
function argEscape(arg){
// replace all " with \"
return '"' + arg.toString().replace(/"/g, '\\"') + '"';
}
// convenience
function cmd(name, args) {
return new Command(name, args);
}
function parseKeyValueMessage(msg) {
var result = {};
msg.split('\n').forEach(function(p){
if(p.length === 0) {
return;
}
var keyValue = p.match(/([^ ]+): (.*)/);
if (keyValue == null) {
throw new Error('Could not parse entry "' + p + '"')
}
result[keyValue[1]] = keyValue[2];
});
return result;
}
function parseArrayMessage(msg) {
var results = [];
var obj = {};
msg.split('\n').forEach(function(p) {
if(p.length === 0) {
return;
}
var keyValue = p.match(/([^ ]+): (.*)/);
if (keyValue == null) {
throw new Error('Could not parse entry "' + p + '"')
}
if (obj[keyValue[1]] !== undefined) {
results.push(obj);
obj = {};
obj[keyValue[1]] = keyValue[2];
}
else {
obj[keyValue[1]] = keyValue[2];
}
});
results.push(obj);
return results;
}
return dcl([Tcp,EventedMixin.dcl], {
onReloaded:function(){
console.error('on reloaded');
},
/***
* Standard callback when we have a message from the device we're bound to (specified in profile).
* 1. put the message in the incoming queue, tag it as 'unread'
* 2. in case we have messages to send and we are in 'onReply' mode, trigger outgoing queue
*
* @param data {Object} : Message Struct build by the device manager
* @param data.device {Object} : Device info
* @param data.device.host {String} : The host
* @param data.device.port {String} : The host's port
* @param data.device.protocol {String} : The host's protocol
* @param data.message {String} : RAW message, untreated
*/
onMessage:function(data){
console.log('on message : ')
},
handleMessage : function(err, msg) {
//console.log('message: ' + err,msg);
var handler = this.msgHandlerQueue.shift();
handler && handler(err, msg);
var self = this;
if(msg){
var bufferInt = utils.stringToBuffer(self.buffer.toString());
var buffer = new Buffer(bufferInt);
//console.log('handle message : ' + self.buffer.toString());
self.owner.onData(self.buffer.toString(),buffer);
}
},
sendWithCallback : function(cmd, cb) {
cb = cb || noop.bind(this);
this.msgHandlerQueue.push(cb);
this.send(cmd + "\n");
},
setupIdling : function() {
var self = this;
self.sendWithCallback("idle", function(err, msg) {
self.handleIdleResultsLoop(err, msg);
});
self.idling = true;
self._emit('ready');
},
send:function(data){
this._socket.write(data);
console.log('send : ',data);
},
handleIdleResults : function(msg) {
var self = this;
msg.split("\n").forEach(function(system) {
if (system.length > 0) {
var name = system.substring(9);
self._emit('system-' + name);
self._emit('system', name);
}
});
},
handleIdleResultsLoop : function(err, msg) {
var self = this;
if (err) {
self._emit('error', err);
return;
}
self.handleIdleResults(msg);
if (self.msgHandlerQueue.length === 0) {
self.sendWithCallback("idle", function(err, msg) {
self.handleIdleResultsLoop(err, msg);
});
}
},
sendCommand :function(command, callback) {
var self = this;
callback = callback || noop.bind(this);
self.send("noidle\n");
self.sendWithCallback(command, callback);
/*
self.sendWithCallback("idle", function(err, msg) {
self.handleIdleResultsLoop(err, msg);
});*/
},
onConnect:function(){
var self = this;
console.error('module path : ' + this.modulePath);
self._on('system-player', function() {
self.sendCommand(cmd("status", []), function(err, msg) {
if (err) throw err;
console.log(msg);
});
});
this._socket.setEncoding('utf8');
this.buffer = "";
this.msgHandlerQueue = [];
this.idling = false;
this._socket.on('data',function(data){
var m;
self.buffer += data;
while (m = self.buffer.match(MPD_SENTINEL)) {
var msg = self.buffer.substring(0, m.index)
, line = m[0]
, code = m[1]
, str = m[2];
if (code === "ACK") {
var err = new Error(str);
self.handleMessage(err);
} else if (OK_MPD.test(line)) {
self.setupIdling();
} else {
self.handleMessage(null, msg);
}
self.buffer = self.buffer.substring(msg.length + line.length + 1);
}
var bufferInt = utils.stringToBuffer(self.buffer.toString());
var buffer = new Buffer(bufferInt);
console.log('received : ' + self.buffer.toString(),util.inspect(bufferInt));
self.owner.onData(self.buffer.toString(),buffer);
});
},
write:function(what) {
var intArray = utils.bufferFromDecString(what);
var buffer = new Buffer(intArray);
what = buffer.toString();
console.log('write xx'+what);
this.sendCommand(cmd(what,[]),function(e){
});
/*
//convert buffer from byte array string to string
this.owner.isDebug() && console.log('write '+what);
this.send(buffer);
*/
}
});
});

View File

@ -1,170 +0,0 @@
{
"inputs": [
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_NAME",
"name": "CF_DRIVER_NAME",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Display Name",
"type": 13,
"uid": "-1",
"value": "MPD6000",
"visible": true,
"changed": true,
"_active": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_ID",
"name": "CF_DRIVER_ID",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Id",
"type": 13,
"uid": "-1",
"value": "bbe1705a-b6a8-3445-cbc9-d56c6e13ec2c",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Visual",
"id": "CF_DRIVER_ICON",
"name": "CF_DRIVER_ICON",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Icon",
"type": 18,
"uid": "-1",
"value": ".\/project1\/318i.jpg",
"visible": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_CLASS",
"name": "CF_DRIVER_CLASS",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Class",
"type": 4,
"uid": "-1",
"value": ".\/MPD\/MPD6000.js",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Settings",
"id": "CommandSettings",
"name": "CF_DRIVER_COMMANDS",
"order": 1,
"params": "{\"constants\":{\"start\":\"\",\"end\":\"\"},\"send\":{\"mode\":false,\"interval\":\"300\",\"timeout\":\"500\",\"onReply\":\"\"}}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Commands",
"type": "CommandSettings",
"uid": "-1",
"value": "",
"visible": true,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Variables",
"id": "VariableSettings",
"name": "CF_DRIVER_VARIABLES",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Variables",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Responses",
"id": "ResponseSettings",
"name": "CF_DRIVER_RESPONSES",
"order": 1,
"params": "{\"start\":false,\"startString\":\"\",\"cTypeByte\":false,\"cTypePacket\":false,\"cTypeDelimiter\":true,\"cTypeCount\":false,\"delimiter\":\"0x0d\",\"count\":\"\",\"wDelimiter\":\"\\\\r\",\"wCount\":\"\"}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Responses",
"type": 13,
"uid": "-1",
"value": "",
"visible": false,
"view": true
}
]
}

View File

@ -1,79 +0,0 @@
{
"blocks": [
{
"_containsChildrenIds": [],
"id": "23ec6cb8-cb06-f8e6-01aa-c32cedfc538f",
"name": "value",
"type": "added",
"group": "processVariables",
"gui": false,
"cmd": false,
"declaredClass": "xcf.model.Variable",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"group": "basic",
"id": "9cc052bc-9c2c-265d-3ab5-2940f2aa03c2",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "listplaylists",
"name": "listplaylists",
"interval": 0,
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [],
"id": "83d19fc6-e430-a309-8f7a-226ebd609900",
"declaredClass": "xcf.model.Command",
"startup": false,
"auto": false,
"send": "status",
"name": "status",
"interval": "0",
"flags": 0,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"group": "basic"
},
{
"_containsChildrenIds": [],
"group": "basic",
"id": "9eb9b6cc-e5cc-3262-98ae-01dbc9392976",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "lsinfo",
"name": "lsinfo",
"interval": 0,
"flags": 2048,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
}
],
"variables": null
}

View File

@ -1,472 +0,0 @@
define([
"dcl/dcl",
"nxapp/protocols/Tcp",
"xide/mixins/EventedMixin",
"dojo/node!net",
"dojo/node!util",
"dojo/node!events",
"module",
"dojo/has"
], function(dcl,Tcp,EventedMixin,net,util,events,module,has){
var EventEmitter = events.EventEmitter;
var MPD_SENTINEL = /^(OK|ACK|list_OK)(.*)$/m;
var OK_MPD = /^OK MPD /;
function noop(err) {
if (err) {
this.emit('error', err);
}
}
MpdClient.Command = Command;
MpdClient.cmd = cmd;
MpdClient.parseKeyValueMessage = parseKeyValueMessage;
MpdClient.parseArrayMessage = parseArrayMessage;
function MpdClient() {
EventEmitter.call(this);
this.buffer = "";
this.msgHandlerQueue = [];
this.idling = false;
}
if(has("host-node")) {
util.inherits(MpdClient, EventEmitter);
}
var defaultConnectOpts = {
host: 'localhost',
port: 6600
};
MpdClient.connect = function(options) {
options = options || defaultConnectOpts;
var client = new MpdClient();
client.socket = net.connect(options, function() {
client.emit('connect');
});
client.socket.setEncoding('utf8');
client.socket.on('data', function(data) {
client.receive(data);
});
client.socket.on('close', function() {
client.emit('end');
});
client.socket.on('error', function(err) {
client.emit('error', err);
});
return client;
}
MpdClient.prototype.receive = function(data) {
console.log('received : ',data);
var m;
this.buffer += data;
while (m = this.buffer.match(MPD_SENTINEL)) {
var msg = this.buffer.substring(0, m.index)
, line = m[0]
, code = m[1]
, str = m[2];
if (code === "ACK") {
var err = new Error(str);
this.handleMessage(err);
} else if (OK_MPD.test(line)) {
this.setupIdling();
} else {
this.handleMessage(null, msg);
}
this.buffer = this.buffer.substring(msg.length + line.length + 1);
}
};
MpdClient.prototype.handleMessage = function(err, msg) {
var handler = this.msgHandlerQueue.shift();
handler(err, msg);
};
MpdClient.prototype.setupIdling = function() {
var self = this;
self.sendWithCallback("idle", function(err, msg) {
self.handleIdleResultsLoop(err, msg);
});
self.idling = true;
self.emit('ready');
};
MpdClient.prototype.sendCommand = function(command, callback) {
var self = this;
callback = callback || noop.bind(this);
self.send("noidle\n");
self.sendWithCallback(command, callback);
self.sendWithCallback("idle", function(err, msg) {
self.handleIdleResultsLoop(err, msg);
});
};
MpdClient.prototype.sendCommands = function(commandList, callback) {
var fullCmd = "command_list_begin\n" + commandList.join("\n") + "\ncommand_list_end";
this.sendCommand(fullCmd, callback || noop.bind(this));
};
MpdClient.prototype.handleIdleResultsLoop = function(err, msg) {
var self = this;
if (err) {
self.emit('error', err);
return;
}
self.handleIdleResults(msg);
if (self.msgHandlerQueue.length === 0) {
self.sendWithCallback("idle", function(err, msg) {
self.handleIdleResultsLoop(err, msg);
});
}
};
MpdClient.prototype.handleIdleResults = function(msg) {
var self = this;
msg.split("\n").forEach(function(system) {
if (system.length > 0) {
var name = system.substring(9);
self.emit('system-' + name);
self.emit('system', name);
}
});
};
MpdClient.prototype.sendWithCallback = function(cmd, cb) {
cb = cb || noop.bind(this);
this.msgHandlerQueue.push(cb);
this.send(cmd + "\n");
};
MpdClient.prototype.send = function(data) {
this.socket.write(data);
};
function Command(name, args) {
this.name = name;
this.args = args;
}
Command.prototype.toString = function() {
return this.name + " " + this.args.map(argEscape).join(" ");
};
function argEscape(arg){
// replace all " with \"
return '"' + arg.toString().replace(/"/g, '\\"') + '"';
}
// convenience
function cmd(name, args) {
return new Command(name, args);
}
function parseKeyValueMessage(msg) {
var result = {};
msg.split('\n').forEach(function(p){
if(p.length === 0) {
return;
}
var keyValue = p.match(/([^ ]+): (.*)/);
if (keyValue == null) {
throw new Error('Could not parse entry "' + p + '"')
}
result[keyValue[1]] = keyValue[2];
});
return result;
}
function parseArrayMessage(msg) {
var results = [];
var obj = {};
msg.split('\n').forEach(function(p) {
if(p.length === 0) {
return;
}
var keyValue = p.match(/([^ ]+): (.*)/);
if (keyValue == null) {
throw new Error('Could not parse entry "' + p + '"')
}
if (obj[keyValue[1]] !== undefined) {
results.push(obj);
obj = {};
obj[keyValue[1]] = keyValue[2];
}
else {
obj[keyValue[1]] = keyValue[2];
}
});
results.push(obj);
return results;
}
return dcl([Tcp,EventedMixin.dcl], {
/***
* Standard callback when we have a message from the device we're bound to (specified in profile).
* 1. put the message in the incoming queue, tag it as 'unread'
* 2. in case we have messages to send and we are in 'onReply' mode, trigger outgoing queue
*
* @param data {Object} : Message Struct build by the device manager
* @param data.device {Object} : Device info
* @param data.device.host {String} : The host
* @param data.device.port {String} : The host's port
* @param data.device.protocol {String} : The host's protocol
* @param data.message {String} : RAW message, untreated
*/
onMessage:function(data){
//console.log('on message : ')
},
handleMessage : function(err, msg) {
console.log('message ' +msg);
var handler = this.msgHandlerQueue.shift();
handler(err, msg);
},
sendWithCallback : function(cmd, cb) {
cb = cb || noop.bind(this);
this.msgHandlerQueue.push(cb);
this.send(cmd + "\n");
console.log('send : '+cmd);
},
setupIdling : function() {
var self = this;
self.sendWithCallback("idle", function(err, msg) {
self.handleIdleResultsLoop(err, msg);
});
self.idling = true;
self._emit('ready');
},
send:function(data){
this._socket.write(data);
},
handleIdleResults : function(msg) {
var self = this;
msg.split("\n").forEach(function(system) {
if (system.length > 0) {
var name = system.substring(9);
console.log('emit');
self._emit('system-' + name);
self._emit('system', name);
}
});
},
handleIdleResultsLoop : function(err, msg) {
var self = this;
if (err) {
self._emit('error', err);
return;
}
self.handleIdleResults(msg);
if (self.msgHandlerQueue.length === 0) {
self.sendWithCallback("idle", function(err, msg) {
self.handleIdleResultsLoop(err, msg);
});
}
},
onData:function(connection,string,buffer){
console.log('on data ' + string);
},
sendCommand :function(command, callback) {
var self = this;
callback = callback || noop.bind(this);
self.send("noidle\n");
self.sendWithCallback(command, callback);
self.sendWithCallback("idle", function(err, msg) {
self.handleIdleResultsLoop(err, msg);
});
},
connectB: function () {
console.log('connect ');
var defaultConnectOpts = {
host: 'localhost',
port: 6600
};
var client = MpdClient.connect({
port: 6600,
host: 'localhost'
});
client.on('system', function(name) {
console.log("update", name);
});
client.on('system-player', function() {
console.log('system-player : ',arguments);
client.sendCommand(cmd("status", []), function(err, msg) {
if (err) throw err;
console.log('status',msg);
});
});
return;
var self = this;
this._socket = net.connect(defaultConnectOpts, function() {
console.log('connected');
self.buffer = "";
self.msgHandlerQueue = [];
self.idling = false;
});
this._socket.setEncoding('utf8');
this._socket.on('data', function(data) {
console.log('data '+data.toString());
var m;
self.buffer += data;
while (m = self.buffer.match(MPD_SENTINEL)) {
var msg = self.buffer.substring(0, m.index)
, line = m[0]
, code = m[1]
, str = m[2];
if (code === "ACK") {
var err = new Error(str);
self.handleMessage(err);
} else if (OK_MPD.test(line)) {
self.setupIdling();
} else {
self.handleMessage(null, msg);
}
self.buffer = self.buffer.substring(msg.length + line.length + 1);
console.log('received : ' + self.buffer.toString());
}
});
},
connect2: function () {
var defaultConnectOpts = {
host: 'localhost',
port: 6600
};
/*
var client = MpdClient.connect({
port: 6600,
host: 'localhost'
});
client.on('system', function(name) {
console.log("update", name);
});
client.on('system-player', function() {
console.log('system-player : ',arguments);
client.sendCommand(cmd("status", []), function(err, msg) {
if (err) throw err;
console.log('status',msg);
});
});
return;*/
var self = this;
this._socket = net.connect(defaultConnectOpts, function() {
console.log('connected');
self.buffer = "";
self.msgHandlerQueue = [];
self.idling = false;
self._on('system-player', function() {
console.log('system player',arguments)
self.sendCommand(cmd("status", []), function(err, msg) {
if (err) throw err;
console.log(msg);
});
});
});
this._socket.setEncoding('utf8');
this._socket.on('data', function(data) {
console.log('data '+data.toString());
var m;
self.buffer += data;
while (m = self.buffer.match(MPD_SENTINEL)) {
var msg = self.buffer.substring(0, m.index)
, line = m[0]
, code = m[1]
, str = m[2];
if (code === "ACK") {
var err = new Error(str);
self.handleMessage(err);
} else if (OK_MPD.test(line)) {
self.setupIdling();
} else {
self.handleMessage(null, msg);
}
self.buffer = self.buffer.substring(msg.length + line.length + 1);
console.log('received : ' + self.buffer.toString());
}
});
},
test:function(){
//send a message :
this.sendMessage('pwon',true);//sends message to device , respecting start & end settings . forcing now!
},
onConnect:function(){
var self = this;
self._on('system-player', function() {
self.sendCommand(cmd("status", []), function(err, msg) {
if (err) throw err;
console.log(msg);
});
});
this._socket.setEncoding('utf8');
this.buffer = "";
this.msgHandlerQueue = [];
this.idling = false;
this._socket.on('data',function(data){
var m;
self.buffer += data;
while (m = self.buffer.match(MPD_SENTINEL)) {
var msg = self.buffer.substring(0, m.index)
, line = m[0]
, code = m[1]
, str = m[2];
if (code === "ACK") {
var err = new Error(str);
self.handleMessage(err);
} else if (OK_MPD.test(line)) {
self.setupIdling();
} else {
self.handleMessage(null, msg);
}
console.log('received : ' + self.buffer.toString());
self.buffer = self.buffer.substring(msg.length + line.length + 1);
}
});
}
});
});

View File

@ -1,227 +0,0 @@
define([
"dcl/dcl",
"nxapp/protocols/Tcp",
"xide/mixins/EventedMixin",
"dojo/node!net",
"dojo/node!util",
"dojo/node!events",
"dojo/has",
"xide/utils"
], function(dcl,Tcp,EventedMixin,net,util,events,has,utils){
var EventEmitter = events.EventEmitter;
var MPD_SENTINEL = /^(OK|ACK|list_OK)(.*)$/m;
var OK_MPD = /^OK MPD /;
function noop(err) {
if (err) {
this.emit('error', err);
}
}
function Command(name, args) {
this.name = name;
this.args = args;
}
Command.prototype.toString = function() {
return this.name + " " + this.args.map(argEscape).join(" ");
};
function argEscape(arg){
// replace all " with \"
return '"' + arg.toString().replace(/"/g, '\\"') + '"';
}
// convenience
function cmd(name, args) {
return new Command(name, args);
}
function parseKeyValueMessage(msg) {
var result = {};
msg.split('\n').forEach(function(p){
if(p.length === 0) {
return;
}
var keyValue = p.match(/([^ ]+): (.*)/);
if (keyValue == null) {
throw new Error('Could not parse entry "' + p + '"')
}
result[keyValue[1]] = keyValue[2];
});
return result;
}
function parseArrayMessage(msg) {
var results = [];
var obj = {};
msg.split('\n').forEach(function(p) {
if(p.length === 0) {
return;
}
var keyValue = p.match(/([^ ]+): (.*)/);
if (keyValue == null) {
throw new Error('Could not parse entry "' + p + '"')
}
if (obj[keyValue[1]] !== undefined) {
results.push(obj);
obj = {};
obj[keyValue[1]] = keyValue[2];
}
else {
obj[keyValue[1]] = keyValue[2];
}
});
results.push(obj);
return results;
}
return dcl([Tcp,EventedMixin.dcl], {
/***
* Standard callback when we have a message from the device we're bound to (specified in profile).
* 1. put the message in the incoming queue, tag it as 'unread'
* 2. in case we have messages to send and we are in 'onReply' mode, trigger outgoing queue
*
* @param data {Object} : Message Struct build by the device manager
* @param data.device {Object} : Device info
* @param data.device.host {String} : The host
* @param data.device.port {String} : The host's port
* @param data.device.protocol {String} : The host's protocol
* @param data.message {String} : RAW message, untreated
*/
onMessage:function(data){
console.log('on message : ')
},
handleMessage : function(err, msg) {
//console.log('message: ' + err,msg);
var handler = this.msgHandlerQueue.shift();
handler && handler(err, msg);
var self = this;
if(msg){
var bufferInt = utils.stringToBuffer(self.buffer.toString());
var buffer = new Buffer(bufferInt);
//console.log('handle message : ' + self.buffer.toString());
self.owner.onData(self.buffer.toString(),buffer);
}
},
sendWithCallback : function(cmd, cb) {
cb = cb || noop.bind(this);
this.msgHandlerQueue.push(cb);
this.send(cmd + "\n");
},
setupIdling : function() {
var self = this;
self.sendWithCallback("idle", function(err, msg) {
self.handleIdleResultsLoop(err, msg);
});
self.idling = true;
self._emit('ready');
},
send:function(data){
this._socket.write(data);
},
handleIdleResults : function(msg) {
var self = this;
msg.split("\n").forEach(function(system) {
if (system.length > 0) {
var name = system.substring(9);
self._emit('system-' + name);
self._emit('system', name);
}
});
},
handleIdleResultsLoop : function(err, msg) {
var self = this;
if (err) {
self._emit('error', err);
return;
}
self.handleIdleResults(msg);
if (self.msgHandlerQueue.length === 0) {
self.sendWithCallback("idle", function(err, msg) {
self.handleIdleResultsLoop(err, msg);
});
}
},
sendCommand :function(command, callback) {
console.log('send command: '+command);
var self = this;
callback = callback || noop.bind(this);
self.send("noidle\n");
self.sendWithCallback(command, callback);
self.sendWithCallback("idle", function(err, msg) {
self.handleIdleResultsLoop(err, msg);
});
},
onConnect:function(){
var self = this;
self._on('system-player', function() {
self.sendCommand(cmd("status", []), function(err, msg) {
if (err) throw err;
console.log(msg);
});
});
this._socket.setEncoding('utf8');
this.buffer = "";
this.msgHandlerQueue = [];
this.idling = false;
this._socket.on('data',function(data){
var m;
self.buffer += data;
while (m = self.buffer.match(MPD_SENTINEL)) {
var msg = self.buffer.substring(0, m.index)
, line = m[0]
, code = m[1]
, str = m[2];
if (code === "ACK") {
var err = new Error(str);
self.handleMessage(err);
} else if (OK_MPD.test(line)) {
self.setupIdling();
} else {
self.handleMessage(null, msg);
}
self.buffer = self.buffer.substring(msg.length + line.length + 1);
}
var bufferInt = utils.stringToBuffer(self.buffer.toString());
var buffer = new Buffer(bufferInt);
console.log('received : ' + self.buffer.toString(),util.inspect(bufferInt));
self.owner.onData(self.buffer.toString(),buffer);
});
},
write:function(what) {
var intArray = utils.bufferFromDecString(what);
var buffer = new Buffer(intArray);
what = buffer.toString();
this.sendCommand(what);
/*
//convert buffer from byte array string to string
var intArray = utils.bufferFromDecString(what);
var buffer = new Buffer(intArray);
what = buffer.toString();
this.owner.isDebug() && console.log('write '+what);
this.send(buffer);
*/
}
});
});

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +0,0 @@
define(["module","dcl/dcl"], function(module,dcl){
return dcl(null, {
/***
* Standard callback when we have a message from the device we're bound to (specified in profile).
* 1. put the message in the incoming queue, tag it as 'unread'
* 2. in case we have messages to send and we are in 'onReply' mode, trigger outgoing queue
*
* @param data {Object} : Message Struct build by the device manager
* @param data.device {Object} : Device info
* @param data.device.host {String} : The host
* @param data.device.port {String} : The host's port
* @param data.device.protocol {String} : The host's protocol
* @param data.message {String} : RAW message, untreated
*/
onMessage:function(data){
},
test:function(){
//send a message :
this.sendMessage('pwon',true);//sends message to device , respecting start & end settings . forcing now!
}
});
});

View File

@ -1,170 +0,0 @@
{
"inputs": [
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_NAME",
"name": "CF_DRIVER_NAME",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Display Name",
"type": 13,
"uid": "-1",
"value": "Marantz-Serial",
"visible": true,
"changed": true,
"_active": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_ID",
"name": "CF_DRIVER_ID",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Id",
"type": 13,
"uid": "-1",
"value": "ffa5d764-cb4c-e6b7-2d5e-7d0a97994dc0",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Visual",
"id": "CF_DRIVER_ICON",
"name": "CF_DRIVER_ICON",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Icon",
"type": 18,
"uid": "-1",
"value": ".\/project1\/318i.jpg",
"visible": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_CLASS",
"name": "CF_DRIVER_CLASS",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Class",
"type": 4,
"uid": "-1",
"value": ".\/Marantz\/Marantz-Serial.js",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Settings",
"id": "CommandSettings",
"name": "CF_DRIVER_COMMANDS",
"order": 1,
"params": "{\"constants\":{\"start\":\"\",\"end\":\"\"},\"send\":{\"mode\":false,\"interval\":\"300\",\"timeout\":\"500\",\"onReply\":\"\"}}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Commands",
"type": "CommandSettings",
"uid": "-1",
"value": "",
"visible": true,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Variables",
"id": "VariableSettings",
"name": "CF_DRIVER_VARIABLES",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Variables",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Responses",
"id": "ResponseSettings",
"name": "CF_DRIVER_RESPONSES",
"order": 1,
"params": "{\"start\":false,\"startString\":\"\",\"cTypeByte\":false,\"cTypePacket\":false,\"cTypeDelimiter\":true,\"cTypeCount\":false,\"delimiter\":\"0x0d\",\"count\":\"\",\"wDelimiter\":\"\\\\r\",\"wCount\":\"\"}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Responses",
"type": 13,
"uid": "-1",
"value": "",
"visible": false,
"view": true
}
]
}

View File

@ -1,72 +0,0 @@
{
"blocks": [
{
"_containsChildrenIds": [],
"name": "ping",
"group": "basic",
"id": "d50a070e-1f6e-c002-ca54-70e66ce2742b",
"declaredClass": "xcf.model.Command",
"startup": true,
"send": "PW?",
"interval": "0",
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"canDelete": true,
"order": 0,
"type": "added",
"flags": 2048,
"isCommand": false,
"allowActionOverride": true,
"__started": true
},
{
"_containsChildrenIds": [],
"id": "8915d449-e179-cf2e-2bc7-8f4afd0e85d4",
"name": "value",
"value": "8",
"type": "added",
"group": "processVariables",
"gui": false,
"cmd": false,
"declaredClass": "xcf.model.Variable",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"canDelete": true,
"order": 0,
"isCommand": false,
"allowActionOverride": true,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"name": "ping-volume",
"group": "basic",
"id": "26abaa9c-767d-3841-8422-4e1a69efc5ca",
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "MV?",
"interval": 0,
"waitForResponse": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"canDelete": true,
"order": 0,
"type": "added",
"flags": 2048,
"isCommand": false,
"allowActionOverride": true,
"__started": true
}
],
"variables": null
}

View File

@ -1,168 +0,0 @@
{
"inputs": [
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_NAME",
"name": "CF_DRIVER_NAME",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Display Name",
"type": 13,
"uid": "-1",
"value": "My Marantz",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_ID",
"name": "CF_DRIVER_ID",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Id",
"type": 13,
"uid": "-1",
"value": "235eb680-cb87-11e3-9c1a-0800200c9a66",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Visual",
"id": "CF_DRIVER_ICON",
"name": "CF_DRIVER_ICON",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Icon",
"type": 18,
"uid": "-1",
"value": ".\/project1\/318i.jpg",
"visible": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_CLASS",
"name": "CF_DRIVER_CLASS",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Class",
"type": 4,
"uid": "-1",
"value": ".\/Marantz\/MyMarantz.js",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Settings",
"id": "CommandSettings",
"name": "CF_DRIVER_COMMANDS",
"order": 1,
"params": "{\"constants\":{\"start\":\"\",\"end\":\"0x0d\"},\"send\":{\"mode\":0,\"interval\":\"100\",\"timeout\":\"10000\",\"onReply\":\"0x0d\"}}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Commands",
"type": "CommandSettings",
"uid": "-1",
"value": "",
"visible": true,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Variables",
"id": "VariableSettings",
"name": "CF_DRIVER_VARIABLES",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Variables",
"type": 13,
"uid": "-1",
"value": "[{\"title\":\"_volume\",\"type\":13,\"value\":\"var z = 2123341412523432;\\n\\nvar z212 = 13425;\\n\\nreturn this.getVariable('value');\",\"enumType\":\"VariableType\",\"gui\":\"on\",\"cmd\":false,\"save\":false,\"initialize\":\"\",\"group\":\"processVariables\",\"id\":\"d596c75b-93f3-87f9-1487-1491405df3ff\",\"declaredClass\":\"xcf.model.Variable\",\"description\":\"Temporary process variable to set 'Volume'\",\"order\":0,\"serializeMe\":true,\"enabled\":true,\"target\":\"Volume\",\"register\":true,\"renderBlockIcon\":true,\"readOnly\":false,\"shareTitle\":\"\",\"canDelete\":true,\"sharable\":false,\"_currentIndex\":0,\"_onLoaded\":false,\"beanType\":\"BLOCK\"},{\"id\":\"391db915-ffb2-f6ae-8351-2d291c3c0c9c\",\"title\":\"value\",\"value\":\"MVMAX 84\",\"type\":13,\"group\":\"processVariables\",\"gui\":false,\"cmd\":false,\"declaredClass\":\"xcf.model.Variable\",\"save\":false,\"description\":\"\",\"order\":0,\"initialize\":\"\",\"serializeMe\":true,\"enabled\":true,\"target\":\"None\",\"register\":true,\"renderBlockIcon\":true,\"readOnly\":false,\"shareTitle\":\"\",\"canDelete\":true,\"sharable\":false,\"_currentIndex\":0,\"_onLoaded\":false,\"beanType\":\"BLOCK\"},{\"title\":\"Volume\",\"type\":13,\"value\":\"MVMAX 84\",\"enumType\":\"VariableType\",\"gui\":false,\"cmd\":false,\"save\":false,\"initialize\":\"\",\"id\":\"cda85865-ebad-2eda-3fdb-e7eb9dd108fd\",\"declaredClass\":\"xcf.model.Variable\",\"description\":\"\",\"order\":0,\"serializeMe\":true,\"enabled\":true,\"target\":\"None\",\"group\":\"basicVariables\",\"register\":true,\"renderBlockIcon\":true,\"readOnly\":false,\"shareTitle\":\"\",\"canDelete\":true,\"sharable\":false,\"_currentIndex\":0,\"_onLoaded\":false,\"beanType\":\"BLOCK\"},{\"title\":\"PowerState\",\"type\":13,\"value\":\"Off2\",\"enumType\":\"VariableType\",\"gui\":false,\"cmd\":false,\"save\":false,\"initialize\":\"\",\"id\":\"7b9d2d12-0174-fdd4-2b31-a2bb8034f236\",\"declaredClass\":\"xcf.model.Variable\",\"description\":\"\",\"order\":0,\"serializeMe\":true,\"enabled\":true,\"target\":\"None\",\"group\":\"basicVariables\",\"register\":true,\"renderBlockIcon\":true,\"readOnly\":false,\"shareTitle\":\"\",\"canDelete\":true,\"sharable\":false,\"_currentIndex\":0,\"_onLoaded\":false,\"beanType\":\"BLOCK\"},{\"value\":\"proto-1\",\"title\":\"ProtocolVariable-1\",\"group\":\"basicVariables\",\"id\":\"ec6f5b9e-5abd-a187-0e3c-2bc5b083260e\",\"declaredClass\":\"xcf.model.Variable\",\"gui\":\"off\",\"cmd\":\"off\",\"save\":false,\"target\":\"None\",\"register\":true,\"readOnly\":false,\"enabled\":true,\"serializeMe\":true,\"shareTitle\":\"\",\"description\":\"No Description\",\"canDelete\":true,\"renderBlockIcon\":true,\"order\":0,\"_destroyed\":true,\"sharable\":false,\"_currentIndex\":0,\"_onLoaded\":false,\"beanType\":\"BLOCK\"}]",
"visible": false,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Responses",
"id": "ResponseSettings",
"name": "CF_DRIVER_RESPONSES",
"order": 1,
"params": "{\"start\":false,\"startString\":\"\",\"cTypeByte\":false,\"cTypePacket\":false,\"cTypeDelimiter\":1,\"cTypeCount\":false,\"delimiter\":\"0x0d\",\"count\":\"\",\"wDelimiter\":\"\\\\r\",\"wCount\":\"\"}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Responses",
"type": 13,
"uid": "-1",
"value": "",
"visible": false,
"view": true
}
]
}

View File

@ -1,822 +0,0 @@
{
"blocks": [
{
"_containsChildrenIds": [],
"id": "83de87c0-f8c7-74da-161d-8e9cf51d67b1",
"name": "value",
"type": "added",
"group": "processVariables",
"gui": false,
"cmd": false,
"declaredClass": "xcf.model.Variable",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0,
"isVariable": true,
"flags": 4096,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"name": "Set TV",
"group": "basic",
"id": "3ed330bb-700e-c76b-62e2-0c56c69027f3",
"send": "SITV",
"waitForResponse": false,
"type": "added",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": 0,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [
"items"
],
"name": "PowerOn",
"send": "PWON",
"group": "basic",
"id": "53a10527-709b-4c7d-7a90-37f58f17c8db",
"auto": false,
"type": "added",
"icon": "text-success fa-circle",
"interval": "0",
"waitForResponse": false,
"items": [
"68f4c183-ef18-cb55-8eb2-da850900c9e8"
],
"declaredClass": "xcf.model.Command",
"startup": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [],
"name": "Volume",
"type": "added",
"value": 42,
"enumType": "VariableType",
"initialize": "",
"group": "basicVariables",
"id": "3403a69e-252a-30dc-b130-40a028d1cde4",
"icon": "fa-automobile",
"save": false,
"register": true,
"readOnly": false,
"declaredClass": "xcf.model.Variable",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"gui": "off",
"cmd": "off",
"target": "None",
"outlet": 0,
"isVariable": true,
"flags": 4096
},
{
"_containsChildrenIds": [],
"name": "PowerOff",
"send": "PWSTANDBY",
"group": "basic",
"id": "84961334-9cd2-d384-25dc-a6b943e8cb8e",
"auto": false,
"type": "added",
"icon": "text-danger fa-power-off",
"interval": "",
"waitForResponse": false,
"declaredClass": "xcf.model.Command",
"startup": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [],
"name": "VolumeUp",
"send": "return 'MV' + (this.getVariable('Volume') +2);",
"group": "basic",
"id": "6d0c5e0e-5c04-bb98-44a0-705c8269de07",
"auto": "-1",
"type": "added",
"icon": "fa-arrow-up",
"interval": "0",
"waitForResponse": false,
"declaredClass": "xcf.model.Command",
"startup": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [
"items"
],
"name": "Fade-Volume-Down",
"group": "conditional",
"id": "1f969cc6-89c4-f559-e824-daf7dfff35cf",
"items": [
"c6bc0ef4-5b85-b543-4df7-3c00dd73a9eb"
],
"type": "added",
"waitForResponse": false,
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "",
"interval": 0,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [
"items"
],
"condition": "[Volume]>20",
"parentId": "1f969cc6-89c4-f559-e824-daf7dfff35cf",
"id": "c6bc0ef4-5b85-b543-4df7-3c00dd73a9eb",
"wait": "10",
"description": "No Description<br><br>sdfsdf",
"type": "added",
"items": [
"0caac742-956e-de6b-6b53-36fb8174e5e0"
],
"declaredClass": "xblox.model.loops.WhileBlock",
"loopLimit": 1500,
"name": "While",
"icon": "",
"enabled": true,
"shareTitle": "",
"order": 0,
"outlet": 0
},
{
"_containsChildrenIds": [
"items"
],
"name": "Fade-Volume-Up",
"group": "conditional",
"id": "48a83acf-f2ef-ccdf-44a7-621fb635e3c4",
"interval": "0",
"type": "added",
"items": [
"0a561903-9422-f97d-8a76-0757177a7471"
],
"waitForResponse": false,
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "",
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [
"items"
],
"condition": "[Volume]<80",
"parentId": "48a83acf-f2ef-ccdf-44a7-621fb635e3c4",
"id": "0a561903-9422-f97d-8a76-0757177a7471",
"wait": "10",
"type": "added",
"items": [
"660a553b-ff5d-ca79-c114-955800c8de76"
],
"declaredClass": "xblox.model.loops.WhileBlock",
"loopLimit": 1500,
"name": "While",
"icon": "",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0
},
{
"_containsChildrenIds": [],
"name": "PowerState",
"send": "nada",
"group": "basicVariables",
"id": "31c98cdd-02a8-3af1-3a49-11955c0fad48",
"type": "added",
"value": "on",
"declaredClass": "xcf.model.Variable",
"gui": "off",
"cmd": "off",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0,
"isVariable": true,
"flags": 4096,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"name": "VolumeDown",
"send": "return 'MV' + (this.getVariable('Volume') - 2);",
"group": "basic",
"id": "69f6d4fb-4300-0498-9bbf-27554f5f1fa4",
"auto": "-1",
"type": "added",
"icon": "fa-arrow-down",
"interval": "0",
"waitForResponse": false,
"declaredClass": "xcf.model.Command",
"startup": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [],
"name": "VolumeNormal",
"send": "MV35",
"group": "basic",
"id": "963944c2-c0b0-fe8a-504e-1b8bedd2a3cf",
"auto": false,
"type": "added",
"interval": "2000",
"waitForResponse": false,
"declaredClass": "xcf.model.Command",
"startup": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"flags": 2048,
"outlet": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"group": "conditionalProcess",
"id": "007e54b9-9d9a-df86-4693-9ea627443700",
"method": "console.log('run script2 ' + arguments[0]);",
"enabled": false,
"type": "added",
"declaredClass": "xblox.model.code.RunScript",
"name": "Run Script",
"args": "",
"deferred": false,
"icon": "fa-code",
"shareTitle": "",
"order": 0,
"outlet": 0,
"description": "No Description"
},
{
"_containsChildrenIds": [],
"name": "Volume-Loud",
"group": "basicVariables",
"id": "b16bfc09-e449-d514-dc98-10b8afbb14f8",
"value": "61",
"type": "added",
"declaredClass": "xcf.model.Variable",
"gui": "off",
"cmd": "off",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0,
"isVariable": true,
"flags": 4096,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"name": "Test",
"group": "basicVariables",
"id": "487b9e80-ca4c-c096-0950-91aad9dd4612",
"value": "return [Volume] + 2;",
"type": "added",
"declaredClass": "xcf.model.Variable",
"gui": "off",
"cmd": "off",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0,
"isVariable": true,
"flags": 4096,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"condition": "",
"parentId": "c6bc0ef4-5b85-b543-4df7-3c00dd73a9eb",
"id": "0caac742-956e-de6b-6b53-36fb8174e5e0",
"command": "69f6d4fb-4300-0498-9bbf-27554f5f1fa4",
"type": "added",
"declaredClass": "xblox.model.functions.CallBlock",
"icon": "",
"_timeout": 100,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0,
"startup": false,
"send": "",
"name": "No Title",
"interval": 0,
"flags": 2048
},
{
"_containsChildrenIds": [],
"condition": "",
"parentId": "0a561903-9422-f97d-8a76-0757177a7471",
"id": "660a553b-ff5d-ca79-c114-955800c8de76",
"command": "6d0c5e0e-5c04-bb98-44a0-705c8269de07",
"type": "added",
"declaredClass": "xblox.model.functions.CallBlock",
"icon": "",
"_timeout": 100,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0,
"startup": false,
"send": "",
"name": "No Title",
"interval": 0,
"flags": 2048
},
{
"_containsChildrenIds": [],
"name": "Set Master Volume",
"group": "basic",
"id": "ad01c68d-cdbb-7ba7-0046-c9f4c9113f4b",
"send": "return \"MV \" + [Volume];",
"interval": "0",
"waitForResponse": false,
"type": "added",
"declaredClass": "xcf.model.Command",
"startup": false,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [
"items"
],
"group": "init",
"id": "79fcb092-2465-6561-c1f7-4ceb81bee04a",
"event": "onDriverVariableChanged",
"enabled": false,
"type": "added",
"filterValue": "Volume",
"items": [
"8c824b5b-8daf-0290-8b88-2a268da926ad"
],
"reference": "",
"declaredClass": "xblox.model.events.OnEvent",
"name": "On Event",
"shareTitle": "",
"description": "No Description",
"order": 0,
"filterPath": "item.name",
"valuePath": "item.value",
"outlet": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"parentId": "79fcb092-2465-6561-c1f7-4ceb81bee04a",
"id": "8c824b5b-8daf-0290-8b88-2a268da926ad",
"method": "console.log(\"variable changed\" ,arguments[0]);",
"enabled": false,
"type": "added",
"declaredClass": "xblox.model.code.RunScript",
"name": "Run Script",
"args": "",
"deferred": false,
"icon": "fa-code",
"shareTitle": "",
"order": 0,
"description": "No Description",
"outlet": 0
},
{
"_containsChildrenIds": [],
"name": "Source",
"group": "basicVariables",
"id": "a95618a6-93b3-de15-6eec-2893e2eb2527",
"value": "BD",
"type": "added",
"declaredClass": "xcf.model.Variable",
"gui": "off",
"cmd": "off",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0,
"isVariable": true,
"flags": 4096,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"name": "Ping - Volume",
"group": "basic",
"id": "dec01610-0355-f038-71c8-a46b2cde5fd2",
"send": "MV?",
"interval": "",
"waitForResponse": false,
"type": "added",
"auto": false,
"startup": true,
"declaredClass": "xcf.model.Command",
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [],
"name": "Ping - Power",
"group": "basic",
"id": "a5423bf7-7b99-023d-c637-363fbf9a7f18",
"startup": true,
"send": "PW?",
"interval": "",
"waitForResponse": false,
"icon": "fa-bell",
"type": "added",
"auto": false,
"declaredClass": "xcf.model.Command",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [],
"name": "Ping - Source",
"group": "basic",
"id": "13bd8c70-9cf3-28c9-8c5c-315e54f3cc9d",
"send": "SI?",
"interval": "",
"waitForResponse": false,
"icon": "fa-bell",
"type": "added",
"auto": false,
"declaredClass": "xcf.model.Command",
"startup": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [],
"name": "Last Value",
"group": "basicVariables",
"id": "611b5637-dd3e-760e-dcd4-0d21faaaeeff",
"type": "added",
"declaredClass": "xcf.model.Variable",
"gui": "off",
"cmd": "off",
"save": false,
"target": "None",
"value": -1,
"register": true,
"readOnly": false,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0,
"isVariable": true,
"flags": 4096,
"icon": "fa-play"
},
{
"_containsChildrenIds": [
"items"
],
"dstField": "elseIfBlocks",
"parentId": "980b8fd2-3538-4003-85f9-7f70e2b92cb6",
"id": "e3720be6-741c-96f4-de07-7edce704264b",
"condition": "[value]=='END'",
"type": "added",
"items": [
"d99f0616-ab67-efd7-f4c1-01fa0168c1f8"
],
"name": "else if",
"declaredClass": "xblox.model.logic.ElseIfBlock",
"icon": "",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0
},
{
"_containsChildrenIds": [
"items"
],
"dstField": "elseIfBlocks",
"parentId": "980b8fd2-3538-4003-85f9-7f70e2b92cb6",
"id": "63b534b4-2607-2749-20c5-b109c9c3df3d",
"type": "added",
"items": [
"733c68ae-b22b-c40c-a215-e5a80c8f6dc3"
],
"name": "else if",
"declaredClass": "xblox.model.logic.ElseIfBlock",
"condition": "",
"icon": "",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0
},
{
"_containsChildrenIds": [
"items",
"elseIfBlocks",
"consequent"
],
"group": "conditionalProcess",
"condition": "return [value]=='PW';",
"id": "980b8fd2-3538-4003-85f9-7f70e2b92cb6",
"items": [
"e3720be6-741c-96f4-de07-7edce704264b",
"63b534b4-2607-2749-20c5-b109c9c3df3d"
],
"enabled": false,
"type": "added",
"elseIfBlocks": [
"e3720be6-741c-96f4-de07-7edce704264b",
"63b534b4-2607-2749-20c5-b109c9c3df3d"
],
"declaredClass": "xblox.model.logic.IfBlock",
"name": "if",
"icon": "",
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0,
"consequent": [
"b45e388f-bfa9-9472-c93c-aa3f101e3a80"
]
},
{
"_containsChildrenIds": [],
"id": "d99f0616-ab67-efd7-f4c1-01fa0168c1f8",
"enabled": false,
"type": "added",
"parentId": "e3720be6-741c-96f4-de07-7edce704264b",
"declaredClass": "xblox.model.logging.Log",
"name": "Log Message",
"level": "info",
"message": "return \"Message: \" + arguments[0];",
"_type": "XBlox",
"host": "this host",
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"id": "733c68ae-b22b-c40c-a215-e5a80c8f6dc3",
"enabled": false,
"type": "added",
"parentId": "63b534b4-2607-2749-20c5-b109c9c3df3d",
"declaredClass": "xblox.model.logging.Log",
"name": "Log Message",
"level": "info",
"message": "return \"Message: \" + arguments[0];",
"_type": "XBlox",
"host": "this host",
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"id": "b45e388f-bfa9-9472-c93c-aa3f101e3a80",
"enabled": false,
"type": "added",
"parentId": "980b8fd2-3538-4003-85f9-7f70e2b92cb6",
"declaredClass": "xblox.model.logging.Log",
"name": "Log Message",
"level": "info",
"message": "return \"Message: \" + arguments[0];",
"_type": "XBlox",
"host": "this host",
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0,
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"name": "Set TV",
"group": "basic",
"id": "e4d05d14-1798-a168-e984-8588d7463b75",
"send": "SITV",
"waitForResponse": false,
"type": "added",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": 0,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [],
"group": "init",
"id": "ee4d83cc-b3a4-c2eb-9f32-344fb476d646",
"send": "PW?",
"name": "PingPower",
"type": "added",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": 0,
"flags": 2048,
"icon": "fa-exclamation",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0
},
{
"_containsChildrenIds": [
"items"
],
"group": "init",
"id": "e63cba29-0cf3-7839-a631-75fb9424ab8e",
"send": "MV?",
"name": "PingVolume",
"interval": "0",
"type": "added",
"items": [
"7a0bc101-6a7e-1de5-7dab-bc787953022a"
],
"declaredClass": "xcf.model.Command",
"startup": false,
"flags": 2048,
"icon": "fa-exclamation",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0
},
{
"_containsChildrenIds": [],
"parentId": "e63cba29-0cf3-7839-a631-75fb9424ab8e",
"id": "7a0bc101-6a7e-1de5-7dab-bc787953022a",
"method": "console.error('init');",
"type": "added",
"declaredClass": "xblox.model.code.RunScript",
"name": "Run Script",
"args": "",
"deferred": false,
"icon": "fa-code",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"description": "No Description"
},
{
"_containsChildrenIds": [],
"name": "Set Blue-Ray",
"id": "c9bc7af6-0de9-0aa7-e6de-6a635cd50ea7",
"send": "SIBD",
"waitForResponse": false,
"type": "added",
"group": "basic",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": 0,
"icon": "fa-exclamation",
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"flags": 2048,
"outlet": 0
},
{
"_containsChildrenIds": [],
"group": "conditionalProcess",
"id": "43062d7e-6cfd-040c-34bf-7a01c428c057",
"variable": "31c98cdd-02a8-3af1-3a49-11955c0fad48",
"enabled": false,
"type": "added",
"_stopped": false,
"declaredClass": "xblox.model.variables.VariableSwitch",
"name": "Switch on Variable",
"icon": "",
"shareTitle": "",
"description": "No Description",
"order": 0,
"outlet": 0
},
{
"_containsChildrenIds": [],
"condition": "",
"parentId": "53a10527-709b-4c7d-7a90-37f58f17c8db",
"id": "68f4c183-ef18-cb55-8eb2-da850900c9e8",
"declaredClass": "xblox.model.functions.CallBlock",
"command": "command://deviceScope=user_devices&device=fa2b4417-50b5-e74f-e5c1-75c3e7c839f1&driver=8fec6dd4-f647-291d-0a9b-27eea266f6d0&driverScope=user_drivers&block=0c7d9511-eb8c-3f26-b5f9-14669497c862",
"icon": "",
"_timeout": 100,
"startup": false,
"send": "",
"name": "No Title",
"interval": 0,
"flags": 2048,
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"type": "added"
}
],
"variables": null
}

View File

@ -1,270 +0,0 @@
define([
"dcl/dcl",
"xcf/model/Command",
'xide/utils',
'xide/types',
'xdojo/has',
"xdojo/has!host-node?nxapp/protocols/ProtocolBase"
], function (dcl,Command,utils,types,has,ProtocolBase) {
// The returning module
var Module = dcl(null, {
updatePower: function (value) {
value = value || this.getVariable('value');
var out = 0;
if (value.indexOf('@PWR:') != -1) {
var _pw = value.split(':')[1];
if (!isNaN(_pw)) {
this.setVariable('PowerState', _pw == 2 ? 'on' : 'off');
out = _pw;
}
}
return out;
},
updateSource: function (value) {
value = value || this.getVariable('value');
if (value.startsWith('SI') && value.indexOf("@") ==-1 && value.length>2) {
var _source = value.substring(2, value.length);
this.setVariable('Source', _source);
}
},
updateVolume: function (value) {
value = value || this.getVariable('value') || "";
var out = 0;
if (value.indexOf('MV') != -1 && value.indexOf('MVMAX') == -1) {
var _volume = value.substring(2, value.length);
_volume = parseInt(_volume.substring(0, 2),10);
if (!isNaN(_volume)) {
this.setVariable('Volume', _volume);
out = _volume;
} else {
return null;
}
} else {
return null;
}
return out;
},
testx: function (arg) {
console.log('testx');
return "mv?";
},
testCall: function (test) {
var value = this.callCommand('PowerOn');
},
onMessage: function (data) {
var message = data.message || "";
if(!message || !message.length){
return;
}
this.updateVolume(message);
this.updatePower(message);
this.updateSource(message);
if (data.message.indexOf('MVMAX') != -1) {
return;
}
},
onDriverVariableChanged:function(evt){
//grab the variable
var variable = evt.item;
//grab the xblox scope
var blockScope = variable.scope;
//abort if is not ours, we also receive here variable changes from other devices
// notice: we use != instead of !==
// this is because we compare 2 object pointers and not two primitive's values
if(blockScope != this.blockScope){
return;
}
//Example: make some special effort for variable "Volume"
//if(variable.name ==="Volume"){
//console.info("Volume changed : " + variable.value);
//}
//Example: abort if it is not a certain variable
if(variable.name !=="value"){
//console.warn("skip variable " + variable.name);
return;
}
//Example: print something in console
//console.log('onDriverVariableChanged ' + variable.name + ' new value:' + variable.value);
//Example: do something with the variable
var value = "" + variable.value; //important, build a new string
value++;
//Example: call a command
if(value ==='whatever'){
this.callCommand("Command Name");
}
//Example: store it in another variable
if(value ==='whatever'){
this.setVariable("the other variable's name ",value);
}
},
/**
* This function is called as soon the device is connected
*/
start:function(){
//some debugging message
//console.log('started Marantz',this);
//Example: we subscribe on variable changes, globally
this.subscribe("onDriverVariableChanged");
//Example, specify the event handler explizit
//this.subscribe("onDriverVariableChanged",this.onDriverVariableChanged);
}
});
//////////////////////////////////////////////////////////
//
// Constants
//
var isServer = has('host-node'); // We are running server-side ?
var isIDE = has('xcf-ui'); // We are running client-side and in the IDE?
function patchModule(){
Module.getFields = function (command, fields) {
var result = [];
if(command._gpioFunc === 'setMode') {
command._value = command._value || 1;
result.push(utils.createCI('test', types.ECIType.STRING, command._gpio, {
group: 'GPIO',
title: 'Value',
dst: '_gpio',
order: 199
}));
}
return result;
};
/**
*
* @param label
* @param icon
* @param ctrAgs
* @param variables
* @param send
* @param func
* @param description
* @param scope
* @param owner
* @param target
* @param group
*/
function createBlock(label,icon,ctrAgs,variables,send,func,description,scope, owner, target, group){
return {
name: label,
owner: owner,
icon: icon,
proto: Command,
target: target,
ctrArgs: utils.mixin({
icon:icon,
flags:0,
name:label,
scope: scope,
group: group,
variables:variables ? JSON.stringify(variables) : "{}",
send:send,
_isGPIO:true,
_gpioFunc:func,
description:description
},ctrAgs)
};
}
/**
* Extend xblox for new blocks/commands.
* @param scope
* @param owner
* @param target
* @param group
* @param items
* @returns {*}
*/
Module.getNewBlocks=function(scope, owner, target, group, items){
if(!items){
return null;
}
items.push({
name: 'Marantz',
iconClass: 'fa-code',
items: [
createBlock('Set Input','fa-cogs',null,
{ 'GPIO': '_gpio'},
"SI {{GPIO}}","setMode",
"Sets the GPIO mode",
scope,owner,target,group)
]
});
return items;
};
/**
* Override interface for "toText"
* @param command
* @param text
* @returns {*}
*/
Module.toText = function (command, text) {
if(!command._isGPIO){
return;
}
if(command.variables){
var commandVariables = utils.fromJson(command.variables);
var variables = {};
for(var variable in commandVariables){
variables[variable]=command[commandVariables[variable]] || " ";
}
text = utils.replace(text,null,variables,{
begin:'{{',
end:'}}'
});
return text;
}
};
Module.resolveAfter = function (command,inputString) {
if(!command._isGPIO){
return;
}
if(command.variables){
var commandVariables = utils.fromJson(command.variables);
var variables = {};
for(var variable in commandVariables){
variables[variable]=command._resolve(command[commandVariables[variable]],{
flags:0x00000800
},false);
}
inputString = utils.replace(inputString,null,variables,{
begin:'{{',
end:'}}'
});
}
return inputString;
};
}
//No ProtocolBase means we're running on client side
if (!ProtocolBase) {
//create dummy module
//Module = dcl(null, {});
patchModule();
return Module;
}
patchModule();
return Module;
});

View File

@ -1,97 +0,0 @@
/** @module xcf/driver/DefaultDriver */
define([
"dcl/dcl",
'xdojo/has',
'xide/utils'
], function (dcl, has, utils) {
// The returning module
var Module = null;
//////////////////////////////////////////////////////////
//
// Constants
//
var isServer = has('host-node'); // We are running server-side ?
var isIDE = has('xcf-ui'); // We are running client-side and in the IDE?
/**
* Default driver template. This will used for new drivers!
*
* @class module:xcf/driver/DefaultDriver
* @extends module:xcf/driver/DriverBase
* @augments module:xide/mixins/EventedMixin
* @link http://rawgit.com/net-commander/windows-dist/master/docs/Driver/modules/module-xcf_driver_DriverBase.html
*/
Module = dcl(null, {
/***
* Standard callback when we have a message from the device we're bound to (specified in profile).
* 1. put the message in the incoming queue, tag it as 'unread'
* 2. in case we have messages to send and we are in 'onReply' mode, trigger outgoing queue
*
* @param data {Object} : Message Struct build by the device manager
* @param data.device {Object} : Device info
* @param data.device.host {String} : The host
* @param data.device.port {String} : The host's port
* @param data.device.protocol {String} : The host's protocol
* @param data.message {String} : RAW message, untreated
*/
//onMessage: function (data) {}
});
//////////////////////////////////////////////////////////
//
// Optional: An example implementation to extend commands in the interface for additional fields
//
if (isIDE) {
/**
*
* @param command {module:xcf/model/Command} The command which for which want to populate the fields.
* @param fields {Object[]}
* @link http://rawgit.com/net-commander/windows-dist/master/docs/Driver/modules/xcf_model_Command.js.html
*/
Module.getFields = function (command, fields) {
/*
return [utils.createCI('test', 0, command.test, {
group: 'General',
title: 'test',
dst: 'test',
order: 198
})];
*/
return [];
};
}
//////////////////////////////////////////////////////////
//
// Optional: An example implementation to modify the string sent to a advice. This makes sense if you added additional fields as shown above.
//
/**
* Callback when a command is before parsing the expression in the "send" field.
* @param command {module:xcf/model/Command}
* @param inputString {string}
* @returns {string}
*/
/*
Module.resolveBefore = function (command,inputString) {
return inputString;
};
*/
/**
* Callback when a command was parsing the expression in the "send" field.
* @param command {module:xcf/model/Command}
* @param inputString {string}
* @returns {string}
*/
/*
Module.resolveAfter = function (command,inputString) {
return inputString;
};
*/
return Module;
});

View File

@ -1,168 +0,0 @@
{
"inputs": [
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_NAME",
"name": "CF_DRIVER_NAME",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Display Name",
"type": 13,
"uid": "-1",
"value": "Motion-Eye-MQTT",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_ID",
"name": "CF_DRIVER_ID",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Id",
"type": 13,
"uid": "-1",
"value": "69e4469f-f2a8-3c22-e973-49380c22f600",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Visual",
"id": "CF_DRIVER_ICON",
"name": "CF_DRIVER_ICON",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Icon",
"type": 18,
"uid": "-1",
"value": "./project1/318i.jpg",
"visible": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_CLASS",
"name": "CF_DRIVER_CLASS",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Class",
"type": 4,
"uid": "-1",
"value": "./Motion-Eye/Motion-Eye-MQTT.js",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Settings",
"id": "CommandSettings",
"name": "CF_DRIVER_COMMANDS",
"order": 1,
"params": "{\"constants\":{\"start\":\"\",\"end\":\"\"},\"send\":{\"mode\":false,\"interval\":\"300\",\"timeout\":\"500\",\"onReply\":\"\"}}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Commands",
"type": "CommandSettings",
"uid": "-1",
"value": "[]",
"visible": true,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Variables",
"id": "VariableSettings",
"name": "CF_DRIVER_VARIABLES",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Variables",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Responses",
"id": "ResponseSettings",
"name": "CF_DRIVER_RESPONSES",
"order": 1,
"params": "{\"start\":false,\"startString\":\"\",\"cTypeByte\":false,\"cTypePacket\":false,\"cTypeDelimiter\":true,\"cTypeCount\":false,\"delimiter\":\"\\\\r\",\"count\":\"\",\"wDelimiter\":\"\\\\r\",\"wCount\":\"\"}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Responses",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
}
]
}

View File

@ -1,171 +0,0 @@
{
"blocks": [
{
"_containsChildrenIds": [],
"id": "ff612a70-4b0c-a0bb-e4ed-a3da1715fffc",
"name": "value",
"value": "",
"type": "added",
"group": "processVariables",
"gui": false,
"cmd": false,
"declaredClass": "xcf.model.Variable",
"save": false,
"target": "None",
"register": true,
"readOnly": false,
"isVariable": true,
"flags": 4096,
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"icon": "fa-play"
},
{
"_containsChildrenIds": [
"items"
],
"id": "c621527a-d3e0-1db8-50ff-735adcaad462",
"items": [
"d3a4572a-7a40-33da-7ef6-f51e565e3704",
"7c4cd1c9-8a9e-d862-6707-4b34b1ba16fa",
"4a436c03-1c4b-57a6-95c9-059c5bf0fabb",
"875b03a9-6085-0ca2-4c55-79ef7806899a"
],
"group": "init",
"declaredClass": "xblox.model.mqtt.Subscribe",
"name": "Subscribe",
"topic": "motionEye/event_start",
"args": "",
"deferred": false,
"icon": "fa-bell",
"path": "",
"qos": 0,
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"type": "added"
},
{
"_containsChildrenIds": [],
"parentId": "c621527a-d3e0-1db8-50ff-735adcaad462",
"id": "875b03a9-6085-0ca2-4c55-79ef7806899a",
"declaredClass": "xblox.model.code.RunScript",
"name": "Run Script",
"method": "console.error('motion detected');",
"args": "",
"deferred": false,
"icon": "fa-code",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"type": "added"
},
{
"_containsChildrenIds": [
"items"
],
"id": "8f7bc17d-58df-e96c-1d21-cf00b9eab2dd",
"items": [
"4aad0ce4-b62a-56cd-63d4-32ed11915784"
],
"group": "init",
"topic": "motionEye/event_stop",
"type": "added",
"declaredClass": "xblox.model.mqtt.Subscribe",
"name": "Subscribe",
"args": "",
"deferred": false,
"icon": "fa-bell",
"path": "",
"qos": 0,
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": ""
},
{
"_containsChildrenIds": [],
"parentId": "8f7bc17d-58df-e96c-1d21-cf00b9eab2dd",
"id": "4aad0ce4-b62a-56cd-63d4-32ed11915784",
"method": "console.error('motion detected stopped');",
"type": "added",
"declaredClass": "xblox.model.code.RunScript",
"name": "Run Script",
"args": "",
"deferred": false,
"icon": "fa-code",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": ""
},
{
"_containsChildrenIds": [],
"condition": "",
"parentId": "c621527a-d3e0-1db8-50ff-735adcaad462",
"id": "d3a4572a-7a40-33da-7ef6-f51e565e3704",
"declaredClass": "xblox.model.functions.CallBlock",
"command": "command://deviceScope=user_devices&device=1b53dd5c-bda3-a45b-27ea-b1adb876d729&driver=117554bc-f6ef-3442-f163-901d5d35d158&driverScope=user_drivers&block=2d2ce608-9a1f-18d6-5298-fefcd85f8bc9",
"icon": "",
"_timeout": 100,
"startup": false,
"send": "",
"name": "No Title",
"interval": 0,
"flags": 2048,
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"type": "added"
},
{
"_containsChildrenIds": [],
"condition": "",
"parentId": "c621527a-d3e0-1db8-50ff-735adcaad462",
"id": "7c4cd1c9-8a9e-d862-6707-4b34b1ba16fa",
"declaredClass": "xblox.model.functions.CallBlock",
"command": "command://deviceScope=user_devices&device=bc09b5c4-cfe6-b621-c412-407dbb7bcef8&driver=9db866a4-bb3e-137b-ae23-793b729c44f8&driverScope=user_drivers&block=450d2c75-29b0-29b7-13c5-be175b2a5749",
"icon": "",
"_timeout": 100,
"startup": false,
"send": "",
"name": "No Title",
"interval": 0,
"flags": 2048,
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"type": "added"
},
{
"_containsChildrenIds": [],
"parentId": "c621527a-d3e0-1db8-50ff-735adcaad462",
"id": "4a436c03-1c4b-57a6-95c9-059c5bf0fabb",
"declaredClass": "xblox.model.logging.Log",
"name": "Log Message",
"level": "info",
"message": "return \"Motion Detected: \" + arguments[0];",
"_type": "XBlox",
"host": "this host",
"description": "No Description",
"order": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"type": "added",
"icon": "fa-play"
}
],
"variables": null
}

View File

@ -1,685 +0,0 @@
/** @module xcf/driver/DefaultDriver */
define([
"dcl/dcl",
'xdojo/has',
'xide/utils',
"xcf/model/Command",
'xide/types',
"xdojo/has!host-node?nxapp/protocols/ProtocolBase",
"xdojo/has!host-node?dojo/node!./node_modules/pigpio",
"xdojo/has!host-node?dojo/node!yargs-parser"
], function (dcl, has, utils, Command,types,ProtocolBase, pigpio,yargs) {
// The returning module
var Module = null;
//////////////////////////////////////////////////////////
//
// Constants
//
var isServer = has('host-node'); // We are running server-side ?
var isIDE = has('xcf-ui'); // We are running client-side and in the IDE?
//No ProtocolBase means we're running on client side
if (!ProtocolBase) {
//create dummy module
Module = dcl(null, {});
patchModule();
return Module;
}
/**
* Default driver template. This will used for new drivers!
*
* @class module:xcf/driver/DefaultDriver
* @extends module:xcf/driver/DriverBase
* @augments module:xide/mixins/EventedMixin
* @link http://rawgit.com/net-commander/windows-dist/master/docs/Driver/modules/module-xcf_driver_DriverBase.html
* @link https://github.com/fivdi/pigpio/blob/master/doc/gpio.md#pwmwritedutycycle
* @link http://www.myelectronicslab.com/tutorial/raspberry-pi-3-gpio-model-b-block-pinout/
* @link http://razzpisampler.oreilly.com/ch05.html
*/
Module = dcl([ProtocolBase], {
_gpios:null,
destroy: function () {
for (var id in this._gpios){
var gpio = this._gpios[id];
gpio.disableAlert();
}
delete this._gpios;
},
/**
* Override connect since we're not really connecting to anything
*/
connect: function () {
this._gpios = {};
this.owner.onConnected();
},
/***
* Standard callback when we have a message from the device we're bound to (specified in profile).
* 1. put the message in the incoming queue, tag it as 'unread'
* 2. in case we have messages to send and we are in 'onReply' mode, trigger outgoing queue
*
* @param data {Object} : Message Struct build by the device manager
* @param data.device {Object} : Device info
* @param data.device.host {String} : The host
* @param data.device.port {String} : The host's port
* @param data.device.protocol {String} : The host's protocol
* @param data.message {String} : RAW message, untreated
*/
write: function (data, options) {
var intArray = utils.bufferFromDecString(data);
var buffer = new Buffer(intArray);
var str = data;
var args = str.split(" ");
var cmd = "" + args[0];
args.shift();
this.isDebug() && console.log('write : ' + str, args);
if (typeof this[cmd] === 'function') {
args.push(options);
try {
return this[cmd].apply(this, args);
}catch(e){
console.error('Error running '+cmd + " : " + e.message);
this._sendError({
error:e.message
},cmd,options);
}
}else{
console.warn('cmd '+cmd +' doesnt exists');
}
},
_send: function (data, command, options) {
var wait = options.params.wait;
var self = this;
var outString = JSON.stringify(utils.mixin({
command: command
}, data, null, 2));
if (wait) {
self.owner.onFinish(command, options, new Buffer(outString));
} else {
self.owner.onData(outString, new Buffer(outString));
}
},
_sendError: function (data, command, options) {
if(!options){
console.error('have no options',options);
}
if(!options.params){
console.error('have no params',options);
}
var wait = options.params.wait;
var self = this;
var outString = JSON.stringify(utils.mixin({
command: command
}, data, null, 2));
if (wait) {
self.owner.onError(command, options, new Buffer(outString));
} else {
self.owner.onData(outString, new Buffer(outString));
}
},
setMode:function(nr,mode,options){
nr = parseInt(nr,10);
mode = parseInt(mode,10);
var gpio = this.getGPIO(nr);
gpio.mode(mode);
},
digitalWrite:function(nr,value,options){
nr = parseInt(nr,10);
value = parseInt(value,10);
var gpio = this.getGPIO(nr);
gpio.digitalWrite(value);
this._send({
value:value,
gpio:nr
},'digitalWrite',options);
},
digitalRead:function(nr,options){
nr = parseInt(nr,10);
var gpio = this.getGPIO(nr);
var value = gpio.digitalRead();
this._send({
value:value,
gpio:nr
},'digitalRead',options);
},
getGPIO:function(nr){
var gpio = this._gpios[nr];
if(!gpio){
this._gpios[nr] = new pigpio.Gpio(nr);
}
return this._gpios[nr];
},
pwmWrite:function(nr,cycle,options){
nr = parseInt(nr,10);
cycle = parseInt(cycle,10);
var gpio = this.getGPIO(nr);
gpio.pwmWrite(cycle);
},
hardwarePwmWrite:function(nr,frequency,cycle,options){
nr = parseInt(nr,10);
cycle = parseInt(cycle,10);
frequency = parseInt(frequency,10);
var gpio = this.getGPIO(nr);
gpio.hardwarePwmWrite(frequency,cycle);
},
getPwmDutyCycle:function(nr,options){
nr = parseInt(nr,10);
var gpio = this.getGPIO(nr);
var value = gpio.getPwmDutyCycle();
this._send({
value:value,
gpio:nr
},'getPwmDutyCycle',options);
},
pwmRange:function(nr,range){
nr = parseInt(nr,10);
range = parseInt(range,10);
var gpio = this.getGPIO(nr);
gpio.pwmRange(range);
},
getPwmRange:function(nr,options){
nr = parseInt(nr,10);
var gpio = this.getGPIO(nr);
var value = gpio.getPwmRange();
this._send({
value:value,
gpio:nr
},'getPwmRange',options);
},
getPwmRealRange:function(nr,options){
nr = parseInt(nr,10);
var gpio = this.getGPIO(nr);
var value = gpio.getPwmRealRange();
this._send({
value:value,
gpio:nr
},'getPwmRealRange',options);
},
pwmFrequency:function(nr,frequency){
nr = parseInt(nr,10);
frequency = parseInt(frequency,10);
var gpio = this.getGPIO(nr);
gpio.pwmFrequency(frequency);
},
getPwmFrequency:function(nr,options){
nr = parseInt(nr,10);
var gpio = this.getGPIO(nr);
var value = gpio.getPwmFrequency();
this._send({
value:value,
gpio:nr
},'getPwmFrequency',options);
},
servoWrite:function(nr,pulseWidth,options){
nr = parseInt(nr, 10);
pulseWidth = parseInt(pulseWidth, 10);
var gpio = this.getGPIO(nr);
gpio.servoWrite(pulseWidth);
},
getServoPulseWidth:function(nr,options){
nr = parseInt(nr,10);
var gpio = this.getGPIO(nr);
var value = gpio.getServoPulseWidth();
this._send({
value:value,
gpio:nr
},'getServoPulseWidth',options);
},
enableInterrupt:function(nr,edge,timeout){
nr = parseInt(nr,10);
edge = parseInt(edge,10);
timeout = parseInt(timeout,10);
var gpio = this.getGPIO(nr);
gpio.enableInterrupt(edge,timeout);
},
disableInterrupt:function(nr){
nr = parseInt(nr,10);
var gpio = this.getGPIO(nr);
gpio.disableInterrupt();
},
enableAlert:function(nr,options){
nr = parseInt(nr,10);
var gpio = this.getGPIO(nr);
gpio.enableAlert();
var self = this;
gpio.on('alert',function(level,tick){
self._send({
level:level,
tick:tick,
gpio:nr
},'enableAlert',options);
});
},
disableAlert:function(nr,options){
nr = parseInt(nr,10);
var gpio = this.getGPIO(nr);
gpio.disableAlert();
},
pullUpDown:function(nr,pud){
nr = parseInt(nr,10);
pud = parseInt(pud,10);
var gpio = this.getGPIO(nr);
gpio.pullUpDown(pud);
},
trigger:function(nr,pulse,level){
nr = parseInt(nr,10);
pulse = parseInt(pulse,10);
level = parseInt(level,10);
var gpio = this.getGPIO(nr);
gpio.trigger(pulse,level);
},
init:function(){
this._gpios = {};
}
});
//////////////////////////////////////////////////////////
//
// Optional: An example implementation to extend commands in the interface for additional fields
//
function patchModule(){
Module.getFields = function (command, fields) {
var result = [];
//add a GPIO field
if(command._isGPIO) {
command._gpio = command._gpio || 17;
result.push(utils.createCI('test', types.ECIType.STRING, command._gpio, {
group: 'GPIO',
title: 'GPIO',
dst: '_gpio',
order: 197
}));
}
//add gpio mode field
if(command._gpioFunc === 'setMode') {
command._mode = command._mode || "OUTPUT";
result.push(utils.createCI('test', types.ECIType.ENUMERATION, command._mode, {
group: 'GPIO',
title: 'Mode',
dst: '_mode',
order: 198,
widget:{
options:[
{value:0,label:"INPUT"},
{value:1,label:"OUTPUT"},
{value:4,label:"ALT0"},
{value:5,label:"ALT1"},
{value:6,label:"ALT2"},
{value:7,label:"ALT3"},
{value:3,label:"ALT4"},
{value:2,label:"ALT5"}
]
}
}));
}
if(command._gpioFunc === 'digitalWrite') {
command._value = command._value || 1;
result.push(utils.createCI('test', types.ECIType.ENUMERATION, command._value, {
group: 'GPIO',
title: 'Value',
dst: '_value',
order: 199,
widget:{
options:[
{value:0,label:"0"},
{value:1,label:"1"}
]
}
}));
}
if(command._gpioFunc === 'pwmWrite') {
command._value = command._value || 1;
result.push(utils.createCI('test', types.ECIType.STRING, command._value, {
group: 'GPIO',
title: 'Value',
dst: '_value',
order: 199
}));
}
if(command._gpioFunc === 'hardwarePwmWrite') {
result.push(utils.createCI('test', types.ECIType.STRING, command._frequency, {
group: 'GPIO',
title: 'Frequency',
dst: '_frequency',
order: 199
}));
}
if(command._gpioFunc === 'servoWrite') {
result.push(utils.createCI('test', types.ECIType.STRING, command._pulse, {
group: 'GPIO',
title: 'Pulse Width',
dst: '_pulse',
order: 199
}));
}
if(command._gpioFunc === 'pwmRange') {
result.push(utils.createCI('test', types.ECIType.STRING, command._range, {
group: 'GPIO',
title: 'Range',
dst: '_range',
order: 199
}));
}
if(command._gpioFunc === 'pwmFrequency') {
result.push(utils.createCI('test', types.ECIType.STRING, command._frequency, {
group: 'GPIO',
title: 'Frequency',
dst: '_frequency',
order: 199
}));
}
if(command._gpioFunc === 'enableInterrupt') {
result.push(utils.createCI('test', types.ECIType.ENUMERATION, command._edge, {
group: 'GPIO',
title: 'Edge',
dst: '_edge',
order: 200,
widget:{
options:[
{value:0,label:"RISING_EDGE"},
{value:1,label:"FALLING_EDGE"},
{value:2,label:"EITHER_EDGE"}
]
}
}));
result.push(utils.createCI('test', types.ECIType.STRING, command._timeout, {
group: 'GPIO',
title: 'Timeout',
dst: '_timeout',
order: 201
}));
}
//add gpio mode field
if(command._gpioFunc === 'pullUpDown') {
result.push(utils.createCI('test', types.ECIType.ENUMERATION, command._pud, {
group: 'GPIO',
title: 'PUD',
dst: '_pud',
order: 199,
widget:{
options:[
{value:0,label:"PUD_OFF"},
{value:1,label:"PUD_DOWN"},
{value:2,label:"PI_PUD_UP"}
]
}
}));
}
if(command._gpioFunc === 'trigger') {
result.push(utils.createCI('test', types.ECIType.STRING, command._pulse, {
group: 'GPIO',
title: 'Pulse Length',
dst: '_pulse',
order: 199
}));
result.push(utils.createCI('test', types.ECIType.STRING, command._level, {
group: 'GPIO',
title: 'Level',
dst: '_level',
order: 199
}));
}
return result;
};
/**
*
* @param label
* @param icon
* @param ctrAgs
* @param variables
* @param send
* @param func
* @param description
* @param scope
* @param owner
* @param target
* @param group
*/
function createBlock(label,icon,ctrAgs,variables,send,func,description,scope, owner, target, group){
return {
name: label,
owner: owner,
icon: icon,
proto: Command,
target: target,
ctrArgs: utils.mixin({
icon:icon,
flags:0,
name:label,
scope: scope,
group: group,
variables:variables ? JSON.stringify(variables) : "{}",
send:send,
_isGPIO:true,
_gpioFunc:func,
description:description
},ctrAgs)
};
}
/**
* Extend xblox for new blocks/commands.
* @param scope
* @param owner
* @param target
* @param group
* @param items
* @returns {*}
*/
Module.getNewBlocks=function(scope, owner, target, group, items){
if(!items){
return null;
}
items.push({
name: 'PI-GPIO',
iconClass: 'fa-code',
items: [
createBlock('Set GPIO Mode','fa-cogs',null,
{ 'GPIO': '_gpio','GPIO_MODE': '_mode'},
"setMode {{GPIO}} {{GPIO_MODE}}","setMode",
"Sets the GPIO mode",
scope,owner,target,group),
createBlock('Digital Write','fa-send',null,
{ 'GPIO': '_gpio','GPIO_VALUE': '_value'},
"digitalWrite {{GPIO}} {{GPIO_VALUE}}","digitalWrite",
"Sets the GPIO level to 0 or 1. If PWM or servo pulses are active on the GPIO they are switched off.",
scope,owner,target,group),
createBlock('Digital Read','fa-send',null,
{ 'GPIO': '_gpio'},
"digitalRead {{GPIO}}","digitalRead",
"Returns the GPIO level",
scope,owner,target,group),
createBlock('PWM Write','fa-send',null,
{ 'GPIO': '_gpio','DUTY_CYCLE': '_value'},
"pwmWrite {{GPIO}} {{DUTY_CYCLE}}","pwmWrite",
"Starts PWM on the GPIO. Uses DMA to control and schedule the pulse lengths and duty cycles. pwmRange can be used to change the default range of 255.Parameter Duty Cycle : an unsigned integer >= 0 (off) and <= range (fully on). range defaults to 255.",
scope,owner,target,group),
createBlock('PWM Hardware Write','fa-send',null,
{ 'GPIO': '_gpio','DUTY_CYCLE': '_value', 'FREQUENCY': '_frequency'},
"hardwarePwmWrite {{GPIO}} {{FREQUENCY}} {{DUTY_CYCLE}}","hardwarePwmWrite",
"Starts hardware PWM on the GPIO at the specified frequency and dutyCycle. " +
"Frequencies above 30MHz are unlikely to work. Returns this. " +
"The actual number of steps between off and fully on is the integral part of 250 million divided by frequency. " +
"The actual frequency set is 250 million / steps. There will only be a million steps for a frequency of 250. Lower frequencies will have more steps and higher frequencies will have fewer steps. duytCycle is automatically scaled to take this into account. All models of the Raspberry Pi support hardware PWM on GPIO18.",
scope,owner,target,group),
createBlock('Get PWM Duty Cycle','fa-send',null,
{ 'GPIO': '_gpio'},
"getPwmDutyCycle {{GPIO}}","getPwmDutyCycle",
"Returns the PWM duty cycle setting on the GPIO.",
scope,owner,target,group),
createBlock('PWM Range','fa-send',null,
{ 'GPIO': '_gpio','RANGE': '_range'},
"pwmRange {{GPIO}} {{RANGE}}","pwmRange",
"Selects the duty cycle range to be used for the GPIO. " +
"Subsequent calls to pwmWrite will use a duty cycle between 0 (off) and range (fully on). If PWM is currently active on the GPIO its duty cycle will be scaled to reflect the new range." +
"<br/>Parameter Range : an unsigned integer in the range 25 through 40000",
scope,owner,target,group),
createBlock('Get PWM Range','fa-send',null,
{ 'GPIO': '_gpio'},
"getPwmRange {{GPIO}}","getPwmRange",
"Returns the duty cycle range used for the GPIO. If hardware PWM is active on the GPIO the reported range will be 1000000.",
scope,owner,target,group),
createBlock('Get PWM Real Range','fa-send',null,
{ 'GPIO': '_gpio'},
"getPwmRealRange {{GPIO}}","getPwmRealRange",
"Returns the real range used for the GPIO. If hardware PWM is active on the GPIO the reported real range will be approximately 250M divided by the set PWM frequency.",
scope,owner,target,group),
createBlock('Set PMW Frequency','fa-send',null,
{ 'GPIO': '_gpio','FREQUENCY': '_frequency'},
"pwmFrequency {{GPIO}} {{FREQUENCY}}","pwmFrequency",
"Sets the frequency in hertz to be used for the GPIO." +
"Each GPIO can be independently set to one of 18 different PWM frequencies."+
"The selectable frequencies depend upon the sample rate which may be 1, 2, 4, 5, 8, or 10 microseconds (default 5). The sample rate can be set with the configureClock function. " +
"If PWM is currently active on the GPIO it will be switched off and then back on at the new frequency.",
scope,owner,target,group),
createBlock('Get PMW Frequency','fa-send',null,
{ 'GPIO': '_gpio'},
"getPwmFrequency {{GPIO}}","getPwmFrequency",
"Returns the frequency (in hertz) used for the GPIO. The default frequency is 800Hz." +
"If hardware PWM is active on the GPIO the reported frequency will be that set by hardwarePwmWrite.",
scope,owner,target,group),
createBlock('Servo Write','fa-send',null,
{ 'GPIO': '_gpio','PULSEW': '_pulse'},
"servoWrite {{GPIO}} {{PULSEW}}","servoWrite",
"Starts servo pulses at 50Hz on the GPIO, 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise)." +
"<br/> pulseWidth - pulse width in microseconds, an unsigned integer, 0 or a number in the range 500 through 2500",
scope,owner,target,group),
createBlock('Get Servo Pulse Width','fa-send',null,
{ 'GPIO': '_gpio'},
"getServoPulseWidth {{GPIO}}","getServoPulseWidth",
"Returns the servo pulse width setting on the GPIO.",
scope,owner,target,group),
createBlock('Enable Interrupt','fa-send',null,
{ 'GPIO': '_gpio','EDGE': '_edge','TIME_OUT': '_timeout'},
"enableInterrupt {{GPIO}} {{EDGE}} {{TIMEOUT}}","enableInterrupt",
"Enables interrupts for the GPIO. Interrupts can have an optional timeout. The level argument passed to the interrupt event listener will be TIMEOUT (2) if the optional interrupt timeout expires.",
scope,owner,target,group),
createBlock('DisableInterrupt','fa-send',null,
{ 'GPIO': '_gpio'},
"disableInterrupt {{GPIO}}","disableInterrupt",
"Enables interrupts for the GPIO. Interrupts can have an optional timeout. The level argument passed to the interrupt event listener will be TIMEOUT (2) if the optional interrupt timeout expires.",
scope,owner,target,group),
createBlock('Enable Alert','fa-send',null,
{ 'GPIO': '_gpio'},
"enableAlert {{GPIO}}","enableAlert",
"Enables alerts for the GPIO. An alert event will be emitted every time the GPIO changes state." +
"Add a block of type finish to retrieve the even values.",
scope,owner,target,group),
createBlock('Disable Alert','fa-send',null,
{ 'GPIO': '_gpio'},
"disableAlert {{GPIO}}","disableAlert",
"Disables alerts for the GPIO.",
scope,owner,target,group),
createBlock('Set Pull Type ','fa-send',null,
{ 'GPIO': '_gpio','PUD': '_pud'},
"pullUpDown {{GPIO}} {{PUD}}","pullUpDown",
"Sets or clears the resistor pull type for the GPIO.",
scope,owner,target,group),
createBlock('Trigger','fa-send',null,
{ 'GPIO': '_gpio','PULSE': '_pulse','LEVEL': '_level'},
"trigger {{GPIO}} {{PULSE}} {{PULSE}}","trigger",
"Sends a trigger pulse to the GPIO. The GPIO is set to level for pulseLen microseconds and then reset to not level.",
scope,owner,target,group)
]
});
return items;
};
/**
* Override interface for "toText"
* @param command
* @param text
* @returns {*}
*/
Module.toText = function (command, text) {
if(!command._isGPIO){
return;
}
if(command.variables){
var commandVariables = utils.fromJson(command.variables);
var variables = {};
for(var variable in commandVariables){
variables[variable]=command[commandVariables[variable]] || " ";
}
text = utils.replace(text,null,variables,{
begin:'{{',
end:'}}'
});
return text;
}
};
Module.resolveAfter = function (command,inputString) {
if(!command._isGPIO){
return;
}
if(command.variables){
var commandVariables = utils.fromJson(command.variables);
var variables = {};
for(var variable in commandVariables){
variables[variable]=command._resolve(command[commandVariables[variable]],{
flags:0x00000800
},false);
}
inputString = utils.replace(inputString,null,variables,{
begin:'{{',
end:'}}'
});
}
return inputString;
};
}
patchModule();
return Module;
});

View File

@ -1,170 +0,0 @@
{
"inputs": [
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_NAME",
"name": "CF_DRIVER_NAME",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Display Name",
"type": 13,
"uid": "-1",
"value": "PI-GPIO",
"visible": true,
"changed": true,
"_active": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_ID",
"name": "CF_DRIVER_ID",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Id",
"type": 13,
"uid": "-1",
"value": "91e6a9e2-d2cd-4258-c647-3e708ce4a749",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Visual",
"id": "CF_DRIVER_ICON",
"name": "CF_DRIVER_ICON",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Icon",
"type": 18,
"uid": "-1",
"value": "./project1/318i.jpg",
"visible": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_CLASS",
"name": "CF_DRIVER_CLASS",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Class",
"type": 4,
"uid": "-1",
"value": "./Raspberry/PI-GPIO.js",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Settings",
"id": "CommandSettings",
"name": "CF_DRIVER_COMMANDS",
"order": 1,
"params": "{\"constants\":{\"start\":\"\",\"end\":\"\"},\"send\":{\"mode\":false,\"interval\":\"300\",\"timeout\":\"500\",\"onReply\":\"\"}}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Commands",
"type": "CommandSettings",
"uid": "-1",
"value": "[]",
"visible": true,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Variables",
"id": "VariableSettings",
"name": "CF_DRIVER_VARIABLES",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Variables",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Responses",
"id": "ResponseSettings",
"name": "CF_DRIVER_RESPONSES",
"order": 1,
"params": "{\"start\":false,\"startString\":\"\",\"cTypeByte\":false,\"cTypePacket\":false,\"cTypeDelimiter\":true,\"cTypeCount\":false,\"delimiter\":\"\\\\r\",\"count\":\"\",\"wDelimiter\":\"\\\\r\",\"wCount\":\"\"}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Responses",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
}
]
}

View File

@ -1,581 +0,0 @@
{
"blocks": [
{
"_containsChildrenIds": [],
"icon": "fa-cogs",
"flags": 0,
"name": "Set GPIO Mode",
"group": "basic",
"variables": "{\"GPIO\":\"_gpio\",\"GPIO_MODE\":\"_mode\"}",
"send": "setMode {{GPIO}} {{GPIO_MODE}}",
"_isGPIO": true,
"_gpioFunc": "setMode",
"description": "Sets the GPIO mode",
"id": "ebed6e03-999b-54d5-eb88-4940dbe81533",
"declaredClass": "xcf.model.Command",
"startup": true,
"interval": "0",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "17",
"_mode": "1"
},
{
"_containsChildrenIds": [],
"icon": "fa-send",
"flags": 0,
"name": "Digital Write",
"group": "basic",
"variables": "{\"GPIO\":\"_gpio\",\"GPIO_VALUE\":\"_value\"}",
"send": "digitalWrite {{GPIO}} {{GPIO_VALUE}}",
"_isGPIO": true,
"_gpioFunc": "digitalWrite",
"description": "Sets the GPIO level to 0 or 1. If PWM or servo pulses are active on the GPIO they are switched off.",
"id": "5d6c1752-b25c-8797-fe5d-e1f566bde2af",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "18",
"_value": "1"
},
{
"_containsChildrenIds": [],
"icon": "fa-send",
"flags": 0,
"name": "Digital Write",
"group": "basic",
"variables": "{\"GPIO\":\"_gpio\",\"GPIO_VALUE\":\"_value\"}",
"send": "digitalWrite {{GPIO}} {{GPIO_VALUE}}",
"_isGPIO": true,
"_gpioFunc": "digitalWrite",
"description": "Sets the GPIO level to 0 or 1. If PWM or servo pulses are active on the GPIO they are switched off.",
"id": "03439381-7f68-03cb-f617-70e03b149b97",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "18",
"_value": "0"
},
{
"_containsChildrenIds": [
"items"
],
"icon": "fa-send",
"flags": 32768,
"name": "Digital Read",
"group": "basic",
"variables": "{\"GPIO\":\"_gpio\"}",
"send": "digitalRead {{GPIO}}",
"_isGPIO": true,
"_gpioFunc": "digitalRead",
"description": "Returns the GPIO level",
"id": "c57624ed-8818-fcb6-cb2a-1356efcefc4a",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": "0",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "18",
"items": [
"0eca6275-b17b-c279-0316-477f3485925f"
]
},
{
"_containsChildrenIds": [],
"parentId": "c57624ed-8818-fcb6-cb2a-1356efcefc4a",
"id": "0eca6275-b17b-c279-0316-477f3485925f",
"declaredClass": "xblox.model.code.RunScript",
"name": "Run Script",
"method": "this.setVariable(\"GPIO - \"+arguments[0].gpio,arguments[0].value);",
"args": "",
"deferred": false,
"icon": "fa-code",
"outlet": 8,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"description": "No Description"
},
{
"_containsChildrenIds": [],
"name": "GPIO - 18",
"group": "basicVariables",
"id": "92cae109-c27a-0d8a-9aac-2eb3a1602fb4",
"declaredClass": "xcf.model.Variable",
"gui": "off",
"cmd": "off",
"save": false,
"target": "None",
"value": 0,
"register": true,
"readOnly": false,
"isVariable": true,
"flags": 4096,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"icon": "fa-play"
},
{
"_containsChildrenIds": [
"items"
],
"group": "basic",
"id": "09ef16ec-e764-906f-3ceb-cdbd90b2e110",
"items": [
"5fe48c36-18ce-6309-270a-a9a04bd64f92"
],
"declaredClass": "xcf.model.Command",
"startup": false,
"send": "",
"name": "Blink",
"interval": 0,
"flags": 2048,
"icon": "fa-exclamation",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [
"items"
],
"initial": "1",
"comparator": "<=",
"final": "5",
"modifier": "+1",
"counterName": "value",
"parentId": "09ef16ec-e764-906f-3ceb-cdbd90b2e110",
"id": "5fe48c36-18ce-6309-270a-a9a04bd64f92",
"items": [
"4e05a2c6-653f-e75f-dcf1-e6095275d854",
"f41c70d6-5d18-6c17-3e3d-f9ec34594ee3"
],
"declaredClass": "xblox.model.loops.ForBlock",
"name": "For",
"icon": "",
"ignoreErrors": false,
"_currentForIndex": 6,
"_forState": false,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [],
"icon": "fa-send",
"flags": 0,
"name": "Digital Write",
"variables": "{\"GPIO\":\"_gpio\",\"GPIO_VALUE\":\"_value\"}",
"send": "digitalWrite {{GPIO}} {{GPIO_VALUE}}",
"_isGPIO": true,
"_gpioFunc": "digitalWrite",
"description": "Sets the GPIO level to 0 or 1. If PWM or servo pulses are active on the GPIO they are switched off.",
"id": "4e05a2c6-653f-e75f-dcf1-e6095275d854",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "18",
"_value": "1",
"parentId": "5fe48c36-18ce-6309-270a-a9a04bd64f92"
},
{
"_containsChildrenIds": [],
"icon": "fa-send",
"flags": 0,
"name": "Digital Write",
"variables": "{\"GPIO\":\"_gpio\",\"GPIO_VALUE\":\"_value\"}",
"send": "digitalWrite {{GPIO}} {{GPIO_VALUE}}",
"_isGPIO": true,
"_gpioFunc": "digitalWrite",
"description": "Sets the GPIO level to 0 or 1. If PWM or servo pulses are active on the GPIO they are switched off.",
"id": "f41c70d6-5d18-6c17-3e3d-f9ec34594ee3",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "18",
"_value": "0",
"parentId": "5fe48c36-18ce-6309-270a-a9a04bd64f92"
},
{
"_containsChildrenIds": [
"items"
],
"icon": "fa-send",
"flags": 0,
"name": "Get PWM Duty Cycle",
"group": "basic",
"variables": "{\"GPIO\":\"_gpio\"}",
"send": "getPwmDutyCycle {{GPIO}}",
"_isGPIO": true,
"_gpioFunc": "pwmWrite",
"description": "Returns the PWM duty cycle setting on the GPIO.",
"id": "4afe9101-2c66-cde6-a8bc-ed7c8b2a0296",
"items": [
"5b4cc5ad-74e1-1676-6119-2879c1acc852"
],
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": "0",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "18",
"_value": "1"
},
{
"_containsChildrenIds": [],
"parentId": "4afe9101-2c66-cde6-a8bc-ed7c8b2a0296",
"id": "5b4cc5ad-74e1-1676-6119-2879c1acc852",
"declaredClass": "xblox.model.code.RunScript",
"name": "Run Script",
"method": "console.log('getPwmDutyCycle',arguments);",
"args": "",
"deferred": false,
"icon": "fa-code",
"outlet": 8,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"description": "No Description"
},
{
"_containsChildrenIds": [
"items"
],
"icon": "fa-send",
"flags": 0,
"name": "Get PWM Range",
"group": "basic",
"variables": "{\"GPIO\":\"_gpio\",\"RANGE\":\"_range\"}",
"send": "getPwmRange {{GPIO}}",
"_isGPIO": true,
"_gpioFunc": "getPwmRange",
"description": "Returns the duty cycle range used for the GPIO. If hardware PWM is active on the GPIO the reported range will be 1000000.",
"id": "ad989d6b-f8be-9da0-fe51-3f368549eaf1",
"items": [
"7c6fa262-7f74-1e76-4614-baa4ed4eed81"
],
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": 0,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "17"
},
{
"_containsChildrenIds": [],
"parentId": "ad989d6b-f8be-9da0-fe51-3f368549eaf1",
"id": "7c6fa262-7f74-1e76-4614-baa4ed4eed81",
"declaredClass": "xblox.model.code.RunScript",
"name": "Run Script",
"method": "console.log('getPwmRange',arguments);",
"args": "",
"deferred": false,
"icon": "fa-code",
"outlet": 8,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"description": "No Description"
},
{
"_containsChildrenIds": [],
"icon": "fa-send",
"flags": 0,
"name": "Servo Write",
"variables": "{\"GPIO\":\"_gpio\",\"PULSEW\":\"_pulse\"}",
"send": "servoWrite {{GPIO}} {{PULSEW}}",
"_isGPIO": true,
"_gpioFunc": "servoWrite",
"description": "Starts servo pulses at 50Hz on the GPIO, 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise).<br/> pulseWidth - pulse width in microseconds, an unsigned integer, 0 or a number in the range 500 through 2500",
"id": "a0ce241e-7bab-284e-34cc-11256518c1c7",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": "0",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "18",
"_pulse": "1300",
"group": "basic"
},
{
"_containsChildrenIds": [
"items"
],
"icon": "fa-send",
"flags": 32768,
"name": "Enable Alert",
"group": "basic",
"variables": "{\"GPIO\":\"_gpio\"}",
"send": "enableAlert {{GPIO}}",
"_isGPIO": true,
"_gpioFunc": "enableAlert",
"description": "Enables alerts for the GPIO. An alert event will be emitted every time the GPIO changes state.Add a block of type finish to retrieve the even values.",
"id": "707af144-4dea-4d2d-62a5-b3ad9bb8cc88",
"items": [
"e47d30fa-b474-323d-bd20-65f876bf1ee6"
],
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": "0",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "18"
},
{
"_containsChildrenIds": [],
"parentId": "707af144-4dea-4d2d-62a5-b3ad9bb8cc88",
"id": "e47d30fa-b474-323d-bd20-65f876bf1ee6",
"declaredClass": "xblox.model.code.RunScript",
"name": "Run Script",
"method": "console.log('alert');",
"args": "",
"deferred": false,
"icon": "fa-code",
"outlet": 8,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"description": "No Description"
},
{
"_containsChildrenIds": [
"items"
],
"group": "basic",
"id": "23a14eb0-dae0-1c7b-4c0d-fea0970f9e8c",
"items": [
"74f9dadb-0d8c-20b8-8f23-4f38a01dea50",
"5dbf7c20-5eaf-e393-4034-b0afdd6db9b1",
"14810b92-5497-771f-00e0-bab445c612ab",
"5738cbd3-6c97-39e1-74e7-e0ce08864a64"
],
"declaredClass": "xcf.model.Command",
"startup": true,
"send": "",
"name": "Servo-Test",
"interval": "0",
"flags": 2048,
"icon": "fa-exclamation",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added"
},
{
"_containsChildrenIds": [],
"icon": "fa-cogs",
"flags": 0,
"name": "Set GPIO Mode",
"variables": "{\"GPIO\":\"_gpio\",\"GPIO_MODE\":\"_mode\"}",
"send": "setMode {{GPIO}} {{GPIO_MODE}}",
"_isGPIO": true,
"_gpioFunc": "setMode",
"description": "Sets the GPIO mode",
"parentId": "23a14eb0-dae0-1c7b-4c0d-fea0970f9e8c",
"id": "74f9dadb-0d8c-20b8-8f23-4f38a01dea50",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": "0",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "18",
"_mode": "1"
},
{
"_containsChildrenIds": [],
"icon": "fa-send",
"flags": 34816,
"name": "Servo Write",
"variables": "{\"GPIO\":\"_gpio\",\"PULSEW\":\"_pulse\"}",
"send": "return \"servoWrite 18 \" + this.getVariable(\"Next Servo Pulse\");",
"_isGPIO": true,
"_gpioFunc": "servoWrite",
"description": "Starts servo pulses at 50Hz on the GPIO, 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise).<br/> pulseWidth - pulse width in microseconds, an unsigned integer, 0 or a number in the range 500 through 2500",
"parentId": "23a14eb0-dae0-1c7b-4c0d-fea0970f9e8c",
"id": "5dbf7c20-5eaf-e393-4034-b0afdd6db9b1",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": "0",
"outlet": 0,
"enabled": false,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "18",
"_pulse": "1200"
},
{
"_containsChildrenIds": [],
"name": "Next Servo Pulse",
"group": "basicVariables",
"id": "85365eb1-27f4-9f35-36f3-f94709996f0f",
"declaredClass": "xcf.model.Variable",
"gui": "off",
"cmd": "off",
"save": false,
"target": "None",
"value": "2000",
"register": true,
"readOnly": false,
"isVariable": true,
"flags": 4096,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"icon": "fa-play"
},
{
"_containsChildrenIds": [],
"icon": "fa-send",
"flags": 0,
"name": "Servo Write",
"variables": "{\"GPIO\":\"_gpio\",\"PULSEW\":\"_pulse\"}",
"send": "servoWrite {{GPIO}} {{PULSEW}}",
"_isGPIO": true,
"_gpioFunc": "servoWrite",
"description": "Starts servo pulses at 50Hz on the GPIO, 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise).<br/> pulseWidth - pulse width in microseconds, an unsigned integer, 0 or a number in the range 500 through 2500",
"parentId": "23a14eb0-dae0-1c7b-4c0d-fea0970f9e8c",
"id": "14810b92-5497-771f-00e0-bab445c612ab",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": "0",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "18",
"_pulse": "1300"
},
{
"_containsChildrenIds": [],
"icon": "fa-send",
"flags": 0,
"name": "Servo Write",
"variables": "{\"GPIO\":\"_gpio\",\"PULSEW\":\"_pulse\"}",
"send": "servoWrite {{GPIO}} {{PULSEW}}",
"_isGPIO": true,
"_gpioFunc": "servoWrite",
"description": "Starts servo pulses at 50Hz on the GPIO, 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise).<br/> pulseWidth - pulse width in microseconds, an unsigned integer, 0 or a number in the range 500 through 2500",
"id": "5738cbd3-6c97-39e1-74e7-e0ce08864a64",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": "0",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "18",
"_pulse": "[Next Servo Pulse]",
"parentId": "23a14eb0-dae0-1c7b-4c0d-fea0970f9e8c"
},
{
"_containsChildrenIds": [],
"icon": "fa-send",
"flags": 0,
"name": "Update Servo",
"group": "basic",
"variables": "{\"GPIO\":\"_gpio\",\"PULSEW\":\"_pulse\"}",
"send": "servoWrite {{GPIO}} {{PULSEW}}",
"_isGPIO": true,
"_gpioFunc": "servoWrite",
"description": "Starts servo pulses at 50Hz on the GPIO, 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise).<br/> pulseWidth - pulse width in microseconds, an unsigned integer, 0 or a number in the range 500 through 2500",
"id": "8331247f-9606-7423-f8a4-77d91c9545b9",
"declaredClass": "xcf.model.Command",
"startup": false,
"interval": "0",
"outlet": 0,
"enabled": true,
"shareTitle": "",
"order": 0,
"type": "added",
"_gpio": "18",
"_pulse": "[SERVO_SLIDER]"
},
{
"_containsChildrenIds": [],
"name": "SERVO_SLIDER",
"group": "basicVariables",
"id": "5868ef1a-cfa4-cb94-79f4-38a570458d14",
"declaredClass": "xcf.model.Variable",
"gui": "off",
"cmd": "off",
"save": false,
"target": "None",
"value": "1589",
"register": true,
"readOnly": false,
"isVariable": true,
"flags": 4096,
"outlet": 0,
"enabled": true,
"shareTitle": "",
"description": "No Description",
"order": 0,
"type": "added",
"icon": "fa-play"
}
],
"variables": null
}

View File

@ -1,101 +0,0 @@
#
CC = gcc
SIZE = size
SHLIB = gcc -shared
STRIPLIB = strip --strip-unneeded
CFLAGS += -O3 -Wall -pthread
ALL = libpigpiod_if.so libpigpiod_if2.so pigs x_pigpiod_if x_pigpiod_if2
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
includedir = $(prefix)/include
libdir = $(prefix)/lib
mandir = $(prefix)/man
all: $(ALL) pigpio.py setup.py
pigpiod_if.o: pigpiod_if.c pigpio.h command.h pigpiod_if.h
$(CC) $(CFLAGS) -fpic -c -o pigpiod_if.o pigpiod_if.c
pigpiod_if2.o: pigpiod_if2.c pigpio.h command.h pigpiod_if2.h
$(CC) $(CFLAGS) -fpic -c -o pigpiod_if2.o pigpiod_if2.c
command.o: command.c pigpio.h command.h
$(CC) $(CFLAGS) -fpic -c -o command.o command.c
pigs: command.o pigs.o
$(CC) $(CFLAGS) -fpic -o pigs pigs.c command.c
x_pigpiod_if: x_pigpiod_if.o $(LIB1)
$(CC) -o x_pigpiod_if x_pigpiod_if.o $(LL1)
x_pigpiod_if2: x_pigpiod_if2.o $(LIB2)
$(CC) -o x_pigpiod_if2 x_pigpiod_if2.o $(LL2)
clean:
rm -f *.o *.i *.s *~ $(ALL)
install: $(LIB1) $(LIB2)
install -m 0755 -d $(DESTDIR)$(includedir)
install -m 0644 pigpio.h $(DESTDIR)$(includedir)
install -m 0644 pigpiod_if.h $(DESTDIR)$(includedir)
install -m 0644 pigpiod_if2.h $(DESTDIR)$(includedir)
install -m 0755 -d $(DESTDIR)$(libdir)
install -m 0644 libpigpiod_if.so $(DESTDIR)$(libdir)
install -m 0644 libpigpiod_if2.so $(DESTDIR)$(libdir)
install -m 0755 -d $(DESTDIR)$(bindir)
install -m 0755 pigs $(DESTDIR)$(bindir)
python2 setup.py install
python3 setup.py install
install -m 0755 -d $(DESTDIR)$(mandir)/man1
install -m 0644 *.1 $(DESTDIR)$(mandir)/man1
install -m 0755 -d $(DESTDIR)$(mandir)/man3
install -m 0644 *.3 $(DESTDIR)$(mandir)/man3
uninstall:
rm -f $(DESTDIR)$(includedir)/pigpio.h
rm -f $(DESTDIR)$(includedir)/pigpiod_if.h
rm -f $(DESTDIR)$(includedir)/pigpiod_if2.h
rm -f $(DESTDIR)$(libdir)/libpigpiod_if.so
rm -f $(DESTDIR)$(libdir)/libpigpiod_if2.so
echo removing python2 files
python2 setup.py install --record /tmp/pigpio >/dev/null
xargs rm -f < /tmp/pigpio >/dev/null
echo removing python3 files
python3 setup.py install --record /tmp/pigpio >/dev/null
xargs rm -f < /tmp/pigpio >/dev/null
rm -f $(DESTDIR)$(bindir)/pigs
rm -f $(DESTDIR)$(mandir)/man1/pig*.1
rm -f $(DESTDIR)$(mandir)/man3/pig*.3
LL1 = -L. -lpigpiod_if -pthread -lrt
LL2 = -L. -lpigpiod_if2 -pthread -lrt
LIB1 = libpigpiod_if.so
OBJ1 = pigpiod_if.o command.o
LIB2 = libpigpiod_if2.so
OBJ2 = pigpiod_if2.o command.o
$(LIB1): $(OBJ1)
$(SHLIB) -o $(LIB1) $(OBJ1)
$(STRIPLIB) $(LIB1)
$(SIZE) $(LIB1)
$(LIB2): $(OBJ2)
$(SHLIB) -o $(LIB2) $(OBJ2)
$(STRIPLIB) $(LIB2)
$(SIZE) $(LIB2)
# generated using gcc -MM *.c
command.o: command.c pigpio.h command.h
pigpiod.o: pigpiod.c pigpio.h
pigpiod_if.o: pigpiod_if.c pigpio.h pigpiod_if.h command.h
pigpiod_if2.o: pigpiod_if2.c pigpio.h pigpiod_if2.h command.h
pigs.o: pigs.c pigpio.h command.h

View File

@ -1,133 +0,0 @@
#
CC = gcc
AR = ar
RANLIB = ranlib
SIZE = size
SHLIB = gcc -shared
STRIPLIB = strip --strip-unneeded
CFLAGS += -O3 -Wall -pthread
LIB1 = libpigpio.so
OBJ1 = pigpio.o command.o
LIB2 = libpigpiod_if.so
OBJ2 = pigpiod_if.o command.o
LIB3 = libpigpiod_if2.so
OBJ3 = pigpiod_if2.o command.o
LIB = $(LIB1) $(LIB2) $(LIB3)
ALL = $(LIB) x_pigpio x_pigpiod_if x_pigpiod_if2 pig2vcd pigpiod pigs
LL1 = -L. -lpigpio -pthread -lrt
LL2 = -L. -lpigpiod_if -pthread -lrt
LL3 = -L. -lpigpiod_if2 -pthread -lrt
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
includedir = $(prefix)/include
libdir = $(prefix)/lib
mandir = $(prefix)/man
all: $(ALL)
pigpio.o: pigpio.c pigpio.h command.h custom.cext
$(CC) $(CFLAGS) -fpic -c -o pigpio.o pigpio.c
pigpiod_if.o: pigpiod_if.c pigpio.h command.h pigpiod_if.h
$(CC) $(CFLAGS) -fpic -c -o pigpiod_if.o pigpiod_if.c
pigpiod_if2.o: pigpiod_if2.c pigpio.h command.h pigpiod_if2.h
$(CC) $(CFLAGS) -fpic -c -o pigpiod_if2.o pigpiod_if2.c
command.o: command.c pigpio.h command.h
$(CC) $(CFLAGS) -fpic -c -o command.o command.c
x_pigpio: x_pigpio.o $(LIB1)
$(CC) -o x_pigpio x_pigpio.o $(LL1)
x_pigpiod_if: x_pigpiod_if.o $(LIB2)
$(CC) -o x_pigpiod_if x_pigpiod_if.o $(LL2)
x_pigpiod_if2: x_pigpiod_if2.o $(LIB3)
$(CC) -o x_pigpiod_if2 x_pigpiod_if2.o $(LL3)
pigpiod: pigpiod.o $(LIB1)
$(CC) -o pigpiod pigpiod.o $(LL1)
pigs: pigs.o command.o
$(CC) -o pigs pigs.o command.o
pig2vcd: pig2vcd.o
$(CC) -o pig2vcd pig2vcd.o
clean:
rm -f *.o *.i *.s *~ $(ALL)
install: $(ALL)
install -m 0755 -d $(DESTDIR)/opt/pigpio/cgi
install -m 0755 -d $(DESTDIR)$(includedir)
install -m 0644 pigpio.h $(DESTDIR)$(includedir)
install -m 0644 pigpiod_if.h $(DESTDIR)$(includedir)
install -m 0644 pigpiod_if2.h $(DESTDIR)$(includedir)
install -m 0755 -d $(DESTDIR)$(libdir)
install -m 0755 libpigpio.so $(DESTDIR)$(libdir)
install -m 0755 libpigpiod_if.so $(DESTDIR)$(libdir)
install -m 0755 libpigpiod_if2.so $(DESTDIR)$(libdir)
install -m 0755 -d $(DESTDIR)$(bindir)
install -m 0755 -s pig2vcd $(DESTDIR)$(bindir)
install -m 0755 -s pigpiod $(DESTDIR)$(bindir)
install -m 0755 -s pigs $(DESTDIR)$(bindir)
if which python2; then python2 setup.py install; fi
if which python3; then python3 setup.py install; fi
install -m 0755 -d $(DESTDIR)$(mandir)/man1
install -m 0644 *.1 $(DESTDIR)$(mandir)/man1
install -m 0755 -d $(DESTDIR)$(mandir)/man3
install -m 0644 *.3 $(DESTDIR)$(mandir)/man3
ldconfig
uninstall:
rm -f $(DESTDIR)$(includedir)/pigpio.h
rm -f $(DESTDIR)$(includedir)/pigpiod_if.h
rm -f $(DESTDIR)$(includedir)/pigpiod_if2.h
rm -f $(DESTDIR)$(libdir)/libpigpio.so
rm -f $(DESTDIR)$(libdir)/libpigpiod_if.so
rm -f $(DESTDIR)$(libdir)/libpigpiod_if2.so
rm -f $(DESTDIR)$(bindir)/pig2vcd
rm -f $(DESTDIR)$(bindir)/pigpiod
rm -f $(DESTDIR)$(bindir)/pigs
if which python2; then python2 setup.py install --record /tmp/pigpio >/dev/null; xargs rm -f < /tmp/pigpio >/dev/null; fi
if which python3; then python3 setup.py install --record /tmp/pigpio >/dev/null; xargs rm -f < /tmp/pigpio >/dev/null; fi
rm -f $(DESTDIR)$(mandir)/man1/pig*.1
rm -f $(DESTDIR)$(mandir)/man3/pig*.3
ldconfig
$(LIB1): $(OBJ1)
$(SHLIB) -o $(LIB1) $(OBJ1)
$(STRIPLIB) $(LIB1)
$(SIZE) $(LIB1)
$(LIB2): $(OBJ2)
$(SHLIB) -o $(LIB2) $(OBJ2)
$(STRIPLIB) $(LIB2)
$(SIZE) $(LIB2)
$(LIB3): $(OBJ3)
$(SHLIB) -o $(LIB3) $(OBJ3)
$(STRIPLIB) $(LIB3)
$(SIZE) $(LIB3)
# generated using gcc -MM *.c
pig2vcd.o: pig2vcd.c pigpio.h
pigpiod.o: pigpiod.c pigpio.h
pigs.o: pigs.c pigpio.h command.h
x_pigpio.o: x_pigpio.c pigpio.h
x_pigpiod_if.o: x_pigpiod_if.c pigpiod_if.h pigpio.h
x_pigpiod_if2.o: x_pigpiod_if2.c pigpiod_if2.h pigpio.h

View File

@ -1,173 +0,0 @@
NOTE
The initial part of the make, the compilation of pigpio.c,
takes 100 seconds on early model Pis. Be patient. The overall
install takes just over 3 minutes.
INSTALL
Extract the archive to a directory.
IN THAT DIRECTORY
Enter the following two commands (in this order)
make
sudo make install
This will install
o the library (libpigpio.so) in /usr/local/lib
o the library (libpigpiod_if.so) in /usr/local/lib
o the library (libpigpiod_if2.so) in /usr/local/lib
o the header file (pigpio.h) in /usr/local/include
o the header file (pigpiod_if.h) in /usr/local/include
o the header file (pigpiod_if2.h) in /usr/local/include
o the daemon (pigpiod) in /usr/local/bin
o the socket interface (pigs) in /usr/local/bin
o the utility pig2vcd in /usr/local/bin
o man pages in /usr/local/man/man1 and /usr/local/man/man3
o the Python module pigpio.py for Python 2 and 3
TEST (optional)
*** WARNING ************************************************
* *
* All the tests make extensive use of gpio 4 (pin P1/J8-7).*
* Ensure that either nothing or just a LED is connected to *
* gpio 4 before running any of the tests. *
* *
* Some tests are statistical in nature and so may on *
* occasion fail. Repeated failures on the same test or *
* many failures in a group of tests indicate a problem. *
************************************************************
To test the library do
sudo ./x_pigpio
To test the pigpio daemon do
sudo pigpiod
./x_pigpiod_if # test the C I/F to the pigpio daemon
./x_pigpiod_if2 # test the C I/F to the pigpio daemon
./x_pigpio.py # test the Python I/F to the pigpio daemon
./x_pigs # test the socket I/F to the pigpio daemon
./x_pipe # test the pipe I/F to the pigpio daemon
EXAMPLE CODE
x_pigpio.c, pig2vcd.c, and pigpiod.c show examples of interfacing
with the pigpio library.
pigs.c, pigpio.py, x_pigpiod_if, x_pigpiod_if2.c, x_pigpio.py,
x_pigs, and x_pipe show examples of interfacing with the pigpio
daemon. x_pipe uses the pipe interface, the others use the
socket interface.
DAEMON
To launch the daemon do
sudo pigpiod (pigpiod -? for options)
Once the daemon is launched the socket and pipe interfaces will be
available.
When the library starts it locks
/var/run/pigpio.pid
The file should be automatically deleted when the library terminates.
SOCKET INTERFACE
Use pigs for the socket interface (pigs help for help).
PIPE INTERFACE
The pipe interface accepts commands written to /dev/pigpio.
Results are read from /dev/pigout.
Errors are output on /dev/pigerr.
To test the pipe interface perhaps do
cat /dev/pigout &
cat /dev/pigerr &
echo "help" >/dev/pigpio
PYTHON MODULE
The Python pigpio module is installed to the default Python location
for Python 2 and Python 3.
You can install it for additional Python versions by
pythonx.y setup.py install
where x.y is the Python version.
STOP DAEMON
To stop the pigpiod daemon
sudo killall pigpiod
RUNNING ON NON Pi's
You can access the pigpiod daemon running on the Pi from any machine which
is connected to it over the network. This access is via the socket interface.
In particular this allows you to use the following on non-Pi's.
o pigs
o the pigpio Python module
o the C socket I/F using libpigpiod_if (header file pigpiod_if.h)
o the C socket I/F using libpigpiod_if2 (header file pigpiod_if2.h)
On a Linux machine
make -f MakeRemote clean
make -f MakeRemote
make -f MakeRemote install
This will install
o the library (libpigpiod_if.so) in /usr/local/lib
o the library (libpigpiod_if2.so) in /usr/local/lib
o the header file (pigpio.h) in /usr/local/include
o the header file (pigpiod_if.h) in /usr/local/include
o the header file (pigpiod_if2.h) in /usr/local/include
o the socket interface (pigs) in /usr/local/bin
o man pages in /usr/local/man/man1 and /usr/local/man/man3
o the Python module pigpio.py
On Windows machines (and possibly Macs)
The Python module should install with
python setup.py install
pigs, pigpiod_if, and pigpiod_if2 will need minor mods to
reflect the Windows/Mac socket interface.
DOCUMENTATION
The most up to date should be http://abyz.co.uk/rpi/pigpio/
On the Pi try
man pigs
man pigpiod
man pig2vcd
man pigpio
man pigpiod_if
man pigpiod_if2
pydoc pigpio

View File

@ -1,25 +0,0 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>

View File

@ -1,122 +0,0 @@
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
*/
/*
This version is for pigpio version 56+
*/
#ifndef COMMAND_H
#define COMMAND_H
#include <stdio.h>
#include <string.h>
#include "pigpio.h"
#define CMD_MAX_PARAM 512
#define CMD_MAX_EXTENSION (1<<16)
#define CMD_UNKNOWN_CMD -1
#define CMD_BAD_PARAMETER -2
#define CMD_EXT_TOO_SMALL -3
#define CMD_P_ARR 10
#define CMD_V_ARR 10
#define CMD_NUMERIC 1
#define CMD_VAR 2
#define CMD_PAR 3
typedef struct
{
uint32_t cmd;
uint32_t p1;
uint32_t p2;
union
{
uint32_t p3;
uint32_t ext_len;
uint32_t res;
};
} cmdCmd_t;
typedef struct
{
int eaten;
int8_t opt[4];
} cmdCtlParse_t;
typedef struct
{
int cmd; /* command number */
char *name; /* command name */
int vt; /* command verification type */
int rv; /* command return value type */
} cmdInfo_t;
typedef struct
{
uint32_t tag;
int step;
} cmdTagStep_t;
typedef struct
{
uint32_t p[5];
int8_t opt[4];
} cmdInstr_t;
typedef struct
{
/*
+-----------+---------+---------+----------------+
| PARAMS... | VARS... | CMDS... | STRING AREA... |
+-----------+---------+---------+----------------+
*/
int *par;
int *var;
cmdInstr_t *instr;
int instrs;
char *str_area;
int str_area_len;
int str_area_pos;
} cmdScript_t;
extern cmdInfo_t cmdInfo[];
extern char *cmdUsage;
int cmdParse(char *buf, uint32_t *p, unsigned ext_len, char *ext, cmdCtlParse_t *ctl);
int cmdParseScript(char *script, cmdScript_t *s, int diags);
char *cmdErrStr(int error);
char *cmdStr(void);
#endif

View File

@ -1,54 +0,0 @@
/*
This version is for pigpio version 26+
If you want customised functions replace this file with your own
definitions for gpioCustom1 and gpioCustom2.
*/
#include "pigpio.h"
int gpioCustom1(unsigned arg1, unsigned arg2, char *argx, unsigned count)
{
int i;
unsigned max;
DBG(DBG_USER, "arg1=%d arg2=%d count=%d [%s]",
arg1, arg2, count, myBuf2Str(count, argx));
CHECK_INITED;
/* for dummy just return max parameter */
if (arg1 > arg2) max = arg1; else max = arg2;
for (i=0; i<count; i++) if (argx[i] > max) max = argx[i];
return max;
}
int gpioCustom2(unsigned arg1, char *argx, unsigned count,
char *retBuf, unsigned retMax)
{
int i, j, t;
DBG(DBG_USER, "arg1=%d count=%d [%s] retMax=%d",
arg1, count, myBuf2Str(count, argx), retMax);
CHECK_INITED;
/* for dummy just return argx reversed */
if (count > retMax) count = retMax;
for (i=0, j=count-1; i<=j; i++, j--)
{
/* t used as argx and retBuf may be the same buffer */
t = argx[i];
retBuf[i] = argx[j];
retBuf[j] = t;
}
return count;
}

View File

@ -1,246 +0,0 @@
." Process this file with
." groff -man -Tascii pig2vcd.1
."
.TH pig2vcd 1 2012-2015 Linux "pigpio archive"
.SH NAME
pig2vd - A utility to convert pigpio notifications to VCD.
.SH SYNOPSIS
pig2vcd </dev/pigpioXX >file.VCD
.SH DESCRIPTION
.ad l
.nh
pig2vcd is a utility which reads notifications on stdin and writes the
output as a Value Change Dump (VCD) file on stdout.
.br
.br
The VCD file can be viewed using GTKWave.
.br
.br
.SS Notifications
.br
.br
Notifications consist of 12 bytes with the following binary format.
.br
.br
.EX
typedef struct
.br
{
.br
uint16_t seqno;
.br
uint16_t flags;
.br
uint32_t tick;
.br
uint32_t level;
.br
} gpioReport_t;
.br
.EE
.br
.br
seqno: starts at 0 each time the handle is opened and then increments by one for each report.
.br
.br
flags: two flags are defined, PI_NTFY_FLAGS_WDOG and PI_NTFY_FLAGS_ALIVE. If bit 5 is set (PI_NTFY_FLAGS_WDOG) then bits 0-4 of the flags indicate a gpio which has had a watchdog timeout; if bit 6 is set (PI_NTFY_FLAGS_ALIVE) this indicates a keep alive signal on the pipe/socket and is sent once a minute in the absence of other notification activity.
.br
.br
tick: the number of microseconds since system boot. It wraps around after 1h12m.
.br
.br
level: indicates the level of each gpio. If bit 1<<x is set then gpio x is high. pig2vcd takes these notifications and outputs a text format VCD.
.br
.br
.SS VCD format
.br
.br
The VCD starts with a header.
.br
.br
.EX
$date 2013-05-31 18:49:36 $end
.br
$version pig2vcd V1 $end
.br
$timescale 1 us $end
.br
$scope module top $end
.br
$var wire 1 A 0 $end
.br
$var wire 1 B 1 $end
.br
$var wire 1 C 2 $end
.br
$var wire 1 D 3 $end
.br
$var wire 1 E 4 $end
.br
$var wire 1 F 5 $end
.br
$var wire 1 G 6 $end
.br
$var wire 1 H 7 $end
.br
$var wire 1 I 8 $end
.br
$var wire 1 J 9 $end
.br
$var wire 1 K 10 $end
.br
$var wire 1 L 11 $end
.br
$var wire 1 M 12 $end
.br
$var wire 1 N 13 $end
.br
$var wire 1 O 14 $end
.br
$var wire 1 P 15 $end
.br
$var wire 1 Q 16 $end
.br
$var wire 1 R 17 $end
.br
$var wire 1 S 18 $end
.br
$var wire 1 T 19 $end
.br
$var wire 1 U 20 $end
.br
$var wire 1 V 21 $end
.br
$var wire 1 W 22 $end
.br
$var wire 1 X 23 $end
.br
$var wire 1 Y 24 $end
.br
$var wire 1 Z 25 $end
.br
$var wire 1 a 26 $end
.br
$var wire 1 b 27 $end
.br
$var wire 1 c 28 $end
.br
$var wire 1 d 29 $end
.br
$var wire 1 e 30 $end
.br
$var wire 1 f 31 $end
.br
$upscope $end
.br
$enddefinitions $end
.br
.EE
.br
.br
The header defines gpio identifiers and their name. Each gpio identifier
must be unique. pig2vcd arbitrarily uses 'A' through 'Z' for gpios 0
through 25, and 'a' through 'f' for gpios 26 through 31.
The corresponding names are 0 through 31.
.br
.br
.br
The VCD file may be edited to give a frendlier name, e.g. 8 could be
changed to ENCODER_A if an encoder switch A is connected to gpio 8.
.br
.br
Following the header pig2vcd takes notifications and outputs a timestamp
followed by a list of one or more gpios which have changed state.
The timestamp consists of a '#' followed by the microsecond tick.
The state lines contain the new state followed by the gpio identifier.
.br
.br
.EX
#1058747
.br
0H
.br
0I
.br
#1059012
.br
1H
.br
#1079777
.br
1I
.br
#1079782
.br
0I
.br
#1079852
.br
1I
.br
#1079857
.br
0I
.br
0H
.br
#1165113
.br
1H
.br
#1165118
.br
0H
.br
#1165153
.br
1H
.br
.EE
.SH SEE ALSO
pigpiod(1), pigs(1), pigpio(3), pigpiod_if(3), pigpiod_if2(3)
.SH AUTHOR
joan@abyz.co.uk

View File

@ -1,121 +0,0 @@
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
*/
/*
This version is for pigpio version 3+
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <fcntl.h>
#include "pigpio.h"
/*
This software converts pigpio notification reports
into a VCD format understood by GTKWave.
*/
#define RS (sizeof(gpioReport_t))
static char * timeStamp()
{
static char buf[32];
struct timeval now;
struct tm tmp;
gettimeofday(&now, NULL);
localtime_r(&now.tv_sec, &tmp);
strftime(buf, sizeof(buf), "%F %T", &tmp);
return buf;
}
int symbol(int bit)
{
if (bit < 26) return ('A' + bit);
else return ('a' + bit - 26);
}
int main(int argc, char * argv[])
{
int b, r, v;
uint32_t t0;
uint32_t lastLevel, changed;
gpioReport_t report;
r=read(STDIN_FILENO, &report, RS);
if (r != RS) exit(-1);
printf("$date %s $end\n", timeStamp());
printf("$version pig2vcd V1 $end\n");
printf("$timescale 1 us $end\n");
printf("$scope module top $end\n");
for (b=0; b<32; b++)
printf("$var wire 1 %c %d $end\n", symbol(b), b);
printf("$upscope $end\n");
printf("$enddefinitions $end\n");
t0 = report.tick;
lastLevel =0;
while ((r=read(STDIN_FILENO, &report, RS)) == RS)
{
if (report.level != lastLevel)
{
printf("#%u\n", report.tick - t0);
changed = report.level ^ lastLevel;
lastLevel = report.level;
for (b=0; b<32; b++)
{
if (changed & (1<<b))
{
if (report.level & (1<<b)) v='1'; else v='0';
printf("%c%c\n", v, symbol(b));
}
}
}
}
return 0;
}

View File

@ -1,263 +0,0 @@
." Process this file with
." groff -man -Tascii pigpiod.1
."
.TH pigpiod 1 2012-2015 Linux "pigpio archive"
.SH NAME
pigpiod - A utility to start the pigpio library as a daemon.
.SH SYNOPSIS
sudo pigpiod [OPTION]...
.SH DESCRIPTION
.ad l
.nh
pigpiod is a utility which launches the pigpio library as a daemon.
.br
.br
Once launched the pigpio library runs in the background accepting commands from the pipe and socket interfaces.
.br
.br
The pigpiod utility requires sudo privileges to launch the library but thereafter the pipe and socket commands may be issued by normal users.
.br
.br
pigpiod accepts the following configuration options
.br
.br
.SH OPTIONS
.IP "\fB-a value\fP"
DMA memory allocation mode.
0=AUTO, 1=PMAP, 2=MBOX.
Default AUTO
.
.IP "\fB-b value\fP"
GPIO sample buffer size in milliseconds.
100-10000.
Default 120
.
.IP "\fB-c value\fP"
Library internal settings.
.
Default 0
.
.IP "\fB-d value\fP"
Primary DMA channel.
0-14.
Default 14
.
.IP "\fB-e value\fP"
Secondary DMA channel.
0-14.
Default 6. Preferably use one of DMA channels 0 to 6 for the secondary channel
.
.IP "\fB-f\fP"
Disable fifo interface.
.
Default enabled
.
.IP "\fB-k\fP"
Disable local and remote socket interface.
.
Default enabled
.
.IP "\fB-l\fP"
Disable remote socket interface.
.
Default enabled
.
.IP "\fB-n IP address\fP"
Allow IP address to use the socket interface.
Name (e.g. paul) or dotted quad (e.g. 192.168.1.66).
If the -n option is not used all addresses are allowed (unless overridden by the -k or -l options). Multiple -n options are allowed. If -k has been used -n has no effect. If -l has been used only -n localhost has any effect
.
.IP "\fB-p value\fP"
Socket port.
1024-32000.
Default 8888
.
.IP "\fB-s value\fP"
Sample rate.
1, 2, 4, 5, 8, or 10 microseconds.
Default 5
.
.IP "\fB-t value\fP"
Clock peripheral.
0=PWM 1=PCM.
Default PCM. pigpio uses one or both of PCM and PWM. If PCM is used then PWM is available for audio. If PWM is used then PCM is available for audio. If waves or hardware PWM are used neither PWM nor PCM will be available for audio.
.
.IP "\fB-v -V\fP"
Display pigpio version and exit.
.
.
.IP "\fB-x mask\fP"
GPIO which may be updated.
A 54 bit mask with (1<<n) set if the user may update GPIO #n.
Default is the set of user GPIO for the board revision. Use -x -1 to allow all GPIO
.
.br
.br
.SS Example
.br
.br
.EX
sudo pigpiod -s 2 -b 200 -f
.br
.EE
.br
.br
Launch the pigpio library with a sample rate of 2 microseconds and a 200 millisecond buffer. Disable the fifo interface.
.br
.br
.SS Permissions
.br
.br
pigpio provides a rudimentary permissions system for commands issued via the socket and pipe interfaces.
.br
.br
All GPIO may be read.
.br
.br
Only the user GPIO for the board type or those specified by the -x option may be updated.
.br
.br
.EX
Type 1 boards 0x03E6CF93 (26 pin header)
.br
Type 2 boards 0xFBC6CF9C (26 pin + 8 pin header)
.br
Type 3 boards 0x0FFFFFFC (40 pin header)
.br
.EE
.br
.br
In this context an update includes the following:
.br
.br
GPIO mode set
.br
GPIO pull/up down
.br
GPIO write
.br
GPIO set PWM (including range and frequency)
.br
GPIO set servo
.br
.br
In addition the bank clear and set commands, and the wave commands will only
affect updateable GPIO.
.br
.br
.SS Exceptions
.br
.br
The following exceptions are made for particular models.
.br
.br
.SS Models A and B
.br
.br
The green activity LED (GPIO 16) may be written.
.br
.SS Models A+ and B+
.br
.br
The green activity LED (GPIO 47) may be written.
.br
The red power LED (GPIO 35) may be written.
.br
The high USB power mode (GPIO 38) may be written.
.br
.SS Pi Zero
.br
.br
The green activity LED (GPIO 47) may be written.
.br
.SS Pi2B
.br
.br
The green activity LED (GPIO 47) may be written.
.br
The red power LED (GPIO 35) may be written.
.br
The high USB power mode (GPIO 38) may be written.
.br
.SS Pi3B
.br
.br
The green activity LED and the red power LED are not writable.
.br
The USB power mode is fixed at 1.2 amps (high power).
.br
.br
.br
.SS DMA Channels
.br
.br
The secondary channel is only used for the transmission of waves.
.br
.br
If possible use one of channels 0 to 6 for the secondary channel (a full channel).
.br
.br
A full channel only requires one DMA control block regardless of the length of a pulse delay. Channels 7 to 14 (lite channels) require one DMA control block for each 16383 microseconds of delay. I.e. a 10 second pulse delay requires one control block on a full channel and 611 control blocks on a lite channel.
.br
.br
.SH SEE ALSO
pig2vcd(1), pigs(1), pigpio(3), pigpiod_if(3), pigpiod_if2(3)
.SH AUTHOR
joan@abyz.co.uk

View File

@ -1,404 +0,0 @@
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
*/
/*
This version is for pigpio version 56+
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <syslog.h>
#include <string.h>
#include <signal.h>
#include <ctype.h>
#include <sys/socket.h>
#include <netdb.h>
#include "pigpio.h"
/*
This program starts the pigpio library as a daemon.
*/
static unsigned bufferSizeMilliseconds = PI_DEFAULT_BUFFER_MILLIS;
static unsigned clockMicros = PI_DEFAULT_CLK_MICROS;
static unsigned clockPeripheral = PI_DEFAULT_CLK_PERIPHERAL;
static unsigned ifFlags = PI_DEFAULT_IF_FLAGS;
static unsigned DMAprimaryChannel = PI_DEFAULT_DMA_PRIMARY_CHANNEL;
static unsigned DMAsecondaryChannel = PI_DEFAULT_DMA_SECONDARY_CHANNEL;
static unsigned socketPort = PI_DEFAULT_SOCKET_PORT;
static unsigned memAllocMode = PI_DEFAULT_MEM_ALLOC_MODE;
static uint64_t updateMask = -1;
static uint32_t cfgInternals = PI_DEFAULT_CFG_INTERNALS;
static int updateMaskSet = 0;
static FILE * errFifo;
static uint32_t sockNetAddr[MAX_CONNECT_ADDRESSES];
static int numSockNetAddr = 0;
void fatal(char *fmt, ...)
{
char buf[128];
va_list ap;
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
fprintf(stderr, "%s\n", buf);
fflush(stderr);
exit(EXIT_FAILURE);
}
void usage()
{
fprintf(stderr, "\n" \
"pigpio V%d\n" \
"Usage: sudo pigpiod [OPTION] ...\n" \
" -a value, DMA mode, 0=AUTO, 1=PMAP, 2=MBOX, default AUTO\n" \
" -b value, sample buffer size in ms, default 120\n" \
" -c value, library internal settings, default 0\n" \
" -d value, primary DMA channel, 0-14, default 14\n" \
" -e value, secondary DMA channel, 0-14, default 6\n" \
" -f, disable fifo interface, default enabled\n" \
" -k, disable socket interface, default enabled\n" \
" -l, localhost socket only default local+remote\n" \
" -n IP addr, allow address, name or dotted, default allow all\n" \
" -p value, socket port, 1024-32000, default 8888\n" \
" -s value, sample rate, 1, 2, 4, 5, 8, or 10, default 5\n" \
" -t value, clock peripheral, 0=PWM 1=PCM, default PCM\n" \
" -v, -V, display pigpio version and exit\n" \
" -x mask, GPIO which may be updated, default board GPIO\n" \
"EXAMPLE\n" \
"sudo pigpiod -s 2 -b 200 -f\n" \
" Set a sample rate of 2 microseconds with a 200 millisecond\n" \
" buffer. Disable the fifo interface.\n" \
"\n", PIGPIO_VERSION);
}
static uint64_t getNum(char *str, int *err)
{
uint64_t val;
char *endptr;
*err = 0;
val = strtoll(str, &endptr, 0);
if (*endptr) {*err = 1; val = -1;}
return val;
}
static uint32_t checkAddr(char *addrStr)
{
int err;
struct addrinfo hints, *res;
struct sockaddr_in *sin;
const char *portStr;
uint32_t addr;
portStr = getenv(PI_ENVPORT);
if (!portStr) portStr = PI_DEFAULT_SOCKET_PORT_STR;
memset (&hints, 0, sizeof (hints));
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags |= AI_CANONNAME;
err = getaddrinfo(addrStr, portStr, &hints, &res);
if (err) return 0;
sin = (struct sockaddr_in *)res->ai_addr;
addr = sin->sin_addr.s_addr;
freeaddrinfo(res);
return addr;
}
static void initOpts(int argc, char *argv[])
{
int opt, err, i;
uint32_t addr;
int64_t mask;
while ((opt = getopt(argc, argv, "a:b:c:d:e:fkln:p:s:t:x:vV")) != -1)
{
switch (opt)
{
case 'a':
i = getNum(optarg, &err);
if ((i >= PI_MEM_ALLOC_AUTO) && (i <= PI_MEM_ALLOC_MAILBOX))
memAllocMode = i;
else fatal("invalid -a option (%d)", i);
break;
case 'b':
i = getNum(optarg, &err);
if ((i >= PI_BUF_MILLIS_MIN) && (i <= PI_BUF_MILLIS_MAX))
bufferSizeMilliseconds = i;
else fatal("invalid -b option (%d)", i);
break;
case 'c':
i = getNum(optarg, &err);
if ((i >= 0) && (i < PI_CFG_ILLEGAL_VAL))
cfgInternals = i;
else fatal("invalid -c option (%x)", i);
break;
case 'd':
i = getNum(optarg, &err);
if ((i >= PI_MIN_DMA_CHANNEL) && (i <= PI_MAX_DMA_CHANNEL))
DMAprimaryChannel = i;
else fatal("invalid -d option (%d)", i);
break;
case 'e':
i = getNum(optarg, &err);
if ((i >= PI_MIN_DMA_CHANNEL) && (i <= PI_MAX_DMA_CHANNEL))
DMAsecondaryChannel = i;
else fatal("invalid -e option (%d)", i);
break;
case 'f':
ifFlags |= PI_DISABLE_FIFO_IF;
break;
case 'k':
ifFlags |= PI_DISABLE_SOCK_IF;
break;
case 'l':
ifFlags |= PI_LOCALHOST_SOCK_IF;
break;
case 'n':
addr = checkAddr(optarg);
if (addr && (numSockNetAddr<MAX_CONNECT_ADDRESSES))
sockNetAddr[numSockNetAddr++] = addr;
else fatal("invalid -n option (%s)", optarg);
break;
case 'p':
i = getNum(optarg, &err);
if ((i >= PI_MIN_SOCKET_PORT) && (i <= PI_MAX_SOCKET_PORT))
socketPort = i;
else fatal("invalid -p option (%d)", i);
break;
case 's':
i = getNum(optarg, &err);
switch(i)
{
case 1:
case 2:
case 4:
case 5:
case 8:
case 10:
clockMicros = i;
break;
default:
fatal("invalid -s option (%d)", i);
break;
}
break;
case 't':
i = getNum(optarg, &err);
if ((i >= PI_CLOCK_PWM) && (i <= PI_CLOCK_PCM))
clockPeripheral = i;
else fatal("invalid -t option (%d)", i);
break;
case 'v':
case 'V':
printf("%d\n", PIGPIO_VERSION);
exit(EXIT_SUCCESS);
break;
case 'x':
mask = getNum(optarg, &err);
if (!err)
{
updateMask = mask;
updateMaskSet = 1;
}
else fatal("invalid -x option (%s)", optarg);
break;
default: /* '?' */
usage();
exit(EXIT_FAILURE);
}
}
}
void terminate(int signum)
{
/* only registered for SIGHUP/SIGTERM */
gpioTerminate();
fprintf(errFifo, "SIGHUP/SIGTERM received\n");
fflush(NULL);
fclose(errFifo);
unlink(PI_ERRFIFO);
exit(0);
}
int main(int argc, char **argv)
{
pid_t pid;
int flags;
/* Fork off the parent process */
pid = fork();
if (pid < 0) { exit(EXIT_FAILURE); }
/* If we got a good PID, then we can exit the parent process. */
if (pid > 0) { exit(EXIT_SUCCESS); }
/* Change the file mode mask */
umask(0);
/* Open any logs here */
/* NONE */
/* Create a new SID for the child process */
if (setsid() < 0) fatal("setsid failed (%m)");
/* Change the current working directory */
if ((chdir("/")) < 0) fatal("chdir failed (%m)");
/* check command line parameters */
initOpts(argc, argv);
/* Close out the standard file descriptors */
fclose(stdin);
fclose(stdout);
/* configure library */
gpioCfgBufferSize(bufferSizeMilliseconds);
gpioCfgClock(clockMicros, clockPeripheral, 0);
gpioCfgInterfaces(ifFlags);
gpioCfgDMAchannels(DMAprimaryChannel, DMAsecondaryChannel);
gpioCfgSocketPort(socketPort);
gpioCfgMemAlloc(memAllocMode);
if (updateMaskSet) gpioCfgPermissions(updateMask);
gpioCfgNetAddr(numSockNetAddr, sockNetAddr);
gpioCfgSetInternals(cfgInternals);
/* start library */
if (gpioInitialise()< 0) fatal("Can't initialise pigpio library");
/* create pipe for error reporting */
unlink(PI_ERRFIFO);
mkfifo(PI_ERRFIFO, 0664);
if (chmod(PI_ERRFIFO, 0664) < 0)
fatal("chmod %s failed (%m)", PI_ERRFIFO);
errFifo = freopen(PI_ERRFIFO, "w+", stderr);
if (errFifo)
{
/* set stderr non-blocking */
flags = fcntl(fileno(errFifo), F_GETFL, 0);
fcntl(fileno(errFifo), F_SETFL, flags | O_NONBLOCK);
/* request SIGHUP/SIGTERM from libarary for termination */
gpioSetSignalFunc(SIGHUP, terminate);
gpioSetSignalFunc(SIGTERM, terminate);
/* sleep forever */
while (1)
{
/* cat /dev/pigerr to view daemon errors */
sleep(5);
fflush(errFifo);
}
}
else
{
fprintf(stderr, "freopen failed (%m)");
gpioTerminate();
}
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,343 +0,0 @@
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
*/
/*
This version is for pigpio version 56+
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
#include <arpa/inet.h>
#include "pigpio.h"
#include "command.h"
/*
This program provides a socket interface to some of
the commands available from pigpio.
*/
char command_buf[CMD_MAX_EXTENSION];
char response_buf[CMD_MAX_EXTENSION];
int printFlags = 0;
#define SOCKET_OPEN_FAILED -1
#define PRINT_HEX 1
#define PRINT_ASCII 2
void fatal(char *fmt, ...)
{
char buf[128];
va_list ap;
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
fprintf(stderr, "%s\n", buf);
fflush(stderr);
}
static int initOpts(int argc, char *argv[])
{
int opt, args;
args = 1;
while ((opt = getopt(argc, argv, "ax")) != -1)
{
switch (opt)
{
case 'a':
printFlags |= PRINT_ASCII;
args++;
break;
case 'x':
printFlags |= PRINT_HEX;
args++;
break;
}
}
return args;
}
static int openSocket(void)
{
int sock, err;
struct addrinfo hints, *res, *rp;
const char *addrStr, *portStr;
portStr = getenv(PI_ENVPORT);
if (!portStr) portStr = PI_DEFAULT_SOCKET_PORT_STR;
addrStr = getenv(PI_ENVADDR);
if (!addrStr) addrStr = PI_DEFAULT_SOCKET_ADDR_STR;
memset (&hints, 0, sizeof (hints));
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags |= AI_CANONNAME;
err = getaddrinfo(addrStr, portStr, &hints, &res);
if (err) return SOCKET_OPEN_FAILED;
for (rp=res; rp!=NULL; rp=rp->ai_next)
{
sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
if (sock == -1) continue;
if (connect(sock, rp->ai_addr, rp->ai_addrlen) != -1) break;
}
freeaddrinfo(res);
if (rp == NULL) return SOCKET_OPEN_FAILED;
return sock;
}
void print_result(int sock, int rv, cmdCmd_t cmd)
{
int i, r, ch;
uint32_t *p;
r = cmd.res;
switch (rv)
{
case 0:
case 1:
if (r < 0)
{
printf("%d\n", r);
fatal("ERROR: %s", cmdErrStr(r));
}
break;
case 2:
printf("%d\n", r);
if (r < 0) fatal("ERROR: %s", cmdErrStr(r));
break;
case 3:
printf("%08X\n", cmd.res);
break;
case 4:
printf("%u\n", cmd.res);
break;
case 5:
printf("%s", cmdUsage);
break;
case 6: /*
BI2CZ CF2 FL FR I2CPK I2CRD I2CRI I2CRK I2CZ
SERR SLR SPIX SPIR
*/
printf("%d", r);
if (r < 0) fatal("ERROR: %s", cmdErrStr(r));
if (r > 0)
{
if (printFlags == PRINT_ASCII) printf(" ");
for (i=0; i<r; i++)
{
ch = response_buf[i];
if (printFlags & PRINT_HEX) printf(" %hhx", ch);
else if (printFlags & PRINT_ASCII)
{
if (isprint(ch) || (ch == '\n') || (ch == '\r'))
printf("%c", ch);
else printf("\\x%02hhx", ch);
}
else printf(" %hhu", response_buf[i]);
}
}
printf("\n");
break;
case 7: /* PROCP */
if (r != (4 + (4*PI_MAX_SCRIPT_PARAMS)))
{
printf("%d", r);
fatal("ERROR: %s", cmdErrStr(r));
}
else
{
p = (uint32_t *)response_buf;
printf("%d", p[0]);
for (i=0; i<PI_MAX_SCRIPT_PARAMS; i++)
{
printf(" %d", p[i+1]);
}
}
printf("\n");
break;
}
}
void get_extensions(int sock, int command, int res)
{
switch (command)
{
case PI_CMD_BI2CZ:
case PI_CMD_BSPIX:
case PI_CMD_CF2:
case PI_CMD_FL:
case PI_CMD_FR:
case PI_CMD_I2CPK:
case PI_CMD_I2CRD:
case PI_CMD_I2CRI:
case PI_CMD_I2CRK:
case PI_CMD_I2CZ:
case PI_CMD_PROCP:
case PI_CMD_SERR:
case PI_CMD_SLR:
case PI_CMD_SPIX:
case PI_CMD_SPIR:
if (res > 0)
{
recv(sock, response_buf, res, MSG_WAITALL);
response_buf[res] = 0;
}
break;
}
}
int main(int argc , char *argv[])
{
int sock, command;
int args, idx, i, pp, l, len;
cmdCmd_t cmd;
uint32_t p[CMD_P_ARR];
cmdCtlParse_t ctl;
cmdScript_t s;
char v[CMD_MAX_EXTENSION];
sock = openSocket();
args = initOpts(argc, argv);
command_buf[0] = 0;
l = 0;
pp = 0;
for (i=args; i<argc; i++)
{
l += (strlen(argv[i]) + 1);
if (l < sizeof(command_buf))
{sprintf(command_buf+pp, "%s ", argv[i]); pp=l;}
}
if (pp) {command_buf[--pp] = 0;}
ctl.eaten = 0;
len = strlen(command_buf);
idx = 0;
while ((idx >= 0) && (ctl.eaten < len))
{
if ((idx=cmdParse(command_buf, p, CMD_MAX_EXTENSION, v, &ctl)) >= 0)
{
command = p[0];
if (command < PI_CMD_SCRIPT)
{
if (command == PI_CMD_HELP)
{
printf("%s", cmdUsage);
}
else if (command == PI_CMD_PARSE)
{
cmdParseScript(v, &s, 1);
if (s.par) free (s.par);
}
else
{
cmd.cmd = command;
cmd.p1 = p[1];
cmd.p2 = p[2];
cmd.p3 = p[3];
if (sock != SOCKET_OPEN_FAILED)
{
if (send(sock, &cmd, sizeof(cmdCmd_t), 0) ==
sizeof(cmdCmd_t))
{
if (p[3]) send(sock, v, p[3], 0); /* send extensions */
if (recv(sock, &cmd, sizeof(cmdCmd_t), MSG_WAITALL) ==
sizeof(cmdCmd_t))
{
get_extensions(sock, command, cmd.res);
print_result(sock, cmdInfo[idx].rv, cmd);
}
else fatal("socket receive failed");
}
else fatal("socket send failed");
}
else fatal("socket connect failed");
}
}
else fatal("%s only allowed within a script", cmdInfo[idx].name);
}
else
{
if (idx == CMD_UNKNOWN_CMD)
fatal("%s? unknown command, pigs h for help", cmdStr());
else
fatal("%s: bad parameter, pigs h for help", cmdStr());
}
}
if (sock >= 0) close(sock);
return 0;
}

View File

@ -1,17 +0,0 @@
#!/usr/bin/env python
from distutils.core import setup
setup(name='pigpio',
version='1.33',
author='joan',
author_email='joan@abyz.co.uk',
maintainer='joan',
maintainer_email='joan@abyz.co.uk',
url='http://abyz.co.uk/rpi/pigpio/python.html/',
description='Raspberry gpio module',
long_description='Raspberry Python module to access the pigpio daemon',
download_url='http://abyz.co.uk/rpi/pigpio/pigpio.zip',
license='unlicense.org',
py_modules=['pigpio']
)

View File

@ -1,906 +0,0 @@
/*
gcc -Wall -pthread -o x_pigpio x_pigpio.c -lpigpio
sudo ./x_pigpio
*** WARNING ************************************************
* *
* All the tests make extensive use of gpio 25 (pin 22). *
* Ensure that either nothing or just a LED is connected to *
* gpio 25 before running any of the tests. *
* *
* Some tests are statistical in nature and so may on *
* occasion fail. Repeated failures on the same test or *
* many failures in a group of tests indicate a problem. *
************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include "pigpio.h"
#define USERDATA 18249013
#define GPIO 25
void CHECK(int t, int st, int got, int expect, int pc, char *desc)
{
if ((got >= (((1E2-pc)*expect)/1E2)) && (got <= (((1E2+pc)*expect)/1E2)))
{
printf("TEST %2d.%-2d PASS (%s: %d)\n", t, st, desc, expect);
}
else
{
fprintf(stderr,
"TEST %2d.%-2d FAILED got %d (%s: %d)\n",
t, st, got, desc, expect);
}
}
void t0()
{
printf("\nTesting pigpio C I/F\n");
printf("pigpio version %d.\n", gpioVersion());
printf("Hardware revision %d.\n", gpioHardwareRevision());
}
void t1()
{
int v;
printf("Mode/PUD/read/write tests.\n");
gpioSetMode(GPIO, PI_INPUT);
v = gpioGetMode(GPIO);
CHECK(1, 1, v, 0, 0, "set mode, get mode");
gpioSetPullUpDown(GPIO, PI_PUD_UP);
v = gpioRead(GPIO);
CHECK(1, 2, v, 1, 0, "set pull up down, read");
gpioSetPullUpDown(GPIO, PI_PUD_DOWN);
v = gpioRead(GPIO);
CHECK(1, 3, v, 0, 0, "set pull up down, read");
gpioWrite(GPIO, PI_LOW);
v = gpioGetMode(GPIO);
CHECK(1, 4, v, 1, 0, "write, get mode");
v = gpioRead(GPIO);
CHECK(1, 5, v, 0, 0, "read");
gpioWrite(GPIO, PI_HIGH);
v = gpioRead(GPIO);
CHECK(1, 6, v, 1, 0, "write, read");
}
int t2_count;
void t2cb(int gpio, int level, uint32_t tick)
{
t2_count++;
}
void t2()
{
int dc, f, r, rr, oc;
printf("PWM dutycycle/range/frequency tests.\n");
gpioSetPWMrange(GPIO, 255);
gpioSetPWMfrequency(GPIO, 0);
f = gpioGetPWMfrequency(GPIO);
CHECK(2, 1, f, 10, 0, "set PWM range, set/get PWM frequency");
t2_count=0;
gpioSetAlertFunc(GPIO, t2cb);
gpioPWM(GPIO, 0);
dc = gpioGetPWMdutycycle(GPIO);
CHECK(2, 2, dc, 0, 0, "get PWM dutycycle");
time_sleep(0.5); /* allow old notifications to flush */
oc = t2_count;
time_sleep(2);
f = t2_count - oc;
CHECK(2, 3, f, 0, 0, "set PWM dutycycle, callback");
gpioPWM(GPIO, 128);
dc = gpioGetPWMdutycycle(GPIO);
CHECK(2, 4, dc, 128, 0, "get PWM dutycycle");
oc = t2_count;
time_sleep(2);
f = t2_count - oc;
CHECK(2, 5, f, 40, 5, "set PWM dutycycle, callback");
gpioSetPWMfrequency(GPIO, 100);
f = gpioGetPWMfrequency(GPIO);
CHECK(2, 6, f, 100, 0, "set/get PWM frequency");
oc = t2_count;
time_sleep(2);
f = t2_count - oc;
CHECK(2, 7, f, 400, 1, "callback");
gpioSetPWMfrequency(GPIO, 1000);
f = gpioGetPWMfrequency(GPIO);
CHECK(2, 8, f, 1000, 0, "set/get PWM frequency");
oc = t2_count;
time_sleep(2);
f = t2_count - oc;
CHECK(2, 9, f, 4000, 1, "callback");
r = gpioGetPWMrange(GPIO);
CHECK(2, 10, r, 255, 0, "get PWM range");
rr = gpioGetPWMrealRange(GPIO);
CHECK(2, 11, rr, 200, 0, "get PWM real range");
gpioSetPWMrange(GPIO, 2000);
r = gpioGetPWMrange(GPIO);
CHECK(2, 12, r, 2000, 0, "set/get PWM range");
rr = gpioGetPWMrealRange(GPIO);
CHECK(2, 13, rr, 200, 0, "get PWM real range");
gpioPWM(GPIO, 0);
}
int t3_val;
int t3_reset;
int t3_count;
uint32_t t3_tick;
float t3_on;
float t3_off;
void t3cbf(int gpio, int level, uint32_t tick, void *userdata)
{
static int unreported = 1;
uint32_t td;
int *val;
val = userdata;
if (*val != USERDATA)
{
if (unreported)
{
fprintf
(
stderr,
"unexpected userdata %d (expected %d)\n",
*val, USERDATA
);
}
unreported = 0;
}
if (t3_reset)
{
t3_count = 0;
t3_on = 0.0;
t3_off = 0.0;
t3_reset = 0;
}
else
{
td = tick - t3_tick;
if (level == 0) t3_on += td;
else t3_off += td;
}
t3_count ++;
t3_tick = tick;
}
void t3()
{
int f, rr;
float on, off;
int t, v;
int pw[3]={500, 1500, 2500};
int dc[4]={20, 40, 60, 80};
printf("PWM/Servo pulse accuracy tests.\n");
t3_val = USERDATA;
t3_reset=1;
t3_count=0;
t3_tick=0;
t3_on=0.0;
t3_off=0.0;
gpioSetAlertFuncEx(GPIO, t3cbf, &t3_val); /* test extended alert */
for (t=0; t<3; t++)
{
gpioServo(GPIO, pw[t]);
v = gpioGetServoPulsewidth(GPIO);
CHECK(3, t+t+1, v, pw[t], 0, "get servo pulsewidth");
time_sleep(1);
t3_reset = 1;
time_sleep(4);
on = t3_on;
off = t3_off;
CHECK(3, t+t+2, (1E3*(on+off))/on, 2E7/pw[t], 1,
"set servo pulsewidth");
}
gpioServo(GPIO, 0);
gpioSetPWMfrequency(GPIO, 1000);
f = gpioGetPWMfrequency(GPIO);
CHECK(3, 7, f, 1000, 0, "set/get PWM frequency");
rr = gpioSetPWMrange(GPIO, 100);
CHECK(3, 8, rr, 200, 0, "set PWM range");
for (t=0; t<4; t++)
{
gpioPWM(GPIO, dc[t]);
v = gpioGetPWMdutycycle(GPIO);
CHECK(3, t+t+9, v, dc[t], 0, "get PWM dutycycle");
time_sleep(1);
t3_reset = 1;
time_sleep(2);
on = t3_on;
off = t3_off;
CHECK(3, t+t+10, (1E3*on)/(on+off), 1E1*dc[t], 1,
"set PWM dutycycle");
}
gpioPWM(GPIO, 0);
}
void t4()
{
int h, e, f, n, s, b, l, seq_ok, toggle_ok;
gpioReport_t r;
char p[32];
printf("Pipe notification tests.\n");
gpioSetPWMfrequency(GPIO, 0);
gpioPWM(GPIO, 0);
gpioSetPWMrange(GPIO, 100);
h = gpioNotifyOpen();
e = gpioNotifyBegin(h, (1<<GPIO));
CHECK(4, 1, e, 0, 0, "notify open/begin");
time_sleep(1);
sprintf(p, "/dev/pigpio%d", h);
f = open(p, O_RDONLY);
gpioPWM(GPIO, 50);
time_sleep(4);
gpioPWM(GPIO, 0);
e = gpioNotifyPause(h);
CHECK(4, 2, e, 0, 0, "notify pause");
e = gpioNotifyClose(h);
CHECK(4, 3, e, 0, 0, "notify close");
n = 0;
s = 0;
l = 0;
seq_ok = 1;
toggle_ok = 1;
while (1)
{
b = read(f, &r, 12);
if (b == 12)
{
if (s != r.seqno) seq_ok = 0;
if (n) if (l != (r.level&(1<<GPIO))) toggle_ok = 0;
if (r.level&(1<<GPIO)) l = 0;
else l = (1<<GPIO);
s++;
n++;
// printf("%d %d %d %X\n", r.seqno, r.flags, r.tick, r.level);
}
else break;
}
close(f);
CHECK(4, 4, seq_ok, 1, 0, "sequence numbers ok");
CHECK(4, 5, toggle_ok, 1, 0, "gpio toggled ok");
CHECK(4, 6, n, 80, 10, "number of notifications");
}
int t5_count;
void t5cbf(int gpio, int level, uint32_t tick)
{
if (level == 0) t5_count++; /* falling edges */
}
void t5()
{
int BAUD=4800;
char *TEXT=
"\n\
Now is the winter of our discontent\n\
Made glorious summer by this sun of York;\n\
And all the clouds that lour'd upon our house\n\
In the deep bosom of the ocean buried.\n\
Now are our brows bound with victorious wreaths;\n\
Our bruised arms hung up for monuments;\n\
Our stern alarums changed to merry meetings,\n\
Our dreadful marches to delightful measures.\n\
Grim-visaged war hath smooth'd his wrinkled front;\n\
And now, instead of mounting barded steeds\n\
To fright the souls of fearful adversaries,\n\
He capers nimbly in a lady's chamber\n\
To the lascivious pleasing of a lute.\n\
";
gpioPulse_t wf[] =
{
{1<<GPIO, 0, 10000},
{0, 1<<GPIO, 30000},
{1<<GPIO, 0, 60000},
{0, 1<<GPIO, 100000},
};
int e, oc, c, wid;
char text[2048];
printf("Waveforms & serial read/write tests.\n");
t5_count = 0;
gpioSetAlertFunc(GPIO, t5cbf);
gpioSetMode(GPIO, PI_OUTPUT);
e = gpioWaveClear();
CHECK(5, 1, e, 0, 0, "callback, set mode, wave clear");
e = gpioWaveAddGeneric(4, wf);
CHECK(5, 2, e, 4, 0, "pulse, wave add generic");
wid = gpioWaveCreate();
e = gpioWaveTxSend(wid, PI_WAVE_MODE_REPEAT);
if (e < 14) CHECK(5, 3, e, 9, 0, "wave tx repeat");
else CHECK(5, 3, e, 19, 0, "wave tx repeat");
oc = t5_count;
time_sleep(5);
c = t5_count - oc;
CHECK(5, 4, c, 50, 1, "callback");
e = gpioWaveTxStop();
CHECK(5, 5, e, 0, 0, "wave tx stop");
/* gpioSerialReadOpen changes the alert function */
e = gpioSerialReadOpen(GPIO, BAUD, 8);
CHECK(5, 6, e, 0, 0, "serial read open");
gpioWaveClear();
e = gpioWaveAddSerial(GPIO, BAUD, 8, 2, 5000000, strlen(TEXT), TEXT);
CHECK(5, 7, e, 3405, 0, "wave clear, wave add serial");
wid = gpioWaveCreate();
e = gpioWaveTxSend(wid, PI_WAVE_MODE_ONE_SHOT);
if (e < 6964) CHECK(5, 8, e, 6811, 0, "wave tx start");
else CHECK(5, 8, e, 7116, 0, "wave tx start");
CHECK(5, 9, 0, 0, 0, "NOT APPLICABLE");
CHECK(5, 10, 0, 0, 0, "NOT APPLICABLE");
while (gpioWaveTxBusy()) time_sleep(0.1);
time_sleep(0.1);
c = gpioSerialRead(GPIO, text, sizeof(text)-1);
if (c > 0) text[c] = 0;
CHECK(5, 11, strcmp(TEXT, text), 0, 0, "wave tx busy, serial read");
e = gpioSerialReadClose(GPIO);
CHECK(5, 12, e, 0, 0, "serial read close");
c = gpioWaveGetMicros();
CHECK(5, 13, c, 6158148, 0, "wave get micros");
c = gpioWaveGetHighMicros();
CHECK(5, 14, c, 6158148, 0, "wave get high micros");
c = gpioWaveGetMaxMicros();
CHECK(5, 15, c, 1800000000, 0, "wave get max micros");
c = gpioWaveGetPulses();
CHECK(5, 16, c, 3405, 0, "wave get pulses");
c = gpioWaveGetHighPulses();
CHECK(5, 17, c, 3405, 0, "wave get high pulses");
c = gpioWaveGetMaxPulses();
CHECK(5, 18, c, 12000, 0, "wave get max pulses");
c = gpioWaveGetCbs();
if (e < 6963) CHECK(5, 19, c, 6810, 0, "wave get cbs");
else CHECK(5, 19, c, 7115, 0, "wave get cbs");
c = gpioWaveGetHighCbs();
if (e < 6963) CHECK(5, 20, c, 6810, 0, "wave get high cbs");
else CHECK(5, 20, c, 7115, 0, "wave get high cbs");
c = gpioWaveGetMaxCbs();
CHECK(5, 21, c, 25016, 0, "wave get max cbs");
}
int t6_count;
int t6_on;
uint32_t t6_on_tick;
void t6cbf(int gpio, int level, uint32_t tick)
{
if (level == 1)
{
t6_on_tick = tick;
t6_count++;
}
else
{
if (t6_on_tick) t6_on += (tick - t6_on_tick);
}
}
void t6()
{
int tp, t, p;
printf("Trigger tests\n");
gpioWrite(GPIO, PI_LOW);
tp = 0;
t6_count=0;
t6_on=0;
t6_on_tick=0;
gpioSetAlertFunc(GPIO, t6cbf);
for (t=0; t<5; t++)
{
time_sleep(0.1);
p = 10 + (t*10);
tp += p;
gpioTrigger(GPIO, p, 1);
}
time_sleep(0.2);
CHECK(6, 1, t6_count, 5, 0, "gpio trigger count");
CHECK(6, 2, t6_on, tp, 25, "gpio trigger pulse length");
}
int t7_count;
void t7cbf(int gpio, int level, uint32_t tick)
{
if (level == PI_TIMEOUT) t7_count++;
}
void t7()
{
int c, oc;
printf("Watchdog tests.\n");
t7_count=0;
/* type of edge shouldn't matter for watchdogs */
gpioSetAlertFunc(GPIO, t7cbf);
gpioSetWatchdog(GPIO, 50); /* 50 ms, 20 per second */
time_sleep(0.5);
oc = t7_count;
time_sleep(2);
c = t7_count - oc;
CHECK(7, 1, c, 39, 5, "set watchdog on count");
gpioSetWatchdog(GPIO, 0); /* 0 switches watchdog off */
time_sleep(0.5);
oc = t7_count;
time_sleep(2);
c = t7_count - oc;
CHECK(7, 2, c, 0, 1, "set watchdog off count");
}
void t8()
{
int v;
printf("Bank read/write tests.\n");
gpioWrite(GPIO, 0);
v = gpioRead_Bits_0_31() & (1<<GPIO);
CHECK(8, 1, v, 0, 0, "read bank 1");
gpioWrite(GPIO, 1);
v = gpioRead_Bits_0_31() & (1<<GPIO);
CHECK(8, 2, v, (1<<GPIO), 0, "read bank 1");
gpioWrite_Bits_0_31_Clear(1<<GPIO);
v = gpioRead(GPIO);
CHECK(8, 3, v, 0, 0, "clear bank 1");
gpioWrite_Bits_0_31_Set(1<<GPIO);
v = gpioRead(GPIO);
CHECK(8, 4, v, 1, 0, "set bank 1");
v = gpioRead_Bits_32_53();
if (v) v = 0; else v = 1;
CHECK(8, 5, v, 0, 0, "read bank 2");
v = gpioWrite_Bits_32_53_Clear(0);
CHECK(8, 6, v, 0, 0, "clear bank 2");
CHECK(8, 7, 0, 0, 0, "NOT APPLICABLE");
v = gpioWrite_Bits_32_53_Set(0);
CHECK(8, 8, v, 0, 0, "set bank 2");
CHECK(8, 9, 0, 0, 0, "NOT APPLICABLE");
}
int t9_count;
void t9cbf(int gpio, int level, uint32_t tick)
{
if (level == 1) t9_count++;
}
void t9()
{
int s, oc, c, e;
uint32_t p[10];
/*
100 loops per second
p0 number of loops
p1 GPIO
*/
char *script="\
ld p9 p0\
tag 0\
w p1 1\
mils 5\
w p1 0\
mils 5\
dcr p9\
jp 0";
printf("Script store/run/status/stop/delete tests.\n");
gpioWrite(GPIO, 0); /* need known state */
t9_count = 0;
gpioSetAlertFunc(GPIO, t9cbf);
s = gpioStoreScript(script);
while (1)
{
/* loop until script initialised */
time_sleep(0.1);
e = gpioScriptStatus(s, p);
if (e != PI_SCRIPT_INITING) break;
}
oc = t9_count;
p[0] = 99;
p[1] = GPIO;
gpioRunScript(s, 2, p);
time_sleep(2);
c = t9_count - oc;
CHECK(9, 1, c, 100, 0, "store/run script");
oc = t9_count;
p[0] = 200;
p[1] = GPIO;
gpioRunScript(s, 2, p);
time_sleep(0.1);
while (1)
{
e = gpioScriptStatus(s, p);
if (e != PI_SCRIPT_RUNNING) break;
time_sleep(0.5);
}
c = t9_count - oc;
time_sleep(0.1);
CHECK(9, 2, c, 201, 0, "run script/script status");
oc = t9_count;
p[0] = 2000;
p[1] = GPIO;
gpioRunScript(s, 2, p);
time_sleep(0.1);
while (1)
{
e = gpioScriptStatus(s, p);
if (e != PI_SCRIPT_RUNNING) break;
if (p[9] < 1900) gpioStopScript(s);
time_sleep(0.1);
}
c = t9_count - oc;
time_sleep(0.1);
CHECK(9, 3, c, 110, 10, "run/stop script/script status");
e = gpioDeleteScript(s);
CHECK(9, 4, e, 0, 0, "delete script");
}
void ta()
{
int h, b, e;
char *TEXT;
char text[2048];
printf("Serial link tests.\n");
/* this test needs RXD and TXD to be connected */
h = serOpen("/dev/ttyAMA0", 57600, 0);
CHECK(10, 1, h, 0, 0, "serial open");
b = serRead(h, text, sizeof(text)); /* flush buffer */
b = serDataAvailable(h);
CHECK(10, 2, b, 0, 0, "serial data available");
TEXT = "\
To be, or not to be, that is the question-\
Whether 'tis Nobler in the mind to suffer\
The Slings and Arrows of outrageous Fortune,\
Or to take Arms against a Sea of troubles,\
";
e = serWrite(h, TEXT, strlen(TEXT));
CHECK(10, 3, e, 0, 0, "serial write");
e = serWriteByte(h, 0xAA);
e = serWriteByte(h, 0x55);
e = serWriteByte(h, 0x00);
e = serWriteByte(h, 0xFF);
CHECK(10, 4, e, 0, 0, "serial write byte");
time_sleep(0.1); /* allow time for transmission */
b = serDataAvailable(h);
CHECK(10, 5, b, strlen(TEXT)+4, 0, "serial data available");
b = serRead(h, text, strlen(TEXT));
CHECK(10, 6, b, strlen(TEXT), 0, "serial read");
if (b >= 0) text[b] = 0;
CHECK(10, 7, strcmp(TEXT, text), 0, 0, "serial read");
b = serReadByte(h);
CHECK(10, 8, b, 0xAA, 0, "serial read byte");
b = serReadByte(h);
CHECK(10, 9, b, 0x55, 0, "serial read byte");
b = serReadByte(h);
CHECK(10, 10, b, 0x00, 0, "serial read byte");
b = serReadByte(h);
CHECK(10, 11, b, 0xFF, 0, "serial read byte");
b = serDataAvailable(h);
CHECK(10, 12, b, 0, 0, "serial data availabe");
e = serClose(h);
CHECK(10, 13, e, 0, 0, "serial close");
}
void tb()
{
int h, e, b, len;
char *exp;
char buf[128];
printf("SMBus / I2C tests.");
/* this test requires an ADXL345 on I2C bus 1 addr 0x53 */
h = i2cOpen(1, 0x53, 0);
CHECK(11, 1, h, 0, 0, "i2cOpen");
e = i2cWriteDevice(h, "\x00", 1); /* move to known register */
CHECK(11, 2, e, 0, 0, "i2cWriteDevice");
b = i2cReadDevice(h, buf, 1);
CHECK(11, 3, b, 1, 0, "i2cReadDevice");
CHECK(11, 4, buf[0], 0xE5, 0, "i2cReadDevice");
b = i2cReadByte(h);
CHECK(11, 5, b, 0xE5, 0, "i2cReadByte");
b = i2cReadByteData(h, 0);
CHECK(11, 6, b, 0xE5, 0, "i2cReadByteData");
b = i2cReadByteData(h, 48);
CHECK(11, 7, b, 2, 0, "i2cReadByteData");
exp = "\x1D[aBcDeFgHjKM]";
len = strlen(exp);
e = i2cWriteDevice(h, exp, len);
CHECK(11, 8, e, 0, 0, "i2cWriteDevice");
e = i2cWriteDevice(h, "\x1D", 1);
b = i2cReadDevice(h, buf, len-1);
CHECK(11, 9, b, len-1, 0, "i2cReadDevice");
CHECK(11, 10, strncmp(buf, exp+1, len-1), 0, 0, "i2cReadDevice");
if (strncmp(buf, exp+1, len-1))
printf("got [%.*s] expected [%.*s]\n", len-1, buf, len-1, exp+1);
e = i2cWriteByteData(h, 0x1d, 0xAA);
CHECK(11, 11, e, 0, 0, "i2cWriteByteData");
b = i2cReadByteData(h, 0x1d);
CHECK(11, 12, b, 0xAA, 0, "i2cReadByteData");
e = i2cWriteByteData(h, 0x1d, 0x55);
CHECK(11, 13, e, 0, 0, "i2cWriteByteData");
b = i2cReadByteData(h, 0x1d);
CHECK(11, 14, b, 0x55, 0, "i2cReadByteData");
exp = "[1234567890#]";
len = strlen(exp);
e = i2cWriteBlockData(h, 0x1C, exp, len);
CHECK(11, 15, e, 0, 0, "i2c writeBlockData");
e = i2cWriteDevice(h, "\x1D", 1);
b = i2cReadDevice(h, buf, len);
CHECK(11, 16, b, len, 0, "i2cReadDevice");
CHECK(11, 17, strncmp(buf, exp, len), 0, 0, "i2cReadDevice");
if (strncmp(buf, exp, len))
printf("got [%.*s] expected [%.*s]\n", len, buf, len, exp);
b = i2cReadI2CBlockData(h, 0x1D, buf, len);
CHECK(11, 18, b, len, 0, "i2cReadI2CBlockData");
CHECK(11, 19, strncmp(buf, exp, len), 0, 0, "i2cReadI2CBlockData");
if (strncmp(buf, exp, len))
printf("got [%.*s] expected [%.*s]\n", len, buf, len, exp);
exp = "(-+=;:,<>!%)";
len = strlen(exp);
e = i2cWriteI2CBlockData(h, 0x1D, exp, len);
CHECK(11, 20, e, 0, 0, "i2cWriteI2CBlockData");
b = i2cReadI2CBlockData(h, 0x1D, buf, len);
CHECK(11, 21, b, len, 0, "i2cReadI2CBlockData");
CHECK(11, 22, strncmp(buf, exp, len), 0, 0, "i2cReadI2CBlockData");
if (strncmp(buf, exp, len))
printf("got [%.*s] expected [%.*s]\n", len, buf, len, exp);
e = i2cClose(h);
CHECK(11, 23, e, 0, 0, "i2cClose");
}
void tc()
{
int h, x, b, e;
char txBuf[8], rxBuf[8];
printf("SPI tests.");
/* this test requires a MCP3202 on SPI channel 1 */
h = spiOpen(1, 50000, 0);
CHECK(12, 1, h, 0, 0, "spiOpen");
sprintf(txBuf, "\x01\x80");
for (x=0; x<5; x++)
{
b = spiXfer(h, txBuf, rxBuf, 3);
CHECK(12, 2, b, 3, 0, "spiXfer");
if (b == 3)
{
time_sleep(1.0);
printf("%d ", ((rxBuf[1]&0x0F)*256)|rxBuf[2]);
}
}
e = spiClose(h);
CHECK(12, 99, e, 0, 0, "spiClose");
}
int main(int argc, char *argv[])
{
int i, t, c, status;
char test[64];
if (argc > 1)
{
t = 0;
for (i=0; i<strlen(argv[1]); i++)
{
c = tolower(argv[1][i]);
if (!strchr(test, c))
{
test[t++] = c;
test[t] = 0;
}
}
}
else strcat(test, "0123456789");
status = gpioInitialise();
if (status < 0)
{
fprintf(stderr, "pigpio initialisation failed.\n");
return 1;
}
if (strchr(test, '0')) t0();
if (strchr(test, '1')) t1();
if (strchr(test, '2')) t2();
if (strchr(test, '3')) t3();
if (strchr(test, '4')) t4();
if (strchr(test, '5')) t5();
if (strchr(test, '6')) t6();
if (strchr(test, '7')) t7();
if (strchr(test, '8')) t8();
if (strchr(test, '9')) t9();
if (strchr(test, 'a')) ta();
if (strchr(test, 'b')) tb();
if (strchr(test, 'c')) tc();
gpioTerminate();
return 0;
}

View File

@ -1,877 +0,0 @@
/*
gcc -Wall -pthread -o x_pigpiod_if x_pigpiod_if.c -lpigpiod_if
./x_pigpiod_if
*** WARNING ************************************************
* *
* All the tests make extensive use of gpio 25 (pin 22). *
* Ensure that either nothing or just a LED is connected to *
* gpio 25 before running any of the tests. *
* *
* Some tests are statistical in nature and so may on *
* occasion fail. Repeated failures on the same test or *
* many failures in a group of tests indicate a problem. *
************************************************************
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include "pigpiod_if.h"
#define GPIO 25
void CHECK(int t, int st, int got, int expect, int pc, char *desc)
{
if ((got >= (((1E2-pc)*expect)/1E2)) && (got <= (((1E2+pc)*expect)/1E2)))
{
printf("TEST %2d.%-2d PASS (%s: %d)\n", t, st, desc, expect);
}
else
{
fprintf(stderr,
"TEST %2d.%-2d FAILED got %d (%s: %d)\n",
t, st, got, desc, expect);
}
}
void t0()
{
printf("\nTesting pigpiod C I/F 1\n");
printf("pigpio version %d.\n", get_pigpio_version());
printf("Hardware revision %d.\n", get_hardware_revision());
}
void t1()
{
int v;
printf("Mode/PUD/read/write tests.\n");
set_mode(GPIO, PI_INPUT);
v = get_mode(GPIO);
CHECK(1, 1, v, 0, 0, "set mode, get mode");
set_pull_up_down(GPIO, PI_PUD_UP);
v = gpio_read(GPIO);
CHECK(1, 2, v, 1, 0, "set pull up down, read");
set_pull_up_down(GPIO, PI_PUD_DOWN);
v = gpio_read(GPIO);
CHECK(1, 3, v, 0, 0, "set pull up down, read");
gpio_write(GPIO, PI_LOW);
v = get_mode(GPIO);
CHECK(1, 4, v, 1, 0, "write, get mode");
v = gpio_read(GPIO);
CHECK(1, 5, v, 0, 0, "read");
gpio_write(GPIO, PI_HIGH);
v = gpio_read(GPIO);
CHECK(1, 6, v, 1, 0, "write, read");
}
int t2_count=0;
void t2cb(unsigned gpio, unsigned level, uint32_t tick)
{
t2_count++;
}
void t2()
{
int dc, f, r, rr, oc;
printf("PWM dutycycle/range/frequency tests.\n");
set_PWM_range(GPIO, 255);
set_PWM_frequency(GPIO, 0);
f = get_PWM_frequency(GPIO);
CHECK(2, 1, f, 10, 0, "set PWM range, set/get PWM frequency");
callback(GPIO, EITHER_EDGE, t2cb);
set_PWM_dutycycle(GPIO, 0);
dc = get_PWM_dutycycle(GPIO);
CHECK(2, 2, dc, 0, 0, "get PWM dutycycle");
time_sleep(0.5); /* allow old notifications to flush */
oc = t2_count;
time_sleep(2);
f = t2_count - oc;
CHECK(2, 3, f, 0, 0, "set PWM dutycycle, callback");
set_PWM_dutycycle(GPIO, 128);
dc = get_PWM_dutycycle(GPIO);
CHECK(2, 4, dc, 128, 0, "get PWM dutycycle");
time_sleep(0.2);
oc = t2_count;
time_sleep(2);
f = t2_count - oc;
CHECK(2, 5, f, 40, 5, "set PWM dutycycle, callback");
set_PWM_frequency(GPIO, 100);
f = get_PWM_frequency(GPIO);
CHECK(2, 6, f, 100, 0, "set/get PWM frequency");
time_sleep(0.2);
oc = t2_count;
time_sleep(2);
f = t2_count - oc;
CHECK(2, 7, f, 400, 1, "callback");
set_PWM_frequency(GPIO, 1000);
f = get_PWM_frequency(GPIO);
CHECK(2, 8, f, 1000, 0, "set/get PWM frequency");
time_sleep(0.2);
oc = t2_count;
time_sleep(2);
f = t2_count - oc;
CHECK(2, 9, f, 4000, 1, "callback");
r = get_PWM_range(GPIO);
CHECK(2, 10, r, 255, 0, "get PWM range");
rr = get_PWM_real_range(GPIO);
CHECK(2, 11, rr, 200, 0, "get PWM real range");
set_PWM_range(GPIO, 2000);
r = get_PWM_range(GPIO);
CHECK(2, 12, r, 2000, 0, "set/get PWM range");
rr = get_PWM_real_range(GPIO);
CHECK(2, 13, rr, 200, 0, "get PWM real range");
set_PWM_dutycycle(GPIO, 0);
}
int t3_reset=1;
int t3_count=0;
uint32_t t3_tick=0;
float t3_on=0.0;
float t3_off=0.0;
void t3cbf(unsigned gpio, unsigned level, uint32_t tick)
{
uint32_t td;
if (t3_reset)
{
t3_count = 0;
t3_on = 0.0;
t3_off = 0.0;
t3_reset = 0;
}
else
{
td = tick - t3_tick;
if (level == 0) t3_on += td;
else t3_off += td;
}
t3_count ++;
t3_tick = tick;
}
void t3()
{
int pw[3]={500, 1500, 2500};
int dc[4]={20, 40, 60, 80};
int f, rr, v;
float on, off;
int t;
printf("PWM/Servo pulse accuracy tests.\n");
callback(GPIO, EITHER_EDGE, t3cbf);
for (t=0; t<3; t++)
{
set_servo_pulsewidth(GPIO, pw[t]);
v = get_servo_pulsewidth(GPIO);
CHECK(3, t+t+1, v, pw[t], 0, "get servo pulsewidth");
time_sleep(1);
t3_reset = 1;
time_sleep(4);
on = t3_on;
off = t3_off;
CHECK(3, t+t+2, (1000.0*(on+off))/on, 20000000.0/pw[t], 1,
"set servo pulsewidth");
}
set_servo_pulsewidth(GPIO, 0);
set_PWM_frequency(GPIO, 1000);
f = get_PWM_frequency(GPIO);
CHECK(3, 7, f, 1000, 0, "set/get PWM frequency");
rr = set_PWM_range(GPIO, 100);
CHECK(3, 8, rr, 200, 0, "set PWM range");
for (t=0; t<4; t++)
{
set_PWM_dutycycle(GPIO, dc[t]);
v = get_PWM_dutycycle(GPIO);
CHECK(3, t+t+9, v, dc[t], 0, "get PWM dutycycle");
time_sleep(1);
t3_reset = 1;
time_sleep(2);
on = t3_on;
off = t3_off;
CHECK(3, t+t+10, (1000.0*on)/(on+off), 10.0*dc[t], 1,
"set PWM dutycycle");
}
set_PWM_dutycycle(GPIO, 0);
}
void t4()
{
int h, e, f, n, s, b, l, seq_ok, toggle_ok;
gpioReport_t r;
char p[32];
printf("Pipe notification tests.\n");
set_PWM_frequency(GPIO, 0);
set_PWM_dutycycle(GPIO, 0);
set_PWM_range(GPIO, 100);
h = notify_open();
e = notify_begin(h, (1<<GPIO));
CHECK(4, 1, e, 0, 0, "notify open/begin");
time_sleep(1);
sprintf(p, "/dev/pigpio%d", h);
f = open(p, O_RDONLY);
set_PWM_dutycycle(GPIO, 50);
time_sleep(4);
set_PWM_dutycycle(GPIO, 0);
e = notify_pause(h);
CHECK(4, 2, e, 0, 0, "notify pause");
e = notify_close(h);
CHECK(4, 3, e, 0, 0, "notify close");
n = 0;
s = 0;
l = 0;
seq_ok = 1;
toggle_ok = 1;
while (1)
{
b = read(f, &r, 12);
if (b == 12)
{
if (s != r.seqno) seq_ok = 0;
if (n) if (l != (r.level&(1<<GPIO))) toggle_ok = 0;
if (r.level&(1<<GPIO)) l = 0;
else l = (1<<GPIO);
s++;
n++;
// printf("%d %d %d %X\n", r.seqno, r.flags, r.tick, r.level);
}
else break;
}
close(f);
CHECK(4, 4, seq_ok, 1, 0, "sequence numbers ok");
CHECK(4, 5, toggle_ok, 1, 0, "gpio toggled ok");
CHECK(4, 6, n, 80, 10, "number of notifications");
}
int t5_count = 0;
void t5cbf(unsigned gpio, unsigned level, uint32_t tick)
{
t5_count++;
}
void t5()
{
int BAUD=4800;
char *TEXT=
"\n\
Now is the winter of our discontent\n\
Made glorious summer by this sun of York;\n\
And all the clouds that lour'd upon our house\n\
In the deep bosom of the ocean buried.\n\
Now are our brows bound with victorious wreaths;\n\
Our bruised arms hung up for monuments;\n\
Our stern alarums changed to merry meetings,\n\
Our dreadful marches to delightful measures.\n\
Grim-visaged war hath smooth'd his wrinkled front;\n\
And now, instead of mounting barded steeds\n\
To fright the souls of fearful adversaries,\n\
He capers nimbly in a lady's chamber\n\
To the lascivious pleasing of a lute.\n\
";
gpioPulse_t wf[] =
{
{1<<GPIO, 0, 10000},
{0, 1<<GPIO, 30000},
{1<<GPIO, 0, 60000},
{0, 1<<GPIO, 100000},
};
int e, oc, c, wid;
char text[2048];
printf("Waveforms & serial read/write tests.\n");
callback(GPIO, FALLING_EDGE, t5cbf);
set_mode(GPIO, PI_OUTPUT);
e = wave_clear();
CHECK(5, 1, e, 0, 0, "callback, set mode, wave clear");
e = wave_add_generic(4, wf);
CHECK(5, 2, e, 4, 0, "pulse, wave add generic");
wid = wave_create();
e = wave_send_repeat(wid);
if (e < 14) CHECK(5, 3, e, 9, 0, "wave tx repeat");
else CHECK(5, 3, e, 19, 0, "wave tx repeat");
oc = t5_count;
time_sleep(5.05);
c = t5_count - oc;
CHECK(5, 4, c, 50, 2, "callback");
e = wave_tx_stop();
CHECK(5, 5, e, 0, 0, "wave tx stop");
e = bb_serial_read_open(GPIO, BAUD, 8);
CHECK(5, 6, e, 0, 0, "serial read open");
wave_clear();
e = wave_add_serial(GPIO, BAUD, 8, 2, 5000000, strlen(TEXT), TEXT);
CHECK(5, 7, e, 3405, 0, "wave clear, wave add serial");
wid = wave_create();
e = wave_send_once(wid);
if (e < 6964) CHECK(5, 8, e, 6811, 0, "wave tx start");
else CHECK(5, 8, e, 7116, 0, "wave tx start");
oc = t5_count;
time_sleep(3);
c = t5_count - oc;
CHECK(5, 9, c, 0, 0, "callback");
oc = t5_count;
while (wave_tx_busy()) time_sleep(0.1);
time_sleep(0.1);
c = t5_count - oc;
CHECK(5, 10, c, 1702, 0, "wave tx busy, callback");
c = bb_serial_read(GPIO, text, sizeof(text)-1);
if (c > 0) text[c] = 0; /* null terminate string */
CHECK(5, 11, strcmp(TEXT, text), 0, 0, "wave tx busy, serial read");
e = bb_serial_read_close(GPIO);
CHECK(5, 12, e, 0, 0, "serial read close");
c = wave_get_micros();
CHECK(5, 13, c, 6158148, 0, "wave get micros");
c = wave_get_high_micros();
if (c > 6158148) c = 6158148;
CHECK(5, 14, c, 6158148, 0, "wave get high micros");
c = wave_get_max_micros();
CHECK(5, 15, c, 1800000000, 0, "wave get max micros");
c = wave_get_pulses();
CHECK(5, 16, c, 3405, 0, "wave get pulses");
c = wave_get_high_pulses();
CHECK(5, 17, c, 3405, 0, "wave get high pulses");
c = wave_get_max_pulses();
CHECK(5, 18, c, 12000, 0, "wave get max pulses");
c = wave_get_cbs();
if (c < 6963) CHECK(5, 19, c, 6810, 0, "wave get cbs");
else CHECK(5, 19, c, 7115, 0, "wave get cbs");
c = wave_get_high_cbs();
if (c < 6963) CHECK(5, 20, c, 6810, 0, "wave get high cbs");
else CHECK(5, 20, c, 7115, 0, "wave get high cbs");
c = wave_get_max_cbs();
CHECK(5, 21, c, 25016, 0, "wave get max cbs");
}
int t6_count=0;
int t6_on=0;
uint32_t t6_on_tick=0;
void t6cbf(unsigned gpio, unsigned level, uint32_t tick)
{
if (level == 1)
{
t6_on_tick = tick;
t6_count++;
}
else
{
if (t6_on_tick) t6_on += (tick - t6_on_tick);
}
}
void t6()
{
int tp, t, p;
printf("Trigger tests.\n");
gpio_write(GPIO, PI_LOW);
tp = 0;
callback(GPIO, EITHER_EDGE, t6cbf);
time_sleep(0.2);
for (t=0; t<5; t++)
{
time_sleep(0.1);
p = 10 + (t*10);
tp += p;
gpio_trigger(GPIO, p, 1);
}
time_sleep(0.5);
CHECK(6, 1, t6_count, 5, 0, "gpio trigger count");
CHECK(6, 2, t6_on, tp, 25, "gpio trigger pulse length");
}
int t7_count=0;
void t7cbf(unsigned gpio, unsigned level, uint32_t tick)
{
if (level == PI_TIMEOUT) t7_count++;
}
void t7()
{
int c, oc;
printf("Watchdog tests.\n");
/* type of edge shouldn't matter for watchdogs */
callback(GPIO, FALLING_EDGE, t7cbf);
set_watchdog(GPIO, 50); /* 50 ms, 20 per second */
time_sleep(0.5);
oc = t7_count;
time_sleep(2);
c = t7_count - oc;
CHECK(7, 1, c, 39, 5, "set watchdog on count");
set_watchdog(GPIO, 0); /* 0 switches watchdog off */
time_sleep(0.5);
oc = t7_count;
time_sleep(2);
c = t7_count - oc;
CHECK(7, 2, c, 0, 1, "set watchdog off count");
}
void t8()
{
int v;
printf("Bank read/write tests.\n");
gpio_write(GPIO, 0);
v = read_bank_1() & (1<<GPIO);
CHECK(8, 1, v, 0, 0, "read bank 1");
gpio_write(GPIO, 1);
v = read_bank_1() & (1<<GPIO);
CHECK(8, 2, v, (1<<GPIO), 0, "read bank 1");
clear_bank_1(1<<GPIO);
v = gpio_read(GPIO);
CHECK(8, 3, v, 0, 0, "clear bank 1");
set_bank_1(1<<GPIO);
v = gpio_read(GPIO);
CHECK(8, 4, v, 1, 0, "set bank 1");
v = read_bank_2();
if (v) v = 0; else v = 1;
CHECK(8, 5, v, 0, 0, "read bank 2");
v = clear_bank_2(0);
CHECK(8, 6, v, 0, 0, "clear bank 2");
v = clear_bank_2(0xffffff);
CHECK(8, 7, v, PI_SOME_PERMITTED, 0, "clear bank 2");
v = set_bank_2(0);
CHECK(8, 8, v, 0, 0, "set bank 2");
v = set_bank_2(0xffffff);
CHECK(8, 9, v, PI_SOME_PERMITTED, 0, "set bank 2");
}
int t9_count = 0;
void t9cbf(unsigned gpio, unsigned level, uint32_t tick)
{
t9_count++;
}
void t9()
{
int s, oc, c, e;
uint32_t p[10];
printf("Script store/run/status/stop/delete tests.\n");
gpio_write(GPIO, 0); /* need known state */
/*
100 loops per second
p0 number of loops
p1 GPIO
*/
char *script="\
ld p9 p0\
tag 0\
w p1 1\
mils 5\
w p1 0\
mils 5\
dcr p9\
jp 0";
callback(GPIO, RISING_EDGE, t9cbf);
s = store_script(script);
/* Wait for script to finish initing. */
while (1)
{
time_sleep(0.1);
e = script_status(s, p);
if (e != PI_SCRIPT_INITING) break;
}
oc = t9_count;
p[0] = 99;
p[1] = GPIO;
run_script(s, 2, p);
time_sleep(2);
c = t9_count - oc;
CHECK(9, 1, c, 100, 0, "store/run script");
oc = t9_count;
p[0] = 200;
p[1] = GPIO;
run_script(s, 2, p);
while (1)
{
time_sleep(0.1);
e = script_status(s, p);
if (e != PI_SCRIPT_RUNNING) break;
}
c = t9_count - oc;
time_sleep(0.1);
CHECK(9, 2, c, 201, 0, "run script/script status");
oc = t9_count;
p[0] = 2000;
p[1] = GPIO;
run_script(s, 2, p);
while (1)
{
time_sleep(0.1);
e = script_status(s, p);
if (e != PI_SCRIPT_RUNNING) break;
if (p[9] < 1600) stop_script(s);
}
c = t9_count - oc;
time_sleep(0.1);
CHECK(9, 3, c, 410, 10, "run/stop script/script status");
e = delete_script(s);
CHECK(9, 4, e, 0, 0, "delete script");
}
void ta()
{
int h, b, e;
char *TEXT;
char text[2048];
printf("Serial link tests.\n");
/* this test needs RXD and TXD to be connected */
h = serial_open("/dev/ttyAMA0", 57600, 0);
CHECK(10, 1, h, 0, 0, "serial open");
time_sleep(0.1); /* allow time for transmission */
b = serial_read(h, text, sizeof(text)); /* flush buffer */
b = serial_data_available(h);
CHECK(10, 2, b, 0, 0, "serial data available");
TEXT = "\
To be, or not to be, that is the question-\
Whether 'tis Nobler in the mind to suffer\
The Slings and Arrows of outrageous Fortune,\
Or to take Arms against a Sea of troubles,\
";
e = serial_write(h, TEXT, strlen(TEXT));
CHECK(10, 3, e, 0, 0, "serial write");
e = serial_write_byte(h, 0xAA);
e = serial_write_byte(h, 0x55);
e = serial_write_byte(h, 0x00);
e = serial_write_byte(h, 0xFF);
CHECK(10, 4, e, 0, 0, "serial write byte");
time_sleep(0.1); /* allow time for transmission */
b = serial_data_available(h);
CHECK(10, 5, b, strlen(TEXT)+4, 0, "serial data available");
b = serial_read(h, text, strlen(TEXT));
CHECK(10, 6, b, strlen(TEXT), 0, "serial read");
if (b >= 0) text[b] = 0;
CHECK(10, 7, strcmp(TEXT, text), 0, 0, "serial read");
b = serial_read_byte(h);
CHECK(10, 8, b, 0xAA, 0, "serial read byte");
b = serial_read_byte(h);
CHECK(10, 9, b, 0x55, 0, "serial read byte");
b = serial_read_byte(h);
CHECK(10, 10, b, 0x00, 0, "serial read byte");
b = serial_read_byte(h);
CHECK(10, 11, b, 0xFF, 0, "serial read byte");
b = serial_data_available(h);
CHECK(10, 12, b, 0, 0, "serial data availabe");
e = serial_close(h);
CHECK(10, 13, e, 0, 0, "serial close");
}
void tb()
{
int h, e, b, len;
char *exp;
char buf[128];
printf("SMBus / I2C tests.");
/* this test requires an ADXL345 on I2C bus 1 addr 0x53 */
h = i2c_open(1, 0x53, 0);
CHECK(11, 1, h, 0, 0, "i2c open");
e = i2c_write_device(h, "\x00", 1); /* move to known register */
CHECK(11, 2, e, 0, 0, "i2c write device");
b = i2c_read_device(h, buf, 1);
CHECK(11, 3, b, 1, 0, "i2c read device");
CHECK(11, 4, buf[0], 0xE5, 0, "i2c read device");
b = i2c_read_byte(h);
CHECK(11, 5, b, 0xE5, 0, "i2c read byte");
b = i2c_read_byte_data(h, 0);
CHECK(11, 6, b, 0xE5, 0, "i2c read byte data");
b = i2c_read_byte_data(h, 48);
CHECK(11, 7, b, 2, 0, "i2c read byte data");
exp = "\x1D[aBcDeFgHjKM]";
len = strlen(exp);
e = i2c_write_device(h, exp, len);
CHECK(11, 8, e, 0, 0, "i2c write device");
e = i2c_write_device(h, "\x1D", 1);
b = i2c_read_device(h, buf, len-1);
CHECK(11, 9, b, len-1, 0, "i2c read device");
CHECK(11, 10, strncmp(buf, exp+1, len-1), 0, 0, "i2c read device");
if (strncmp(buf, exp+1, len-1))
printf("got [%.*s] expected [%.*s]\n", len-1, buf, len-1, exp+1);
e = i2c_write_byte_data(h, 0x1d, 0xAA);
CHECK(11, 11, e, 0, 0, "i2c write byte data");
b = i2c_read_byte_data(h, 0x1d);
CHECK(11, 12, b, 0xAA, 0, "i2c read byte data");
e = i2c_write_byte_data(h, 0x1d, 0x55);
CHECK(11, 13, e, 0, 0, "i2c write byte data");
b = i2c_read_byte_data(h, 0x1d);
CHECK(11, 14, b, 0x55, 0, "i2c read byte data");
exp = "[1234567890#]";
len = strlen(exp);
e = i2c_write_block_data(h, 0x1C, exp, len);
CHECK(11, 15, e, 0, 0, "i2c write block data");
e = i2c_write_device(h, "\x1D", 1);
b = i2c_read_device(h, buf, len);
CHECK(11, 16, b, len, 0, "i2c read device");
CHECK(11, 17, strncmp(buf, exp, len), 0, 0, "i2c read device");
if (strncmp(buf, exp, len))
printf("got [%.*s] expected [%.*s]\n", len, buf, len, exp);
b = i2c_read_i2c_block_data(h, 0x1D, buf, len);
CHECK(11, 18, b, len, 0, "i2c read i2c block data");
CHECK(11, 19, strncmp(buf, exp, len), 0, 0, "i2c read i2c block data");
if (strncmp(buf, exp, len))
printf("got [%.*s] expected [%.*s]\n", len, buf, len, exp);
exp = "(-+=;:,<>!%)";
len = strlen(exp);
e = i2c_write_i2c_block_data(h, 0x1D, exp, len);
CHECK(11, 20, e, 0, 0, "i2c write i2c block data");
b = i2c_read_i2c_block_data(h, 0x1D, buf, len);
CHECK(11, 21, b, len, 0, "i2c read i2c block data");
CHECK(11, 22, strncmp(buf, exp, len), 0, 0, "i2c read i2c block data");
if (strncmp(buf, exp, len))
printf("got [%.*s] expected [%.*s]\n", len, buf, len, exp);
e = i2c_close(h);
CHECK(11, 23, e, 0, 0, "i2c close");
}
void tc()
{
int h, x, b, e;
char buf[128];
printf("SPI tests.");
/* this test requires a MCP3202 on SPI channel 1 */
h = spi_open(1, 50000, 0);
CHECK(12, 1, h, 0, 0, "spi open");
for (x=0; x<5; x++)
{
sprintf(buf, "\x01\x80");
b = spi_xfer(h, buf, buf, 3);
CHECK(12, 2, b, 3, 0, "spi xfer");
if (b == 3)
{
time_sleep(1.0);
printf("%d ", ((buf[1]&0x0F)*256)|buf[2]);
}
}
e = spi_close(h);
CHECK(12, 99, e, 0, 0, "spi close");
}
int main(int argc, char *argv[])
{
int i, t, c, status;
char test[64];
if (argc > 1)
{
t = 0;
for (i=0; i<strlen(argv[1]); i++)
{
c = tolower(argv[1][i]);
if (!strchr(test, c))
{
test[t++] = c;
test[t] = 0;
}
}
}
else strcat(test, "0123456789");
status = pigpio_start(0, 0);
if (status < 0)
{
fprintf(stderr, "pigpio initialisation failed.\n");
return 1;
}
printf("Connected to pigpio daemon.\n");
if (strchr(test, '0')) t0();
if (strchr(test, '1')) t1();
if (strchr(test, '2')) t2();
if (strchr(test, '3')) t3();
if (strchr(test, '4')) t4();
if (strchr(test, '5')) t5();
if (strchr(test, '6')) t6();
if (strchr(test, '7')) t7();
if (strchr(test, '8')) t8();
if (strchr(test, '9')) t9();
if (strchr(test, 'a')) ta();
if (strchr(test, 'b')) tb();
if (strchr(test, 'c')) tc();
pigpio_stop();
return 0;
}

View File

@ -1,889 +0,0 @@
/*
gcc -Wall -pthread -o x_pigpiod_if2 x_pigpiod_if2.c -lpigpiod_if2
./x_pigpiod_if2
*** WARNING ************************************************
* *
* All the tests make extensive use of gpio 25 (pin 22). *
* Ensure that either nothing or just a LED is connected to *
* gpio 25 before running any of the tests. *
* *
* Some tests are statistical in nature and so may on *
* occasion fail. Repeated failures on the same test or *
* many failures in a group of tests indicate a problem. *
************************************************************
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include "pigpiod_if2.h"
#define GPIO 25
void CHECK(int t, int st, int got, int expect, int pc, char *desc)
{
if ((got >= (((1E2-pc)*expect)/1E2)) && (got <= (((1E2+pc)*expect)/1E2)))
{
printf("TEST %2d.%-2d PASS (%s: %d)\n", t, st, desc, expect);
}
else
{
fprintf(stderr,
"TEST %2d.%-2d FAILED got %d (%s: %d)\n",
t, st, got, desc, expect);
}
}
void t0(int pi)
{
printf("\nTesting pigpiod C I/F 2\n");
printf("pigpio version %d.\n", get_pigpio_version(pi));
printf("Hardware revision %d.\n", get_hardware_revision(pi));
}
void t1(int pi)
{
int v;
printf("Mode/PUD/read/write tests.\n");
set_mode(pi, GPIO, PI_INPUT);
v = get_mode(pi, GPIO);
CHECK(1, 1, v, 0, 0, "set mode, get mode");
set_pull_up_down(pi, GPIO, PI_PUD_UP);
v = gpio_read(pi, GPIO);
CHECK(1, 2, v, 1, 0, "set pull up down, read");
set_pull_up_down(pi, GPIO, PI_PUD_DOWN);
v = gpio_read(pi, GPIO);
CHECK(1, 3, v, 0, 0, "set pull up down, read");
gpio_write(pi, GPIO, PI_LOW);
v = get_mode(pi, GPIO);
CHECK(1, 4, v, 1, 0, "write, get mode");
v = gpio_read(pi, GPIO);
CHECK(1, 5, v, 0, 0, "read");
gpio_write(pi, GPIO, PI_HIGH);
v = gpio_read(pi, GPIO);
CHECK(1, 6, v, 1, 0, "write, read");
}
int t2_count=0;
void t2cb(int pi, unsigned gpio, unsigned level, uint32_t tick)
{
t2_count++;
}
void t2(int pi)
{
int dc, f, r, rr, oc, id;
printf("PWM dutycycle/range/frequency tests.\n");
set_PWM_range(pi, GPIO, 255);
set_PWM_frequency(pi, GPIO, 0);
f = get_PWM_frequency(pi, GPIO);
CHECK(2, 1, f, 10, 0, "set PWM range, set/get PWM frequency");
id = callback(pi, GPIO, EITHER_EDGE, t2cb);
set_PWM_dutycycle(pi, GPIO, 0);
dc = get_PWM_dutycycle(pi, GPIO);
CHECK(2, 2, dc, 0, 0, "get PWM dutycycle");
time_sleep(0.5); /* allow old notifications to flush */
oc = t2_count;
time_sleep(2);
f = t2_count - oc;
CHECK(2, 3, f, 0, 0, "set PWM dutycycle, callback");
set_PWM_dutycycle(pi, GPIO, 128);
dc = get_PWM_dutycycle(pi, GPIO);
CHECK(2, 4, dc, 128, 0, "get PWM dutycycle");
time_sleep(0.2);
oc = t2_count;
time_sleep(2);
f = t2_count - oc;
CHECK(2, 5, f, 40, 5, "set PWM dutycycle, callback");
set_PWM_frequency(pi, GPIO, 100);
f = get_PWM_frequency(pi, GPIO);
CHECK(2, 6, f, 100, 0, "set/get PWM frequency");
time_sleep(0.2);
oc = t2_count;
time_sleep(2);
f = t2_count - oc;
CHECK(2, 7, f, 400, 1, "callback");
set_PWM_frequency(pi, GPIO, 1000);
f = get_PWM_frequency(pi, GPIO);
CHECK(2, 8, f, 1000, 0, "set/get PWM frequency");
time_sleep(0.2);
oc = t2_count;
time_sleep(2);
f = t2_count - oc;
CHECK(2, 9, f, 4000, 1, "callback");
r = get_PWM_range(pi, GPIO);
CHECK(2, 10, r, 255, 0, "get PWM range");
rr = get_PWM_real_range(pi, GPIO);
CHECK(2, 11, rr, 200, 0, "get PWM real range");
set_PWM_range(pi, GPIO, 2000);
r = get_PWM_range(pi, GPIO);
CHECK(2, 12, r, 2000, 0, "set/get PWM range");
rr = get_PWM_real_range(pi, GPIO);
CHECK(2, 13, rr, 200, 0, "get PWM real range");
set_PWM_dutycycle(pi, GPIO, 0);
callback_cancel(id);
}
int t3_reset=1;
int t3_count=0;
uint32_t t3_tick=0;
float t3_on=0.0;
float t3_off=0.0;
void t3cbf(int pi, unsigned gpio, unsigned level, uint32_t tick)
{
uint32_t td;
// printf("pi=%d g=%d l=%d t=%u\n", pi, gpio, level, tick);
if (t3_reset)
{
t3_count = 0;
t3_on = 0.0;
t3_off = 0.0;
t3_reset = 0;
}
else
{
td = tick - t3_tick;
if (level == 0) t3_on += td;
else t3_off += td;
}
t3_count ++;
t3_tick = tick;
}
void t3(int pi)
{
int pw[3]={500, 1500, 2500};
int dc[4]={20, 40, 60, 80};
int f, rr, v;
float on, off;
int t, id;
printf("PWM/Servo pulse accuracy tests.\n");
id = callback(pi, GPIO, EITHER_EDGE, t3cbf);
for (t=0; t<3; t++)
{
set_servo_pulsewidth(pi, GPIO, pw[t]);
v = get_servo_pulsewidth(pi, GPIO);
CHECK(3, t+t+1, v, pw[t], 0, "get servo pulsewidth");
time_sleep(1);
t3_reset = 1;
time_sleep(4);
on = t3_on;
off = t3_off;
CHECK(3, t+t+2, (1000.0*(on+off))/on, 20000000.0/pw[t], 1,
"set servo pulsewidth");
}
set_servo_pulsewidth(pi, GPIO, 0);
set_PWM_frequency(pi, GPIO, 1000);
f = get_PWM_frequency(pi, GPIO);
CHECK(3, 7, f, 1000, 0, "set/get PWM frequency");
rr = set_PWM_range(pi, GPIO, 100);
CHECK(3, 8, rr, 200, 0, "set PWM range");
for (t=0; t<4; t++)
{
set_PWM_dutycycle(pi, GPIO, dc[t]);
v = get_PWM_dutycycle(pi, GPIO);
CHECK(3, t+t+9, v, dc[t], 0, "get PWM dutycycle");
time_sleep(1);
t3_reset = 1;
time_sleep(2);
on = t3_on;
off = t3_off;
CHECK(3, t+t+10, (1000.0*on)/(on+off), 10.0*dc[t], 1,
"set PWM dutycycle");
}
set_PWM_dutycycle(pi, GPIO, 0);
callback_cancel(id);
}
void t4(int pi)
{
int h, e, f, n, s, b, l, seq_ok, toggle_ok;
gpioReport_t r;
char p[32];
printf("Pipe notification tests.\n");
set_PWM_frequency(pi, GPIO, 0);
set_PWM_dutycycle(pi, GPIO, 0);
set_PWM_range(pi, GPIO, 100);
h = notify_open(pi);
e = notify_begin(pi, h, (1<<GPIO));
CHECK(4, 1, e, 0, 0, "notify open/begin");
time_sleep(1);
sprintf(p, "/dev/pigpio%d", h);
f = open(p, O_RDONLY);
set_PWM_dutycycle(pi, GPIO, 50);
time_sleep(4);
set_PWM_dutycycle(pi, GPIO, 0);
e = notify_pause(pi, h);
CHECK(4, 2, e, 0, 0, "notify pause");
e = notify_close(pi, h);
CHECK(4, 3, e, 0, 0, "notify close");
n = 0;
s = 0;
l = 0;
seq_ok = 1;
toggle_ok = 1;
while (1)
{
b = read(f, &r, 12);
if (b == 12)
{
if (s != r.seqno) seq_ok = 0;
if (n) if (l != (r.level&(1<<GPIO))) toggle_ok = 0;
if (r.level&(1<<GPIO)) l = 0;
else l = (1<<GPIO);
s++;
n++;
// printf("%d %d %d %X\n", r.seqno, r.flags, r.tick, r.level);
}
else break;
}
close(f);
CHECK(4, 4, seq_ok, 1, 0, "sequence numbers ok");
CHECK(4, 5, toggle_ok, 1, 0, "gpio toggled ok");
CHECK(4, 6, n, 80, 10, "number of notifications");
}
int t5_count = 0;
void t5cbf(int pi, unsigned gpio, unsigned level, uint32_t tick)
{
t5_count++;
}
void t5(int pi)
{
int BAUD=4800;
char *TEXT=
"\n\
Now is the winter of our discontent\n\
Made glorious summer by this sun of York;\n\
And all the clouds that lour'd upon our house\n\
In the deep bosom of the ocean buried.\n\
Now are our brows bound with victorious wreaths;\n\
Our bruised arms hung up for monuments;\n\
Our stern alarums changed to merry meetings,\n\
Our dreadful marches to delightful measures.\n\
Grim-visaged war hath smooth'd his wrinkled front;\n\
And now, instead of mounting barded steeds\n\
To fright the souls of fearful adversaries,\n\
He capers nimbly in a lady's chamber\n\
To the lascivious pleasing of a lute.\n\
";
gpioPulse_t wf[] =
{
{1<<GPIO, 0, 10000},
{0, 1<<GPIO, 30000},
{1<<GPIO, 0, 60000},
{0, 1<<GPIO, 100000},
};
int e, oc, c, wid, id;
char text[2048];
printf("Waveforms & serial read/write tests.\n");
id = callback(pi, GPIO, FALLING_EDGE, t5cbf);
set_mode(pi, GPIO, PI_OUTPUT);
e = wave_clear(pi);
CHECK(5, 1, e, 0, 0, "callback, set mode, wave clear");
e = wave_add_generic(pi, 4, wf);
CHECK(5, 2, e, 4, 0, "pulse, wave add generic");
wid = wave_create(pi);
e = wave_send_repeat(pi, wid);
if (e < 14) CHECK(5, 3, e, 9, 0, "wave tx repeat");
else CHECK(5, 3, e, 19, 0, "wave tx repeat");
oc = t5_count;
time_sleep(5.05);
c = t5_count - oc;
CHECK(5, 4, c, 50, 2, "callback");
e = wave_tx_stop(pi);
CHECK(5, 5, e, 0, 0, "wave tx stop");
e = bb_serial_read_open(pi, GPIO, BAUD, 8);
CHECK(5, 6, e, 0, 0, "serial read open");
wave_clear(pi);
e = wave_add_serial(pi, GPIO, BAUD, 8, 2, 5000000, strlen(TEXT), TEXT);
CHECK(5, 7, e, 3405, 0, "wave clear, wave add serial");
wid = wave_create(pi);
e = wave_send_once(pi, wid);
if (e < 6964) CHECK(5, 8, e, 6811, 0, "wave tx start");
else CHECK(5, 8, e, 7116, 0, "wave tx start");
oc = t5_count;
time_sleep(3);
c = t5_count - oc;
CHECK(5, 9, c, 0, 0, "callback");
oc = t5_count;
while (wave_tx_busy(pi)) time_sleep(0.1);
time_sleep(0.1);
c = t5_count - oc;
CHECK(5, 10, c, 1702, 0, "wave tx busy, callback");
c = bb_serial_read(pi, GPIO, text, sizeof(text)-1);
if (c > 0) text[c] = 0; /* null terminate string */
CHECK(5, 11, strcmp(TEXT, text), 0, 0, "wave tx busy, serial read");
e = bb_serial_read_close(pi, GPIO);
CHECK(5, 12, e, 0, 0, "serial read close");
c = wave_get_micros(pi);
CHECK(5, 13, c, 6158148, 0, "wave get micros");
c = wave_get_high_micros(pi);
if (c > 6158148) c = 6158148;
CHECK(5, 14, c, 6158148, 0, "wave get high micros");
c = wave_get_max_micros(pi);
CHECK(5, 15, c, 1800000000, 0, "wave get max micros");
c = wave_get_pulses(pi);
CHECK(5, 16, c, 3405, 0, "wave get pulses");
c = wave_get_high_pulses(pi);
CHECK(5, 17, c, 3405, 0, "wave get high pulses");
c = wave_get_max_pulses(pi);
CHECK(5, 18, c, 12000, 0, "wave get max pulses");
c = wave_get_cbs(pi);
if (c < 6963) CHECK(5, 19, c, 6810, 0, "wave get cbs");
else CHECK(5, 19, c, 7115, 0, "wave get cbs");
c = wave_get_high_cbs(pi);
if (c < 6963) CHECK(5, 20, c, 6810, 0, "wave get high cbs");
else CHECK(5, 20, c, 7115, 0, "wave get high cbs");
c = wave_get_max_cbs(pi);
CHECK(5, 21, c, 25016, 0, "wave get max cbs");
callback_cancel(id);
}
int t6_count=0;
int t6_on=0;
uint32_t t6_on_tick=0;
void t6cbf(int pi, unsigned gpio, unsigned level, uint32_t tick)
{
if (level == 1)
{
t6_on_tick = tick;
t6_count++;
}
else
{
if (t6_on_tick) t6_on += (tick - t6_on_tick);
}
}
void t6(int pi)
{
int tp, t, p, id;
printf("Trigger tests.\n");
gpio_write(pi, GPIO, PI_LOW);
tp = 0;
id = callback(pi, GPIO, EITHER_EDGE, t6cbf);
time_sleep(0.2);
for (t=0; t<5; t++)
{
time_sleep(0.1);
p = 10 + (t*10);
tp += p;
gpio_trigger(pi, GPIO, p, 1);
}
time_sleep(0.5);
CHECK(6, 1, t6_count, 5, 0, "gpio trigger count");
CHECK(6, 2, t6_on, tp, 25, "gpio trigger pulse length");
callback_cancel(id);
}
int t7_count=0;
void t7cbf(int pi, unsigned gpio, unsigned level, uint32_t tick)
{
if (level == PI_TIMEOUT) t7_count++;
}
void t7(int pi)
{
int c, oc, id;
printf("Watchdog tests.\n");
/* type of edge shouldn't matter for watchdogs */
id = callback(pi, GPIO, FALLING_EDGE, t7cbf);
set_watchdog(pi, GPIO, 50); /* 50 ms, 20 per second */
time_sleep(0.5);
oc = t7_count;
time_sleep(2);
c = t7_count - oc;
CHECK(7, 1, c, 39, 5, "set watchdog on count");
set_watchdog(pi, GPIO, 0); /* 0 switches watchdog off */
time_sleep(0.5);
oc = t7_count;
time_sleep(2);
c = t7_count - oc;
CHECK(7, 2, c, 0, 1, "set watchdog off count");
callback_cancel(id);
}
void t8(int pi)
{
int v;
printf("Bank read/write tests.\n");
gpio_write(pi, GPIO, 0);
v = read_bank_1(pi) & (1<<GPIO);
CHECK(8, 1, v, 0, 0, "read bank 1");
gpio_write(pi, GPIO, 1);
v = read_bank_1(pi) & (1<<GPIO);
CHECK(8, 2, v, (1<<GPIO), 0, "read bank 1");
clear_bank_1(pi, 1<<GPIO);
v = gpio_read(pi, GPIO);
CHECK(8, 3, v, 0, 0, "clear bank 1");
set_bank_1(pi, 1<<GPIO);
v = gpio_read(pi, GPIO);
CHECK(8, 4, v, 1, 0, "set bank 1");
v = read_bank_2(pi);
if (v) v = 0; else v = 1;
CHECK(8, 5, v, 0, 0, "read bank 2");
v = clear_bank_2(pi, 0);
CHECK(8, 6, v, 0, 0, "clear bank 2");
v = clear_bank_2(pi, 0xffffff);
CHECK(8, 7, v, PI_SOME_PERMITTED, 0, "clear bank 2");
v = set_bank_2(pi, 0);
CHECK(8, 8, v, 0, 0, "set bank 2");
v = set_bank_2(pi, 0xffffff);
CHECK(8, 9, v, PI_SOME_PERMITTED, 0, "set bank 2");
}
int t9_count = 0;
void t9cbf(int pi, unsigned gpio, unsigned level, uint32_t tick)
{
t9_count++;
}
void t9(int pi)
{
int s, oc, c, e, id;
uint32_t p[10];
printf("Script store/run/status/stop/delete tests.\n");
gpio_write(pi, GPIO, 0); /* need known state */
/*
100 loops per second
p0 number of loops
p1 GPIO
*/
char *script="\
ld p9 p0\
tag 0\
w p1 1\
mils 5\
w p1 0\
mils 5\
dcr p9\
jp 0";
id = callback(pi, GPIO, RISING_EDGE, t9cbf);
s = store_script(pi, script);
/* Wait for script to finish initing. */
while (1)
{
time_sleep(0.1);
e = script_status(pi, s, p);
if (e != PI_SCRIPT_INITING) break;
}
oc = t9_count;
p[0] = 99;
p[1] = GPIO;
run_script(pi, s, 2, p);
time_sleep(2);
c = t9_count - oc;
CHECK(9, 1, c, 100, 0, "store/run script");
oc = t9_count;
p[0] = 200;
p[1] = GPIO;
run_script(pi, s, 2, p);
while (1)
{
time_sleep(0.1);
e = script_status(pi, s, p);
if (e != PI_SCRIPT_RUNNING) break;
}
c = t9_count - oc;
time_sleep(0.1);
CHECK(9, 2, c, 201, 0, "run script/script status");
oc = t9_count;
p[0] = 2000;
p[1] = GPIO;
run_script(pi, s, 2, p);
while (1)
{
time_sleep(0.1);
e = script_status(pi, s, p);
if (e != PI_SCRIPT_RUNNING) break;
if (p[9] < 1600) stop_script(pi, s);
}
c = t9_count - oc;
time_sleep(0.1);
CHECK(9, 3, c, 410, 10, "run/stop script/script status");
e = delete_script(pi, s);
CHECK(9, 4, e, 0, 0, "delete script");
callback_cancel(id);
}
void ta(int pi)
{
int h, b, e;
char *TEXT;
char text[2048];
printf("Serial link tests.\n");
/* this test needs RXD and TXD to be connected */
h = serial_open(pi, "/dev/ttyAMA0", 57600, 0);
CHECK(10, 1, h, 0, 0, "serial open");
time_sleep(0.1); /* allow time for transmission */
b = serial_read(pi, h, text, sizeof(text)); /* flush buffer */
b = serial_data_available(pi, h);
CHECK(10, 2, b, 0, 0, "serial data available");
TEXT = "\
To be, or not to be, that is the question-\
Whether 'tis Nobler in the mind to suffer\
The Slings and Arrows of outrageous Fortune,\
Or to take Arms against a Sea of troubles,\
";
e = serial_write(pi, h, TEXT, strlen(TEXT));
CHECK(10, 3, e, 0, 0, "serial write");
e = serial_write_byte(pi, h, 0xAA);
e = serial_write_byte(pi, h, 0x55);
e = serial_write_byte(pi, h, 0x00);
e = serial_write_byte(pi, h, 0xFF);
CHECK(10, 4, e, 0, 0, "serial write byte");
time_sleep(0.1); /* allow time for transmission */
b = serial_data_available(pi, h);
CHECK(10, 5, b, strlen(TEXT)+4, 0, "serial data available");
b = serial_read(pi, h, text, strlen(TEXT));
CHECK(10, 6, b, strlen(TEXT), 0, "serial read");
if (b >= 0) text[b] = 0;
CHECK(10, 7, strcmp(TEXT, text), 0, 0, "serial read");
b = serial_read_byte(pi, h);
CHECK(10, 8, b, 0xAA, 0, "serial read byte");
b = serial_read_byte(pi, h);
CHECK(10, 9, b, 0x55, 0, "serial read byte");
b = serial_read_byte(pi, h);
CHECK(10, 10, b, 0x00, 0, "serial read byte");
b = serial_read_byte(pi, h);
CHECK(10, 11, b, 0xFF, 0, "serial read byte");
b = serial_data_available(pi, h);
CHECK(10, 12, b, 0, 0, "serial data availabe");
e = serial_close(pi, h);
CHECK(10, 13, e, 0, 0, "serial close");
}
void tb(int pi)
{
int h, e, b, len;
char *exp;
char buf[128];
printf("SMBus / I2C tests.");
/* this test requires an ADXL345 on I2C bus 1 addr 0x53 */
h = i2c_open(pi, 1, 0x53, 0);
CHECK(11, 1, h, 0, 0, "i2c open");
e = i2c_write_device(pi, h, "\x00", 1); /* move to known register */
CHECK(11, 2, e, 0, 0, "i2c write device");
b = i2c_read_device(pi, h, buf, 1);
CHECK(11, 3, b, 1, 0, "i2c read device");
CHECK(11, 4, buf[0], 0xE5, 0, "i2c read device");
b = i2c_read_byte(pi, h);
CHECK(11, 5, b, 0xE5, 0, "i2c read byte");
b = i2c_read_byte_data(pi, h, 0);
CHECK(11, 6, b, 0xE5, 0, "i2c read byte data");
b = i2c_read_byte_data(pi, h, 48);
CHECK(11, 7, b, 2, 0, "i2c read byte data");
exp = "\x1D[aBcDeFgHjKM]";
len = strlen(exp);
e = i2c_write_device(pi, h, exp, len);
CHECK(11, 8, e, 0, 0, "i2c write device");
e = i2c_write_device(pi, h, "\x1D", 1);
b = i2c_read_device(pi, h, buf, len-1);
CHECK(11, 9, b, len-1, 0, "i2c read device");
CHECK(11, 10, strncmp(buf, exp+1, len-1), 0, 0, "i2c read device");
if (strncmp(buf, exp+1, len-1))
printf("got [%.*s] expected [%.*s]\n", len-1, buf, len-1, exp+1);
e = i2c_write_byte_data(pi, h, 0x1d, 0xAA);
CHECK(11, 11, e, 0, 0, "i2c write byte data");
b = i2c_read_byte_data(pi, h, 0x1d);
CHECK(11, 12, b, 0xAA, 0, "i2c read byte data");
e = i2c_write_byte_data(pi, h, 0x1d, 0x55);
CHECK(11, 13, e, 0, 0, "i2c write byte data");
b = i2c_read_byte_data(pi, h, 0x1d);
CHECK(11, 14, b, 0x55, 0, "i2c read byte data");
exp = "[1234567890#]";
len = strlen(exp);
e = i2c_write_block_data(pi, h, 0x1C, exp, len);
CHECK(11, 15, e, 0, 0, "i2c write block data");
e = i2c_write_device(pi, h, "\x1D", 1);
b = i2c_read_device(pi, h, buf, len);
CHECK(11, 16, b, len, 0, "i2c read device");
CHECK(11, 17, strncmp(buf, exp, len), 0, 0, "i2c read device");
if (strncmp(buf, exp, len))
printf("got [%.*s] expected [%.*s]\n", len, buf, len, exp);
b = i2c_read_i2c_block_data(pi, h, 0x1D, buf, len);
CHECK(11, 18, b, len, 0, "i2c read i2c block data");
CHECK(11, 19, strncmp(buf, exp, len), 0, 0, "i2c read i2c block data");
if (strncmp(buf, exp, len))
printf("got [%.*s] expected [%.*s]\n", len, buf, len, exp);
exp = "(-+=;:,<>!%)";
len = strlen(exp);
e = i2c_write_i2c_block_data(pi, h, 0x1D, exp, len);
CHECK(11, 20, e, 0, 0, "i2c write i2c block data");
b = i2c_read_i2c_block_data(pi, h, 0x1D, buf, len);
CHECK(11, 21, b, len, 0, "i2c read i2c block data");
CHECK(11, 22, strncmp(buf, exp, len), 0, 0, "i2c read i2c block data");
if (strncmp(buf, exp, len))
printf("got [%.*s] expected [%.*s]\n", len, buf, len, exp);
e = i2c_close(pi, h);
CHECK(11, 23, e, 0, 0, "i2c close");
}
void tc(int pi)
{
int h, x, b, e;
char buf[128];
printf("SPI tests.");
/* this test requires a MCP3202 on SPI channel 1 */
h = spi_open(pi, 1, 50000, 0);
CHECK(12, 1, h, 0, 0, "spi open");
for (x=0; x<5; x++)
{
sprintf(buf, "\x01\x80");
b = spi_xfer(pi, h, buf, buf, 3);
CHECK(12, 2, b, 3, 0, "spi xfer");
if (b == 3)
{
time_sleep(1.0);
printf("%d ", ((buf[1]&0x0F)*256)|buf[2]);
}
}
e = spi_close(pi, h);
CHECK(12, 99, e, 0, 0, "spi close");
}
int main(int argc, char *argv[])
{
int i, t, c, pi;
char test[64];
if (argc > 1)
{
t = 0;
for (i=0; i<strlen(argv[1]); i++)
{
c = tolower(argv[1][i]);
if (!strchr(test, c))
{
test[t++] = c;
test[t] = 0;
}
}
}
else strcat(test, "0123456789");
pi = pigpio_start(0, 0);
if (pi < 0)
{
fprintf(stderr, "pigpio initialisation failed (%d).\n", pi);
return 1;
}
printf("Connected to pigpio daemon (%d).\n", pi);
if (strchr(test, '0')) t0(pi);
if (strchr(test, '1')) t1(pi);
if (strchr(test, '2')) t2(pi);
if (strchr(test, '3')) t3(pi);
if (strchr(test, '4')) t4(pi);
if (strchr(test, '5')) t5(pi);
if (strchr(test, '6')) t6(pi);
if (strchr(test, '7')) t7(pi);
if (strchr(test, '8')) t8(pi);
if (strchr(test, '9')) t9(pi);
if (strchr(test, 'a')) ta(pi);
if (strchr(test, 'b')) tb(pi);
if (strchr(test, 'c')) tc(pi);
pigpio_stop(pi);
return 0;
}

View File

@ -1,310 +0,0 @@
#!/bin/bash
GPIO=25
#
# This script serves as a confidence check that the socket interface to
# the pigpio library is ok.
#
# The script uses gpio 25 (pin 22). Make sure that nothing (or only a LED)
# is connected to gpio 25 before running the script.
#
# To run the script
# sudo pigpiod # if not already running on the Pi
# export PIGPIO_ADDR=pi_host # to specify the Pi if testing remotely
# ./x_pigs
#
# Some tests are statistical in nature and so may on occasion fail.
# Repeated failures on the same test or many failures in a group
# of tests indicate a problem.
#
echo
echo "Testing pigpio pigs"
s=$(pigs pigpv)
echo "pigpio version $s"
s=$(pigs bc1 0)
if [[ $s = "" ]]; then echo "BC1 ok"; else echo "BC1 fail ($s)"; fi
s=$(pigs bc2 0)
if [[ $s = "" ]]; then echo "BC2 ok"; else echo "BC2 fail ($s)"; fi
s=$(pigs br1)
if [[ ${#s} = 8 ]]
then echo "BR1 ok"
else echo "BR1 fail ($s)"
fi
s=$(pigs br2)
if [[ ${#s} = 8 ]]
then echo "BR2 ok"
else echo "BR2 fail ($s)"
fi
s=$(pigs bs1 0)
if [[ $s = "" ]]; then echo "BS1 ok"; else echo "BS1 fail ($s)"; fi
s=$(pigs bs2 0)
if [[ $s = "" ]]; then echo "BS2 ok"; else echo "BS2 fail ($s)"; fi
s=$(pigs h)
if [[ ${#s} = 5273 ]]; then echo "HELP ok"; else echo "HELP fail (${#s})"; fi
s=$(pigs hwver)
if [[ $s -ne 0 ]]; then echo "HWVER ok"; else echo "HWVER fail ($s)"; fi
s=$(pigs mics 1000)
if [[ $s = "" ]]; then echo "MICS ok"; else echo "MICS fail ($s)"; fi
s=$(pigs mils 10)
if [[ $s = "" ]]; then echo "MILS ok"; else echo "MILS fail ($s)"; fi
s=$(pigs modes $GPIO 0)
s=$(pigs modeg $GPIO)
if [[ $s = 4 ]]; then echo "MODEG ok"; else echo "MODEG fail ($s)"; fi
s=$(pigs m $GPIO r)
s=$(pigs mg $GPIO)
if [[ $s = 0 ]]; then echo "MODES ok"; else echo "MODES fail ($s)"; fi
h=$(pigs no)
if [[ $h -ge 0 && $h -le 31 ]]
then echo "NO($h) ok"
else echo "NO fail ($s)"
fi
s=$(pigs nb $h 0xabcd)
if [[ $s = "" ]]; then echo "NB($h) ok"; else echo "NB fail ($s)"; fi
s=$(pigs np $h)
if [[ $s = "" ]]; then echo "NP($h) ok"; else echo "NP fail ($s)"; fi
s=$(pigs nc $h)
if [[ $s = "" ]]; then echo "NC($h) ok"; else echo "NC fail ($s)"; fi
s=$(pigs pfs $GPIO 800)
if [[ $s = 800 ]]; then echo "PFG-a ok"; else echo "PFG-a fail ($s)"; fi
s=$(pigs pfg $GPIO)
if [[ $s = 800 ]]; then echo "PFG-b ok"; else echo "PFG-b fail ($s)"; fi
s=$(pigs pfs $GPIO 0)
if [[ $s = 10 ]]; then echo "PFS-a ok"; else echo "PFS-a fail ($s)"; fi
s=$(pigs pfs $GPIO 800)
if [[ $s = 800 ]]; then echo "PFS-b ok"; else echo "PFS-b fail ($s)"; fi
s=$(pigs prs $GPIO 255)
if [[ $s = 250 ]]; then echo "PRG-a ok"; else echo "PRG-a fail ($s)"; fi
s=$(pigs prg $GPIO)
if [[ $s = 255 ]]; then echo "PRG-b ok"; else echo "PRG-b fail ($s)"; fi
p=$(pigs proc ld p1 p0 ld p0 1234 tag 999 mils 1000 jmp 999)
if [[ $p -ge 0 && $p -le 31 ]]
then echo "PROC($p) ok"
else echo "PROC($p) fail ($s)"
fi
sleep 0.1 # Make sure script has time to intialise.
s=$(pigs procr $p 9876)
if [[ $s = "" ]]; then echo "PROCR($p) ok"; else echo "PROCR($p) fail ($s)"; fi
s=$(pigs procp $p)
v=(${s// / })
if [[ ${v[0]} = 2 && ${v[1]} = 1234 && ${v[2]} = 9876 ]]
then echo "PROCP($p) ok"
else echo "PROCP($p) fail ($s)"
fi
s=$(pigs procs $p)
if [[ $s = "" ]]; then echo "PROCS($p) ok"; else echo "PROCS($p) fail ($s)"; fi
s=$(pigs procd $p)
if [[ $s = "" ]]; then echo "PROCD($p) ok"; else echo "PROCD($p) fail ($s)"; fi
s=$(pigs prrg $GPIO)
if [[ $s = 250 ]]; then echo "PRRG ok"; else echo "PRRG fail ($s)"; fi
s=$(pigs prs $GPIO 1000)
if [[ $s = 250 ]]; then echo "PRS-a ok"; else echo "PRS-a fail ($s)"; fi
s=$(pigs prg $GPIO)
if [[ $s = 1000 ]]; then echo "PRS-b ok"; else echo "PRS-b fail ($s)"; fi
s=$(pigs prs $GPIO 255)
if [[ $s = 250 ]]; then echo "PRS-c ok"; else echo "PRS-c fail ($s)"; fi
s=$(pigs prg $GPIO)
if [[ $s = 255 ]]; then echo "PRS-d ok"; else echo "PRS-d fail ($s)"; fi
s=$(pigs pud $GPIO u)
if [[ $s = "" ]]; then echo "PUD-a ok"; else echo "PUD-a fail ($s)"; fi
s=$(pigs r $GPIO)
if [[ $s = 1 ]]; then echo "PUD-b ok"; else echo "PUD-b fail ($s)"; fi
s=$(pigs pud $GPIO d)
if [[ $s = "" ]]; then echo "PUD-c ok"; else echo "PUD-c fail ($s)"; fi
s=$(pigs r $GPIO)
if [[ $s = 0 ]]; then echo "PUD-d ok"; else echo "PUD-d fail ($s)"; fi
s=$(pigs pud $GPIO o)
if [[ $s = "" ]]; then echo "PUD-e ok"; else echo "PUD-e fail ($s)"; fi
s=$(pigs p $GPIO 128)
if [[ $s = "" ]]; then echo "PWM-a ok"; else echo "PWM-a fail ($s)"; fi
s=$(pigs gdc $GPIO)
if [[ $s = 128 ]]; then echo "GDC-a ok"; else echo "GDC-a fail ($s)"; fi
s=$(pigs pwm $GPIO 64)
if [[ $s = "" ]]; then echo "PWM-b ok"; else echo "PWM-b fail ($s)"; fi
s=$(pigs GDC $GPIO)
if [[ $s = 64 ]]; then echo "GDC-b ok"; else echo "GDC-b fail ($s)"; fi
s=$(pigs pwm $GPIO 0)
if [[ $s = "" ]]; then echo "PWM-c ok"; else echo "PWM-c fail ($s)"; fi
s=$(pigs gdc $GPIO)
if [[ $s = 0 ]]; then echo "GDC-c ok"; else echo "GDC-c fail ($s)"; fi
s=$(pigs m $GPIO r)
if [[ $s = "" ]]; then echo "PWM-d ok"; else echo "PWM-d fail ($s)"; fi
s=$(pigs pud $GPIO u)
if [[ $s = "" ]]; then echo "READ-a ok"; else echo "READ-a fail ($s)"; fi
s=$(pigs r $GPIO)
if [[ $s = 1 ]]; then echo "READ-b ok"; else echo "READ-b fail ($s)"; fi
s=$(pigs pud $GPIO d)
if [[ $s = "" ]]; then echo "READ-c ok"; else echo "READ-c fail ($s)"; fi
s=$(pigs read $GPIO)
if [[ $s = 0 ]]; then echo "READ-d ok"; else echo "READ-d fail ($s)"; fi
s=$(pigs pud $GPIO o)
if [[ $s = "" ]]; then echo "READ-e ok"; else echo "READ-e fail ($s)"; fi
s=$(pigs s $GPIO 500)
if [[ $s = "" ]]; then echo "SERVO-a ok"; else echo "SERVO-a fail ($s)"; fi
s=$(pigs gpw $GPIO)
if [[ $s = 500 ]]; then echo "GPW-a ok"; else echo "GPW-a fail ($s)"; fi
s=$(pigs servo $GPIO 2500)
if [[ $s = "" ]]; then echo "SERVO-b ok"; else echo "SERVO-b fail ($s)"; fi
s=$(pigs gpw $GPIO)
if [[ $s = 2500 ]]; then echo "GPW-b ok"; else echo "GPW-b fail ($s)"; fi
s=$(pigs servo $GPIO 0)
if [[ $s = "" ]]; then echo "SERVO-c ok"; else echo "SERVO-c fail ($s)"; fi
s=$(pigs gpw $GPIO)
if [[ $s = 0 ]]; then echo "GPW-c ok"; else echo "GPW-c fail ($s)"; fi
s=$(pigs w $GPIO 1)
if [[ $s = "" ]]; then echo "SERVO-d ok"; else echo "SERVO-d fail ($s)"; fi
s=$(pigs wvclr)
if [[ $s = "" ]]; then echo "SLR-a ok"; else echo "SLR-a fail ($s)"; fi
s=$(pigs slro $GPIO 4800 8)
if [[ $s = "" ]]; then echo "SLR-b ok"; else echo "SLR-b fail ($s)"; fi
s=$(pigs wvas $GPIO 4800 8 2 0 0x6d 0x79 0x20 0x6e 0x61 0x6d 0x65 0x20 0x69 0x73 0x20 0x6a 0x6f 0x61 0x6e)
if [[ $s = 95 ]]; then echo "SLR-c ok"; else echo "SLR-c fail ($s)"; fi
s=$(pigs m $GPIO w)
if [[ $s = "" ]]; then echo "SLR-d ok"; else echo "SLR-d fail ($s)"; fi
w=$(pigs wvcre)
if [[ $w -ge 0 ]]; then echo "WVCRE ok"; else echo "WVCRE fail ($s)"; fi
s=$(pigs wvtx $w)
if [[ $s = 191 ]]; then echo "SLR-e ok"; else echo "SLR-e fail ($s)"; fi
sleep 0.4
s=$(pigs slr $GPIO 100)
e="15 109 121 32 110 97 109 101 32 105 115 32 106 111 97 110"
if [[ $s = $e ]]
then echo "SLR-f ok"
else echo "SLR-f fail with [$s]"
fi
s=$(pigs slrc $GPIO)
if [[ $s = "" ]]; then echo "SLR-g ok"; else echo "SLR-g fail ($s)"; fi
t=$(pigs t tick)
v=(${t// / })
s=$((v[1]-v[0]))
if [[ $s -gt 0 && $s -lt 2000 ]]
then echo "TICK ok"
else echo "TICK fail($s)"
fi
pigs w $GPIO 1 # put in known state
s=$(pigs trig $GPIO 10 1)
if [[ $s = "" ]]; then echo "TRIG-a ok"; else echo "TRIG-a fail ($s)"; fi
s=$(pigs r $GPIO)
if [[ $s = 0 ]]; then echo "TRIG-b ok"; else echo "TRIG-b fail ($s)"; fi
s=$(pigs trig $GPIO 10 0)
if [[ $s = "" ]]; then echo "TRIG-c ok"; else echo "TRIG-c fail ($s)"; fi
s=$(pigs r $GPIO)
if [[ $s = 1 ]]; then echo "TRIG-d ok"; else echo "TRIG-d fail ($s)"; fi
s=$(pigs wdog $GPIO 1000)
if [[ $s = "" ]]; then echo "WDOG-a ok"; else echo "WDOG-a fail ($s)"; fi
s=$(pigs wdog $GPIO 0)
if [[ $s = "" ]]; then echo "WDOG-b ok"; else echo "WDOG-b fail ($s)"; fi
s=$(pigs w $GPIO 1)
if [[ $s = "" ]]; then echo "WRITE-a ok"; else echo "WRITE-a fail ($s)"; fi
s=$(pigs r $GPIO)
if [[ $s = 1 ]]; then echo "WRITE-b ok"; else echo "WRITE-b fail ($s)"; fi
s=$(pigs write $GPIO 0)
if [[ $s = "" ]]; then echo "WRITE-c ok"; else echo "WRITE-c fail ($s)"; fi
s=$(pigs r $GPIO)
if [[ $s = 0 ]]; then echo "WRITE-d ok"; else echo "WRITE-d fail ($s)"; fi
s=$(pigs wvclr )
if [[ $s = "" ]]; then echo "WVCLR ok"; else echo "WVCLR fail ($s)"; fi
s=$(pigs wvas $GPIO 300 8 2 0 0x74 0x68 0x69 0x73 0x20 0x69 0x73 0x20 0x74 0x68 0x65 0x6e 0x20 0x77 0x69 0x6e 0x74 0x65 0x72 0x20 0x6f 0x66 0x20 0x6d 0x79 0x20 0x64 0x69 0x73 0x63 0x6f 0x6e 0x74 0x65 0x6e 0x74 0x20 0x6d 0x61 0x64 0x65 0x20 0x67 0x6c 0x6f 0x72 0x69 0x6f 0x75 0x73)
if [[ $s = 309 ]]; then echo "WVAS ok"; else echo "WVAS fail ($s)"; fi
s=$(pigs wvag 16 0 5000000 0 16 5000000)
if [[ $s = 310 ]]; then echo "WVAG ok"; else echo "WVAG fail ($s)"; fi
w=$(pigs wvcre)
if [[ $w -ge 0 ]]; then echo "WVCRE ok"; else echo "WVCRE fail ($s)"; fi
s=$(pigs wvtx $w)
if [[ ($s = 621) || ($s = 1137) ]]
then echo "WVTX ok"
else echo "WVTX fail ($s)"
fi
s=$(pigs wvbsy)
if [[ $s = 1 ]]; then echo "WVBSY-a ok"; else echo "WVBSY-a fail ($s)"; fi
sleep 1
s=$(pigs wvbsy)
if [[ $s = 1 ]]; then echo "WVBSY-b ok"; else echo "WVBSY-b fail ($s)"; fi
s=$(pigs wvhlt)
if [[ $s = "" ]]; then echo "WVHLT ok"; else echo "WVHLT fail ($s)"; fi
s=$(pigs wvbsy)
if [[ $s = 0 ]]; then echo "WVBSY-c ok"; else echo "WVBSY-c fail ($s)"; fi
s=$(pigs wvtxr $w)
if [[ ($s = 621) || ($s = 1137) ]]
then echo "WVTXR ok"
else echo "WVTXR fail ($s)"
fi
s=$(pigs wvbsy)
if [[ $s = 1 ]]; then echo "WVBSY-d ok"; else echo "WVBSY-d fail ($s)"; fi
s=$(pigs wvhlt)
if [[ $s = "" ]]; then echo "WVHLT ok"; else echo "WVHLT fail ($s)"; fi
s=$(pigs wvbsy)
if [[ $s = 0 ]]; then echo "WVBSY-e ok"; else echo "WVBSY-e fail ($s)"; fi
s=$(pigs wvsc 0)
if [[ ($s = 620) || ($s = 933) ]]
then echo "WVSC-a ok"
else echo "WVSC-a fail ($s)"
fi
s=$(pigs wvsc 1)
if [[ $s -ge 620 ]]; then echo "WVSC-b ok"; else echo "WVSC-b fail ($s)"; fi
s=$(pigs wvsc 2)
if [[ $s = 25016 ]]; then echo "WVSC-c ok"; else echo "WVSC-c fail ($s)"; fi
s=$(pigs wvsm 0)
if [[ $s = 10000000 ]]; then echo "WVSM-a ok"; else echo "WVSM-a fail ($s)"; fi
s=$(pigs wvsm 1)
if [[ $s -ge 10000000 ]]; then echo "WVSM-b ok"; else echo "WVSM-b fail ($s)"; fi
s=$(pigs wvsm 2)
if [[ $s = 1800000000 ]]
then echo "WVSM-c ok"
else echo "WVSM-c fail ($s)"
fi
s=$(pigs wvsp 0)
if [[ $s = 310 ]]; then echo "WVSP-a ok"; else echo "WVSP-a fail ($s)"; fi
s=$(pigs wvsp 1)
if [[ $s -ge 310 ]]; then echo "WVSP-b ok"; else echo "WVSP-b fail ($s)"; fi
s=$(pigs wvsp 2)
if [[ $s = 12000 ]]; then echo "WVSP-c ok"; else echo "WVSP-c fail ($s)"; fi

View File

@ -1,425 +0,0 @@
#!/bin/bash
GPIO=25
#
# This script serves as a confidence check that the pipe interface to
# the pigpio library is ok.
#
# The script uses gpio 25 (pin 22). Make sure that nothing (or only a LED)
# is connected to gpio 25 before running the script.
#
# To run the script
# sudo pigpiod # if not already running
# ./x_pipe # on the Pi running pigpiod
#
# Some tests are statistical in nature and so may on occasion fail.
# Repeated failures on the same test or many failures in a group
# of tests indicate a problem.
#
echo
echo "Testing pigpio pipe I/F"
echo "pigpv" >/dev/pigpio
read -t 1 s </dev/pigout
echo "pigpio version $s"
echo "bc1 0" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "BC1 ok"; else echo "BC1 fail ($s)"; fi
echo "bc2 0" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "BC2 ok"; else echo "BC2 fail ($s)"; fi
echo "br1" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ ${#s} = 8 ]]
then echo "BR1 ok"
else echo "BR1 fail ($s)"
fi
echo "br2" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ ${#s} = 8 ]]
then echo "BR2 ok"
else echo "BR2 fail ($s)"
fi
echo "bs1 0" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "BS1 ok"; else echo "BS1 fail ($s)"; fi
echo "bs2 0" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "BS2 ok"; else echo "BS2 fail ($s)"; fi
echo "h" >/dev/pigpio
read -t 1 s </dev/pigout
read -t 1 s </dev/pigout
if [[ $s = "BC1 bits Clear GPIO in bank 1" ]]
then echo "HELP-a ok"
else echo "HELP-a fail ($s)"
fi
read -t 1 -N 9000 </dev/pigout # dump rest of help
echo "help" >/dev/pigpio
read -t 1 s </dev/pigout
read -t 1 s </dev/pigout
if [[ $s = "BC1 bits Clear GPIO in bank 1" ]]
then echo "HELP-b ok"
else echo "HELP-b fail ($s)"
fi
read -t 1 -N 9000 </dev/pigout # dump rest of help
echo "hwver" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s -ne 0 ]]; then echo "HWVER ok"; else echo "HWVER fail ($s)"; fi
echo "mics 1000" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "MICS ok"; else echo "MICS fail ($s)"; fi
echo "mils 10" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "MILS ok"; else echo "MILS fail ($s)"; fi
echo "modes $GPIO 0" >/dev/pigpio
read -t 1 s </dev/pigout
echo "modeg $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 4 ]]; then echo "MODEG ok"; else echo "MODEG fail ($s)"; fi
echo "m $GPIO r" >/dev/pigpio
read -t 1 s </dev/pigout
echo "mg $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "MODES ok"; else echo "MODES fail ($s)"; fi
echo "no" >/dev/pigpio
read -t 1 h </dev/pigout
if [[ $h -ge 0 && $h -le 31 ]]
then echo "NO($h) ok"
else echo "NO fail ($s)"
fi
echo "nb $h 0xabcd" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "NB($h) ok"; else echo "NB fail ($s)"; fi
echo "np $h" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "NP($h) ok"; else echo "NP fail ($s)"; fi
echo "nc $h" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "NC($h) ok"; else echo "NC fail ($s)"; fi
echo "pfs $GPIO 800" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 800 ]]; then echo "PFG-a ok"; else echo "PFG-a fail ($s)"; fi
echo "pfg $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 800 ]]; then echo "PFG-b ok"; else echo "PFG-b fail ($s)"; fi
echo "pfs $GPIO 0" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 10 ]]; then echo "PFS-a ok"; else echo "PFS-a fail ($s)"; fi
echo "pfs $GPIO 800" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 800 ]]; then echo "PFS-b ok"; else echo "PFS-b fail ($s)"; fi
echo "prs $GPIO 255" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 250 ]]; then echo "PRG-a ok"; else echo "PRG-a fail ($s)"; fi
echo "prg $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 255 ]]; then echo "PRG-b ok"; else echo "PRG-b fail ($s)"; fi
echo "proc ld p1 p0 ld p0 29 tag 9 mils 1000 jmp 9" >/dev/pigpio
read -t 1 p </dev/pigout
if [[ $p -ge 0 && $p -le 31 ]]
then echo "PROC($p) ok"
else echo "PROC($p) fail ($s)"
fi
sleep 0.1 # Make sure script has time to intialise.
echo "procr $p 9876" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "PROCR($p) ok"; else echo "PROCR($p) fail ($s)"; fi
echo "procp $p" >/dev/pigpio
read -t 1 -a v </dev/pigout
if [[ ${v[0]} = 2 && ${v[1]} = 29 && ${v[2]} = 9876 ]]
then echo "PROCP($p) ok"
else echo "PROCP($p) fail ($s)"
fi
echo "procs $p" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "PROCS($p) ok"; else echo "PROCS($p) fail ($s)"; fi
echo "procd $p" >/dev/pigpio
sleep 0.1
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "PROCD($p) ok"; else echo "PROCD($p) fail ($s)"; fi
echo "prrg $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 250 ]]; then echo "PRRG ok"; else echo "PRRG fail ($s)"; fi
echo "prs $GPIO 1000" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 250 ]]; then echo "PRS-a ok"; else echo "PRS-a fail ($s)"; fi
echo "prg $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 1000 ]]; then echo "PRS-b ok"; else echo "PRS-b fail ($s)"; fi
echo "prs $GPIO 255" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 250 ]]; then echo "PRS-c ok"; else echo "PRS-c fail ($s)"; fi
echo "prg $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 255 ]]; then echo "PRS-d ok"; else echo "PRS-d fail ($s)"; fi
echo "pud $GPIO u" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "PUD-a ok"; else echo "PUD-a fail ($s)"; fi
echo "r $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 1 ]]; then echo "PUD-b ok"; else echo "PUD-b fail ($s)"; fi
echo "pud $GPIO d" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "PUD-c ok"; else echo "PUD-c fail ($s)"; fi
echo "r $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "PUD-d ok"; else echo "PUD-d fail ($s)"; fi
echo "pud $GPIO o" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "PUD-e ok"; else echo "PUD-e fail ($s)"; fi
echo "p $GPIO 128" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "PWM-a ok"; else echo "PWM-a fail ($s)"; fi
echo "gdc $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 128 ]]; then echo "GDC-a ok"; else echo "GDC-a fail ($s)"; fi
echo "pwm $GPIO 64" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "PWM-b ok"; else echo "PWM-b fail ($s)"; fi
echo "GDC $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 64 ]]; then echo "GDC-b ok"; else echo "GDC-b fail ($s)"; fi
echo "pwm $GPIO 0" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "PWM-c ok"; else echo "PWM-c fail ($s)"; fi
echo "gdc $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "GDC-c ok"; else echo "GDC-c fail ($s)"; fi
echo "m $GPIO r" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "PWM-d ok"; else echo "PWM-d fail ($s)"; fi
echo "pud $GPIO u" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "READ-a ok"; else echo "READ-a fail ($s)"; fi
echo "r $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 1 ]]; then echo "READ-b ok"; else echo "READ-b fail ($s)"; fi
echo "pud $GPIO d" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "READ-c ok"; else echo "READ-c fail ($s)"; fi
echo "read $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "READ-d ok"; else echo "READ-d fail ($s)"; fi
echo "pud $GPIO o" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "READ-e ok"; else echo "READ-e fail ($s)"; fi
echo "s $GPIO 500" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "SERVO-a ok"; else echo "SERVO-a fail ($s)"; fi
echo "gpw $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 500 ]]; then echo "GPW-a ok"; else echo "GPW-a fail ($s)"; fi
echo "servo $GPIO 2500" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "SERVO-b ok"; else echo "SERVO-b fail ($s)"; fi
echo "GPW $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 2500 ]]; then echo "GPW-b ok"; else echo "GPW-b fail ($s)"; fi
echo "servo $GPIO 0" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "SERVO-c ok"; else echo "SERVO-c fail ($s)"; fi
echo "gpw $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "GPW-c ok"; else echo "GPW-c fail ($s)"; fi
echo "w $GPIO 1" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "SERVO-d ok"; else echo "SERVO-d fail ($s)"; fi
echo "wvclr" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "SLR-a ok"; else echo "SLR-a fail ($s)"; fi
echo "slro $GPIO 4800 8" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "SLR-b ok"; else echo "SLR-b fail ($s)"; fi
echo "wvas $GPIO 4800 8 2 0 0x6d 0x79 0x20 0x6e 0x61 0x6d 0x65 0x20 0x69 0x73 0x20 0x6a 0x6f 0x61 0x6e" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 95 ]]; then echo "SLR-c ok"; else echo "SLR-c fail ($s)"; fi
echo "m $GPIO w" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "SLR-d ok"; else echo "SLR-d fail ($s)"; fi
echo "wvcre" >/dev/pigpio
read -t 1 w </dev/pigout
if [[ $w -ge 0 ]]; then echo "WVCRE ok"; else echo "WVCRE fail ($w)"; fi
echo "wvtx $w" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 191 ]]; then echo "SLR-e ok"; else echo "SLR-e fail ($s)"; fi
sleep 0.4
echo "slr $GPIO 100" >/dev/pigpio
read -t 1 s </dev/pigout
e="15 109 121 32 110 97 109 101 32 105 115 32 106 111 97 110"
if [[ $s = $e ]]
then echo "SLR-f ok"
else echo "SLR-f fail with ($s)"
fi
read -t 1 s </dev/pigout # dump any junk
echo "slrc $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "SLR-g ok"; else echo "SLR-g fail ($s)"; fi
echo "t" >/dev/pigpio
echo "tick" >/dev/pigpio
read -t 1 t1 </dev/pigout
read -t 1 t2 </dev/pigout
s=$((t2-t1))
if [[ $s -gt 0 && $s -lt 5000 ]]
then echo "TICK ok"
else echo "TICK fail ($s)"
fi
pigs w $GPIO 1 # put in known state
echo "trig $GPIO 10 1" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "TRIG-a ok"; else echo "TRIG-a fail ($s)"; fi
echo "r $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "TRIG-b ok"; else echo "TRIG-b fail ($s)"; fi
echo "trig $GPIO 10 0" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "TRIG-c ok"; else echo "TRIG-c fail ($s)"; fi
echo "r $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 1 ]]; then echo "TRIG-d ok"; else echo "TRIG-d fail ($s)"; fi
echo "wdog $GPIO 1000" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "WDOG-a ok"; else echo "WDOG-a fail ($s)"; fi
echo "wdog $GPIO 0" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "WDOG-b ok"; else echo "WDOG-b fail ($s)"; fi
echo "w $GPIO 1" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "WRITE-a ok"; else echo "WRITE-a fail ($s)"; fi
echo "r $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 1 ]]; then echo "WRITE-b ok"; else echo "WRITE-b fail ($s)"; fi
echo "write $GPIO 0" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "WRITE-c ok"; else echo "WRITE-c fail ($s)"; fi
echo "r $GPIO" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "WRITE-d ok"; else echo "WRITE-d fail ($s)"; fi
echo "wvclr" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "WVCLR ok"; else echo "WVCLR fail ($s)"; fi
echo "wvas $GPIO 300 8 2 0 0x74 0x68 0x69 0x73 0x20 0x69 0x73 0x20 0x74 0x68 0x65 0x20 0x77 0x69 0x6e 0x74 0x65 0x72 0x20 0x6f 0x66 0x20 0x6d 0x79 0x20 0x64 0x69 0x73 0x63 0x6f 0x6e 0x74 0x65 0x6e 0x74" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 215 ]]; then echo "WVAS ok"; else echo "WVAS fail ($s)"; fi
echo "wvag 16 0 5000000 0 16 5000000" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 216 ]]; then echo "WVAG ok"; else echo "WVAG fail ($s)"; fi
echo "wvcre" >/dev/pigpio
read -t 1 w </dev/pigout
if [[ $w -ge 0 ]]; then echo "WVCRE ok"; else echo "WVCRE fail ($s)"; fi
echo "wvtx $w" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ ($s = 433) || ($s = 977) ]]
then echo "WVTX ok"
else echo "WVTX fail ($s)"
fi
echo "wvbsy" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 1 ]]; then echo "WVBSY-a ok"; else echo "WVBSY-a fail ($s)"; fi
sleep 1
echo "wvbsy" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 1 ]]; then echo "WVBSY-b ok"; else echo "WVBSY-b fail ($s)"; fi
echo "wvhlt" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "WVHLT ok"; else echo "WVHLT fail ($s)"; fi
echo "wvbsy" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "WVBSY-c ok"; else echo "WVBSY-c fail ($s)"; fi
echo "wvtxr $w" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ ($s = 433) || ($s = 977) ]]
then echo "WVTXR ok"
else echo "WVTXR fail ($s)"
fi
echo "wvbsy" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 1 ]]; then echo "WVBSY-d ok"; else echo "WVBSY-d fail ($s)"; fi
echo "wvhlt" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "WVHLT ok"; else echo "WVHLT fail ($s)"; fi
echo "wvbsy" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 0 ]]; then echo "WVBSY-e ok"; else echo "WVBSY-e fail ($s)"; fi
echo "wvsc 0" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ ($s = 432) || ($s = 743) ]]
then echo "WVSC-a ok"
else echo "WVSC-a fail ($s)"
fi
echo "wvsc 1" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s -ge 432 ]]; then echo "WVSC-b ok"; else echo "WVSC-b fail ($s)"; fi
echo "wvsc 2" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 25016 ]]; then echo "WVSC-c ok"; else echo "WVSC-c fail ($s)"; fi
echo "wvsm 0" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 10000000 ]]; then echo "WVSM-a ok"; else echo "WVSM-a fail ($s)"; fi
echo "wvsm 1" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s -ge 10000000 ]]; then echo "WVSM-b ok"; else echo "WVSM-b fail ($s)"; fi
echo "wvsm 2" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 1800000000 ]]
then echo "WVSM-c ok"
else echo "WVSM-c fail ($s)"
fi
echo "wvsp 0" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 216 ]]; then echo "WVSP-a ok"; else echo "WVSP-a fail ($s)"; fi
echo "wvsp 1" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s -ge 216 ]]; then echo "WVSP-b ok"; else echo "WVSP-b fail ($s)"; fi
echo "wvsp 2" >/dev/pigpio
read -t 1 s </dev/pigout
if [[ $s = 12000 ]]; then echo "WVSP-c ok"; else echo "WVSP-c fail ($s)"; fi

View File

@ -1,28 +0,0 @@
define(["module","dcl/dcl"], function(module,dcl){
return dcl(null, {
/***
* Standard callback when we have a message from the device we're bound to (specified in profile).
* 1. put the message in the incoming queue, tag it as 'unread'
* 2. in case we have messages to send and we are in 'onReply' mode, trigger outgoing queue
*
* @param data {Object} : Message Struct build by the device manager
* @param data.device {Object} : Device info
* @param data.device.host {String} : The host
* @param data.device.port {String} : The host's port
* @param data.device.protocol {String} : The host's protocol
* @param data.message {String} : RAW message, untreated
*/
onMessage:function(data){
//let driver base do its job:
this.inherited(arguments);
},
test:function(){
//send a message :
this.sendMessage('pwon',true);//sends message to device , respecting start & end settings . forcing now!
}
});
});

View File

@ -1,170 +0,0 @@
{
"inputs": [
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_NAME",
"name": "CF_DRIVER_NAME",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Display Name",
"type": 13,
"uid": "-1",
"value": "Raspberry-Driver",
"visible": true,
"changed": true,
"_active": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_ID",
"name": "CF_DRIVER_ID",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Id",
"type": 13,
"uid": "-1",
"value": "40276f07-b0a8-f6bb-56f3-124b76262d5c",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Visual",
"id": "CF_DRIVER_ICON",
"name": "CF_DRIVER_ICON",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Icon",
"type": 18,
"uid": "-1",
"value": ".\/project1\/318i.jpg",
"visible": false
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "General",
"id": "CF_DRIVER_CLASS",
"name": "CF_DRIVER_CLASS",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Driver Class",
"type": 4,
"uid": "-1",
"value": ".\/Raspberry\/Raspberry-Driver.js",
"visible": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Settings",
"id": "CommandSettings",
"name": "CF_DRIVER_COMMANDS",
"order": 1,
"params": "{\"constants\":{\"start\":\"\",\"end\":\"\"},\"send\":{\"mode\":false,\"interval\":\"300\",\"timeout\":\"500\",\"onReply\":\"\"}}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Commands",
"type": "CommandSettings",
"uid": "-1",
"value": "",
"visible": true,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Variables",
"id": "VariableSettings",
"name": "CF_DRIVER_VARIABLES",
"order": 1,
"params": null,
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Variables",
"type": 13,
"uid": "-1",
"value": "[]",
"visible": false,
"view": true
},
{
"chainType": 0,
"class": "cmx.types.ConfigurableInformation",
"dataRef": "",
"dataSource": "",
"description": null,
"enabled": true,
"enumType": "-1",
"flags": -1,
"group": "Responses",
"id": "ResponseSettings",
"name": "CF_DRIVER_RESPONSES",
"order": 1,
"params": "{\"start\":false,\"startString\":\"\",\"cTypeByte\":false,\"cTypePacket\":false,\"cTypeDelimiter\":true,\"cTypeCount\":false,\"delimiter\":\"\\\\r\",\"count\":\"\",\"wDelimiter\":\"\\\\r\",\"wCount\":\"\"}",
"parentId": "myeventsapp108",
"platform": null,
"storeDestination": "metaDataStore",
"title": "Responses",
"type": 13,
"uid": "-1",
"value": "",
"visible": false,
"view": true
}
]
}

Some files were not shown because too many files have changed in this diff Show More