summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorsailorvii <35483373+sailorvii@users.noreply.github.com>2020-11-05 21:55:08 +0800
committerGitHub <noreply@github.com>2020-11-05 21:55:08 +0800
commit90dfbd208021b1d248042335188be1d35994c7cb (patch)
treea3445d6d7cc8699da4ce9722283407bdc4e3849b /build
parentMerge pull request #2009 from shenkonghui/feat/keadm-debug-collect (diff)
downloadkubeedge-90dfbd208021b1d248042335188be1d35994c7cb.tar.gz
Modbus mapper refactor (#2282)
* Add modbus mapper. * Add modbus mapper. * Address comments. 1. Set client to each RTU port instead of each RTU device. 2. Add README 3. Refine the dockerfile * Refine device instance & model example files. * Fix verify and lint issues. * Address lint & verify issues. * Add license * Remove whitenoise * Fix error * Address lint errors * Refine as the Fisher's comment * Remove serial license * Add more license * Address conflict
Diffstat (limited to 'build')
-rw-r--r--build/crd-samples/devices/modbus-device-model.yaml21
-rw-r--r--build/crd-samples/devices/modbusrtu-device-instance.yaml60
-rw-r--r--build/crd-samples/devices/modbustcp-device-instance.yaml56
3 files changed, 137 insertions, 0 deletions
diff --git a/build/crd-samples/devices/modbus-device-model.yaml b/build/crd-samples/devices/modbus-device-model.yaml
new file mode 100644
index 000000000..4da63b518
--- /dev/null
+++ b/build/crd-samples/devices/modbus-device-model.yaml
@@ -0,0 +1,21 @@
+apiVersion: devices.kubeedge.io/v1alpha2
+kind: DeviceModel
+metadata:
+ name: modbus-sample-model
+ namespace: default
+spec:
+ properties:
+ - name: temperature
+ description: temperature in degree celsius
+ type:
+ int:
+ accessMode: ReadWrite
+ maximum: 100
+ unit: degree celsius
+ - name: temperature-enable
+ description: enable data collection of temperature sensor
+ type:
+ int:
+ accessMode: ReadWrite
+ defaultValue: 1
+
diff --git a/build/crd-samples/devices/modbusrtu-device-instance.yaml b/build/crd-samples/devices/modbusrtu-device-instance.yaml
new file mode 100644
index 000000000..db64b758c
--- /dev/null
+++ b/build/crd-samples/devices/modbusrtu-device-instance.yaml
@@ -0,0 +1,60 @@
+apiVersion: devices.kubeedge.io/v1alpha2
+kind: Device
+metadata:
+ name: modbusrtu-device
+ labels:
+ description: TISimplelinkSensorTag
+ manufacturer: TexasInstruments
+ model: CC2650
+spec:
+ deviceModelRef:
+ name: modbus-sample-model
+ protocol:
+ modbus:
+ slaveID: 1
+ common:
+ com:
+ serialPort: '/dev/ttyS0'
+ baudRate: 9600
+ dataBits: 8
+ parity: even
+ stopBits: 1
+ customizedValues:
+ serialType: "RS232"
+ nodeSelector:
+ nodeSelectorTerms:
+ - matchExpressions:
+ - key: ''
+ operator: In
+ values:
+ - test
+ propertyVisitors:
+ - propertyName: temperature
+ modbus:
+ register: CoilRegister
+ offset: 2
+ limit: 1
+ scale: 1
+ isSwap: true
+ isRegisterSwap: true
+ - propertyName: temperature-enable
+ modbus:
+ register: CoilRegister
+ offset: 3
+ limit: 1
+ scale: 1.0
+ isSwap: true
+ isRegisterSwap: true
+status:
+ twins:
+ - propertyName: temperature-enable
+ reported:
+ metadata:
+ timestamp: '1550049403598'
+ type: integer
+ value: "1"
+ desired:
+ metadata:
+ timestamp: '1550049403598'
+ type: integer
+ value: "1"
diff --git a/build/crd-samples/devices/modbustcp-device-instance.yaml b/build/crd-samples/devices/modbustcp-device-instance.yaml
new file mode 100644
index 000000000..02f0b2806
--- /dev/null
+++ b/build/crd-samples/devices/modbustcp-device-instance.yaml
@@ -0,0 +1,56 @@
+apiVersion: devices.kubeedge.io/v1alpha2
+kind: Device
+metadata:
+ name: modbustcp-device
+ labels:
+ description: TISimplelinkSensorTag
+ manufacturer: TexasInstruments
+ model: CC2650
+spec:
+ deviceModelRef:
+ name: modbus-sample-model
+ protocol:
+ modbus:
+ slaveID: 1
+ common:
+ tcp:
+ ip: "192.168.33.1"
+ port: 502
+ nodeSelector:
+ nodeSelectorTerms:
+ - matchExpressions:
+ - key: ''
+ operator: In
+ values:
+ - test
+ propertyVisitors:
+ - propertyName: temperature
+ modbus:
+ register: CoilRegister
+ offset: 0
+ limit: 1
+ scale: 1
+ isSwap: true
+ isRegisterSwap: true
+ collectCycle: 5000
+ - propertyName: temperature-enable
+ modbus:
+ register: CoilRegister
+ offset: 3
+ limit: 1
+ scale: 1.0
+ isSwap: true
+ isRegisterSwap: true
+status:
+ twins:
+ - propertyName: temperature-enable
+ reported:
+ metadata:
+ timestamp: '1550049403598'
+ type: integer
+ value: "0"
+ desired:
+ metadata:
+ timestamp: '1550049403598'
+ type: integer
+ value: "0"