Commit f19e7825 authored by Mart Lubbers's avatar Mart Lubbers

organize

parent 1e4560f3
......@@ -2,22 +2,44 @@ definition module TTY
from StdClass import class zero
/**
* TTY handle
*/
:: *TTY (:== Int)
/**
* Possible byte sizes
*/
:: ByteSize = BytesizeFive | BytesizeSix | BytesizeSeven | BytesizeEight
/**
* Possible parity settings
*/
:: Parity = ParityNone | ParityOdd | ParityEven | ParitySpace | ParityMark
/**
* Possible baudrates
*/
:: BaudRate = B0 | B50 | B75 | B110 | B134 | B150 | B200 | B300 | B600 |
B1200 | B1800 | B2400 | B4800 | B9600 | B19200 | B38400 | B57600 |
B115200 | B230400
/**
* Serial device settings
*/
:: TTYSettings = {
devicePath :: String,
//* Path of the device, e.g. /dev/ttyACM0
baudrate :: BaudRate,
//* Baudrate
bytesize :: ByteSize,
//* Parity
parity :: Parity,
//* stop2bits
stop2bits :: Bool,
//* xonxoff flow control
xonxoff :: Bool,
//Set this to 2 if you want to connect to a borked arduino
//* Time in seconds to wait after opening the devices. Set this to 2 if you want to connect to a borked arduino
sleepTime :: Int
}
......@@ -26,9 +48,9 @@ instance zero TTYSettings
/**
* Returns a list of tty devices. This list is not conclusive but just checks familiar names.
*
* @param The world
* @result The list of detected devices
* @result The updated world
* @param world
* @result list of detected devices
* @result new world
*/
getTTYDevices :: !*World -> *(![String], !*World)
......
implementation module TTY
import StdFunc, StdBool
import StdList
import StdEnv
import System.OS
import Text
import StdArray
import StdClass
import StdString
import StdChar
import Platform
import code from "ctty."
......
definition module iTasksTTY
from iTasks.Internal.Generic.Visualization import generic gText, :: TextFormat
from iTasks.SDS.Definition import :: SDS, :: Shared, :: RWShared
from iTasks.UI.Editor.Generic import generic gEditor, :: Editor
from iTasks.WF.Definition import :: Task
from iTasks.WF.Definition import class iTask
from Data.GenDefault import generic gDefault
from Data.GenEq import generic gEq
from Data.Maybe import :: Maybe
from Data.Either import :: Either
from Text.GenJSON import generic JSONEncode, generic JSONDecode, :: JSONNode
from System.Time import :: Timespec
from TTY import :: TTYSettings
import iTasks
derive class iTask TTYSettings
......
implementation module iTasksTTY
import System.OS
import TTY
import StdEnv
import StdList
from StdFunc import o, flip
import StdMisc
import StdString
import Data.List
import qualified Data.Map as DM
import Data.Func
import Text
import System.Directory
import iTasks
import Data.Tuple
import Control.Applicative
from Data.Func import $
from Text import class Text(startsWith), instance Text String
import iTasks.UI.Definition
import iTasks.Internal.IWorld
import iTasks.Internal.TaskState
import iTasks.Internal.Task
import iTasks.Internal.SDS
import iTasks.Internal.TaskServer
import iTasks.Internal.TaskEval
import iTasks.Internal.TaskState
import TTY
:: *Resource | TTYd String *TTY
......@@ -76,7 +63,7 @@ where
| isError merr = (exc (fromError merr), iworld)
# iworld = {iworld & resources=[TTYd dp tty:iworld.resources]}
= case dec (acc +++ toString (fromOk merr)) of
(Left err, newacc) = (exc "Error while parsing", iworld)
(Left err, newacc) = (exc ("Error while parsing: " +++ join " " [toString (toInt c)\\c<-:acc+toString (fromOk merr)]), iworld)
(Right msgs, newacc)
# (merr, iworld) = if (msgs =: [] && s =: [])
(Ok (), iworld)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment