(name, type, description)
| 18 | |
| 19 | class PlayPHatThing extends Thing { |
| 20 | constructor(name, type, description) { |
| 21 | super('urn:dev:ops:my-play-phat-1234', |
| 22 | name || 'PlayPHat', |
| 23 | type || [], |
| 24 | description || 'A web connected Play RaspberryPi Hat'); |
| 25 | const self = this; |
| 26 | this.gpioProperties = [ |
| 27 | new GpioProperty(this, 'Left', false, |
| 28 | {description: |
| 29 | 'SW1 Sensor Button on GPIO4 (Pin7)'}, |
| 30 | {direction: 'in', pin: 4}), |
| 31 | new GpioProperty(this, 'Right', false, |
| 32 | {description: |
| 33 | 'SW2 Sensor button on GPIO17 (Pin11)'}, |
| 34 | {direction: 'in', pin: 17}), |
| 35 | new GpioProperty(this, 'Up', false, |
| 36 | {description: |
| 37 | 'SW3 Sensor button on GPIO22 (Pin15)'}, |
| 38 | {direction: 'in', pin: 22}), |
| 39 | new GpioProperty(this, 'Down', false, |
| 40 | {description: |
| 41 | 'SW4 Sensor button on GPIO27 (Pin13)'}, |
| 42 | {direction: 'in', pin: 27}), |
| 43 | new GpioProperty(this, 'A', false, |
| 44 | {description: |
| 45 | 'SW5 Sensor button on GPIO19 (Pin35)'}, |
| 46 | {direction: 'in', pin: 19}), |
| 47 | new GpioProperty(this, 'B', false, |
| 48 | {description: |
| 49 | 'SW6 Sensor button on GPIO26 (Pin37)'}, |
| 50 | {direction: 'in', pin: 26}), |
| 51 | new GpioProperty(this, 'Start', false, |
| 52 | {description: |
| 53 | 'SW7 Sensor button on GPIO5 (Pin29)'}, |
| 54 | {direction: 'in', pin: 5}), |
| 55 | new GpioProperty(this, 'Select', false, |
| 56 | {description: |
| 57 | 'SW8 Sensor button on GPIO6 (Pin31)'}, |
| 58 | {direction: 'in', pin: 6}), |
| 59 | ]; |
| 60 | this.gpioProperties.forEach((property) => { |
| 61 | self.addProperty(property); |
| 62 | }); |
| 63 | } |
| 64 | |
| 65 | close() { |
| 66 | this.gpioProperties.forEach((property) => { |
nothing calls this directly
no test coverage detected