Git Product home page Git Product logo

wsn-device-drivers's People

Contributors

amaier avatar bzld avatar danbim avatar fkausche avatar maick-danckwardt avatar schuett avatar tbabel avatar tteubler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wsn-device-drivers's Issues

Refactor the GenericDeviceExample

Cause this class is grown with the project and was only designed for testing. This should be refactored in something like a DeviceExampleBuilder. That allows more control over the device example creation.

Reduce number of threads per device

Currently, each device driver instance uses 3 threads to do its work. There should be only the (necessary) RXTX thread and one (ideally shared) instance of some scheduler thread of a ScheduledExecutorService instance that is passed to the various classes which can be used to execute logic and handle user or device events.

Use TimeLimiter instead of Timer for timeout management

This has several advantages:

  1. You can set the Executor for the TimeLimiter that would allow to set maximum thread amout for the whole application which is optimal for embedded devices. See issue #11
  2. There is no more PausableThreadExecutor necessary, cause the operation can be canceled inside the Operation instead outside of it. This will make several classes unnecessary.
  3. The TimeLimiter can be injected, which allows to set the ExecutorService.

<3 Google Guava ;)

Guicefy the Drivers

Devide the components in such a way that you can define a device as a GuiceModule. This should allow to remove the Device Interface, cause the factories are provided by guice, allow a much better loosely coppling and hopefully a better testability ;)

Flashing fails for iSense node

I tried to flash an isense node using the flash utitlity from http://github.com/itm/wsn-device-utils/. It failed with the following errors:

java -jar wsn-device-utils-0.3-SNAPSHOT-flash.jar isense /dev/ttyUSB2 vlinks.bin 
myJarPath=file:/home/testbeduzl/wsn-device-utils-0.3-SNAPSHOT-flash.jar
oneJarPath=file:/home/testbeduzl/wsn-device-utils-0.3-SNAPSHOT-flash.jar
Experimental:  JNI_OnLoad called.
RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyUSB2
2011-05-12 09:37:49,271 | pool-1-thread-1           | DeviceFlasherCLI$1        | INFO  | Starting flash operation...
2011-05-12 09:37:49,294 | pool-1-thread-1           | DeviceFlasherCLI$1        | INFO  | Progress: 0%
2011-05-12 09:37:49,496 | pool-1-thread-1           | DeviceFlasherCLI$1        | INFO  | Progress: 1%
2011-05-12 09:37:49,698 | pool-1-thread-1           | DeviceFlasherCLI$1        | INFO  | Progress: 2%
2011-05-12 09:37:49,900 | pool-1-thread-1           | DeviceFlasherCLI$1        | INFO  | Progress: 3%
2011-05-12 09:37:49,910 | pool-1-thread-1           | DeviceFlasherCLI$1        | INFO  | Progress: 4%
2011-05-12 09:37:49,913 | pool-1-thread-1           | DeviceFlasherCLI$1        | INFO  | Progress: 6%
2011-05-12 09:37:49,917 | pool-1-thread-1           | AbstractOperation         | ERROR | Exception during operation execution
de.uniluebeck.itm.wsn.drivers.core.exception.InvalidChecksumException
    at de.uniluebeck.itm.wsn.drivers.jennic.JennicDevice.receiveBootLoaderReply(JennicDevice.java:281)
    at de.uniluebeck.itm.wsn.drivers.jennic.JennicGetChipTypeOperation.getChipType(JennicGetChipTypeOperation.java:54)
    at de.uniluebeck.itm.wsn.drivers.jennic.JennicGetChipTypeOperation.execute(JennicGetChipTypeOperation.java:106)
    at de.uniluebeck.itm.wsn.drivers.jennic.JennicGetChipTypeOperation.execute(JennicGetChipTypeOperation.java:14)
    at de.uniluebeck.itm.wsn.drivers.core.operation.AbstractOperation.executeSubOperation(AbstractOperation.java:178)
    at de.uniluebeck.itm.wsn.drivers.jennic.JennicProgramOperation.execute(JennicProgramOperation.java:78)
    at de.uniluebeck.itm.wsn.drivers.jennic.JennicProgramOperation.execute(JennicProgramOperation.java:12)
    at de.uniluebeck.itm.wsn.drivers.core.operation.AbstractOperation.call(AbstractOperation.java:116)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
    2011-05-12 09:37:49,921 | pool-1-thread-1           | DeviceFlasherCLI$1        | ERROR | Flashing node failed with  Exception:     de.uniluebeck.itm.wsn.drivers.core.exception.InvalidChecksumException
de.uniluebeck.itm.wsn.drivers.core.exception.InvalidChecksumException
    at de.uniluebeck.itm.wsn.drivers.jennic.JennicDevice.receiveBootLoaderReply(JennicDevice.java:281)
    at de.uniluebeck.itm.wsn.drivers.jennic.JennicGetChipTypeOperation.getChipType(JennicGetChipTypeOperation.java:54)
    at de.uniluebeck.itm.wsn.drivers.jennic.JennicGetChipTypeOperation.execute(JennicGetChipTypeOperation.java:106)
    at de.uniluebeck.itm.wsn.drivers.jennic.JennicGetChipTypeOperation.execute(JennicGetChipTypeOperation.java:14)
    at de.uniluebeck.itm.wsn.drivers.core.operation.AbstractOperation.executeSubOperation(AbstractOperation.java:178)
    at de.uniluebeck.itm.wsn.drivers.jennic.JennicProgramOperation.execute(JennicProgramOperation.java:78)
    at de.uniluebeck.itm.wsn.drivers.jennic.JennicProgramOperation.execute(JennicProgramOperation.java:12)
    at de.uniluebeck.itm.wsn.drivers.core.operation.AbstractOperation.call(AbstractOperation.java:116)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)

Make Factory to create Device instances

The factory receives two parameters type and port of either an enum type or a String which can be mapped to the enum type and creates the appropriate instance.

Inject TimeLimiter via constructor

The TimeLimiter can be shared between all operations. A singlethreadExecutor is enough. The shutdown of this executor can be done manual externally.

Remove the shutdown method from OperationQueue

ExecutorService you want to shutdown manually should be given as constructor arguments. Default ExecutorService initialisation can be kept. See for example the SimpleTimeLimiter, which initializes an internal CachedThreadExecutor but has no method for a shutdown.

Use device.shutdown() instead of connection.shutdown()

Device interface should include a shutdown() method that should be used instead of connection.shutdown() or Closeables.closeQuietly(Connection) when deleting the device.

  • A non-multiplexed device should clean itself and then call connection.shutdown() to close the real serial port.
  • A multiplexed device should remove ifself from the demultiplexer routing table, clean itself, and then check if there is any other device in the routing table listening to the real serial port and, if empty, call connection.shutdown() to close it.

Split up the AbstractOperation in a Container and the Operation

An Operation currently contains the operation itselfs and the whole lifecycle. The lifecycle of an operation should separated. This reduces the code and can make the AbstractOperation not anymore necessary. So you can create a operation by only implementing an interface instead of extending a class.

This will introduce a OperationContainer, OperationContainerFactory, OperationContext (for accessing the container from the operation, e.g. for canceling an operation).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.