Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mart Lubbers
CleanSerial
Commits
cb126d17
Commit
cb126d17
authored
Jun 28, 2018
by
Mart Lubbers
Browse files
Merge branch 'master' into 'master'
serialSyncChannel ticker is parameterized See merge request
!3
parents
cc48e634
e5dd13df
Changes
2
Hide whitespace changes
Inline
Side-by-side
iTasksTTY.dcl
View file @
cb126d17
...
...
@@ -17,4 +17,4 @@ derive class iTask TTYSettings
* @result Task that stops when the stop flag is set
* @throws TTYException
*/
syncSerialChannel
::
TTYSettings
(
b
->
String
)
(
String
->
(
Either
String
[
a
],
String
))
(
Shared
([
a
],[
b
],
Bool
))
->
Task
()
|
iTask
a
&
iTask
b
syncSerialChannel
::
Timespec
TTYSettings
(
b
->
String
)
(
String
->
(
Either
String
[
a
],
String
))
(
Shared
([
a
],[
b
],
Bool
))
->
Task
()
|
iTask
a
&
iTask
b
iTasksTTY.icl
View file @
cb126d17
...
...
@@ -30,10 +30,10 @@ import iTasks.Internal.TaskEval
derive
class
iTask
TTYSettings
,
Parity
,
BaudRate
,
ByteSize
syncSerialChannel
::
TTYSettings
(
b
->
String
)
(
String
->
(
Either
String
[
a
],
String
))
(
Shared
([
a
],[
b
],
Bool
))
->
Task
()
|
iTask
a
&
iTask
b
syncSerialChannel
opts
enc
dec
rw
=
withShared
""
\
sh
->
Task
$
eval
sh
syncSerialChannel
::
Timespec
TTYSettings
(
b
->
String
)
(
String
->
(
Either
String
[
a
],
String
))
(
Shared
([
a
],[
b
],
Bool
))
->
Task
()
|
iTask
a
&
iTask
b
syncSerialChannel
poll
opts
enc
dec
rw
=
Task
eval
where
eval
sh
event
evalOpts
tree
=:(
TCInit
taskId
ts
)
iworld
eval
event
evalOpts
tree
=:(
TCInit
taskId
ts
)
iworld
#
(
mtty
,
iworld
=:{
world
,
resources
})
=
getResource
iworld
=
case
mtty
of
[]
=
case
TTYopen
opts
iworld
.
world
of
...
...
@@ -51,7 +51,7 @@ where
,
iworld
)
_
=
(
exc
"This tty was already open"
,
iworld
)
eval
_
_
_
tree
=:(
TCBasic
taskId
ts
(
DeferredJSONNode
(
JSONString
acc
))
_)
iworld
eval
_
_
tree
=:(
TCBasic
taskId
ts
(
DeferredJSONNode
(
JSONString
acc
))
_)
iworld
#
(
mtty
,
iworld
)
=
getResource
iworld
=
case
mtty
of
[]
=
(
exc
"TTY resource lost"
,
iworld
)
...
...
@@ -88,7 +88,7 @@ where
(
TCBasic
taskId
ts
(
DeferredJSONNode
$
JSONString
newacc
)
False
)
,
iworld
)
eval
_
event
evalOpts
tree
=:(
TCDestroy
_)
iworld
=:{
IWorld
|
resources
,
world
}
eval
event
evalOpts
tree
=:(
TCDestroy
_)
iworld
=:{
IWorld
|
resources
,
world
}
#
(
mtty
,
iworld
)
=
getResource
iworld
=
case
mtty
of
[]
=
(
exc
"This tty was already closed"
,
iworld
)
...
...
@@ -100,7 +100,7 @@ where
=
(
DestroyedResult
,
iworld
)
rep
=
ReplaceUI
$
stringDisplay
$
"Serial client "
<+++
opts
.
devicePath
ticker
=
sdsFocus
{
start
=
zero
,
interval
=
zero
}
iworldTimespec
ticker
=
sdsFocus
{
start
=
zero
,
interval
=
poll
}
iworldTimespec
getResource
=
iworldResource
(\
t
=:(
TTYd
p
_)->(
p
==
opts
.
devicePath
,
t
))
exc
=
ExceptionResult
o
exception
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment