116 reputation
3
bio website hgomersall.wordpress.com
location
age 32
visits member for 2 years, 5 months
seen Oct 7 at 12:46

Jul
10
awarded  Scholar
Jul
10
comment Constructs for wrapping a hardware state machine
This is actually how I implemented it - a wrapper around the hardware with exception handling for invalid state. Handily, the hardware interface will only hand out a given handle once (it must be liberated before it will hand it out again), so the instantiation of the class will only happen if the hardware driver lets it, so enforcing this quasi-singleton pattern. It's actually a testament to a very nice hardware API (in contrast to other APIs I've used!).
Jul
10
accepted Constructs for wrapping a hardware state machine
Jul
9
comment Constructs for wrapping a hardware state machine
This has been my thinking so far, but it seems a bit mucky. It won't actually be a singleton, as multiple hardware devices might be connected. Still, I'm beginning to suspect there is no perfect fit here.
Jul
9
comment Constructs for wrapping a hardware state machine
The problem is that the state is not trivial to establish explicitly. It's done by telling you you're in the wrong state and why you're in the wrong state (i.e. some parameter has not been set up).
Jul
9
awarded  Student
Jul
8
awarded  Editor
Jul
8
revised Constructs for wrapping a hardware state machine
deleted 6 characters in body
Jul
8
asked Constructs for wrapping a hardware state machine