-channels :: MTaskDevice -> Shared Channels
-channels d = memoryShare d.deviceChannels ([], [], False)
+instance == MTaskDevice where
+ (==) a b = a.deviceChannels == b.deviceChannels
+
+startupDevices :: Task [MTaskDevice]
+startupDevices = upd (map reset) deviceStore
+ where reset d = {d & deviceTask=Nothing, deviceTasks=[], deviceError=Nothing}
+
+withDevice :: (MTaskDevice -> Task a) String -> Task a | iTask a
+withDevice f s = get deviceStore
+ >>= \ds->case 'DL'.find (\d->d.deviceName == s) ds of
+ Nothing = throw "Device not available"
+ Just d = f d