-Subproject commit 3a3cc117a5b3e9cfe8c1d0272b8af431156f118f
+Subproject commit 948f49f132f17f55b2ac49c2771df13d9aac3b48
class MTaskDuplex a where
synFun :: a (Shared Channels) -> Task ()
+withDevice :: (MTaskDevice -> Task a) String -> Task a | iTask a
+
startupDevices :: Task [MTaskDevice]
connectDevice :: (MTaskDevice (Shared Channels) -> Task ()) MTaskDevice -> Task ()
manageDevices :: (MTaskDevice (Shared Channels) -> Task ()) [MTaskDevice] -> Task ()
sendMessages :: [MTaskMSGSend] -> (MTaskDevice -> Task Channels)
-getDevice :: String -> Task MTaskDevice
withDevices :: MTaskDevice (MTaskDevice -> MTaskDevice) -> Task ()
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
+
makeDevice :: String MTaskResource -> Task MTaskDevice
makeDevice name res = get randomInt @ \rand->{MTaskDevice
|deviceChannels=name +++ toString rand
ackFirst [t:ts] = if (t.ident == -1)
[{t & ident=i}:ts] [t:ackFirst ts]
-getDevice :: String -> Task MTaskDevice
-getDevice n = get deviceStore @ fromJust o 'DL'.find (\s->s.deviceName == n)
-
deviceTaskDelete :: MTaskDevice MTaskTask -> Task ()
deviceTaskDelete dev task = sendMessages [MTTaskDel task.ident] dev @! ()
viewSharedInformation "Current value" [] (getSDSShare sh)
||- (
updateSharedInformation "New value" [] (getSDSShare sh)
- >>= \nv->allTasks (map getDevice sh.withDevice)
+ >>= \nv->allTasks (map (withDevice treturn) sh.withDevice)
>>= \devs->allTasks (map (sendMessages [MTUpd sh.identifier nv]) devs)
>>| treturn nv
)
import iTasks
import Devices.mTaskDevice
-getDeviceByName :: String -> Task MTaskDevice
channels :: MTaskDevice -> Shared Channels
import Utils.SDS
import Data.List
-getDeviceByName :: String -> Task MTaskDevice
-getDeviceByName nm = get deviceStore @ find (\d->d.deviceChannels == nm)
- >>= maybe (throw "Help, device not found") treturn
-
channels :: MTaskDevice -> Shared Channels
channels d = memoryShare d.deviceChannels ([], [], False)
void task_delete(uint8_t c)
{
debug("Going to delete task: %i", c);
- debug("mem_task: %p", mem_task);
struct task *t = task_head();
while(t != NULL){
if(t->taskid == c){
//Decrement the spacepointer
mem_task -= end-start;
}
- debug("mem_task: %p", mem_task);
}
[ viewmTasks @! ()
, whileUnchanged sdsStore manageShares
, whileUnchanged deviceStore $ manageDevices process
- ] <<@ ApplyLayout (foldr1 sequenceLayouts
+ ] <<@ ApplyLayout (sequenceLayouts
[arrangeWithSideBar 0 LeftSide 260 True
,arrangeSplit Vertical True])
where