53 | | * Test Device I/O following [https://gautric.github.io/blog/2016/03/09/rhiot-Device-IO-API-i2cdetect-impl.html these directions] |
| 53 | * Test Device I/O following [https://gautric.github.io/blog/2016/03/09/rhiot-Device-IO-API-i2cdetect-impl.html these directions] or [https://dzone.com/refcardz/iot-applications-with-java-and-raspberry-pi these]. Projects must be linked with build/jar/dio.jar and reference the appropriate policy files. For example, to run a program: |
| 54 | {{{ sudo java -Djava.security.policy=./java.policy -classpath .:./dio.jar -Djdk.dio.registry=./dio.properties DioLed }}}. An example java.policy is: |
| 55 | {{{ |
| 56 | // grant all permissions for the DIO framework |
| 57 | grant { |
| 58 | permission jdk.dio.DeviceMgmtPermission "*:*", "open"; |
| 59 | permission jdk.dio.gpio.GPIOPinPermission "*:*", "open,setdirection"; |
| 60 | permission jdk.dio.gpio.GPIOPortPermission "*:*"; |
| 61 | permission jdk.dio.i2cbus.I2CPermission "*:*"; |
| 62 | permission jdk.dio.spibus.SPIPermission "*:*"; |
| 63 | permission jdk.dio.uart.UARTPermission "*:*"; |
| 64 | }; |
| 65 | }}} |
| 66 | |