The receiver is a component which allows the communication between different interactive process or between different devices (For example from Timer device to Menu device) by user defined message events
There are two kinds of receivers:
Uni-directional (defined as Receiver type) receivers cannot respond to messages;
Bi-directional (defined as Receiver2 type) receivers respond to messages and return a result.
data Receiver m ls ps = Receiver (RId m) (ReceiverFunction m ls ps) [ReceiverAttribute ls ps] type ReceiverFunction m ls ps = m -> GUIFun ls ps data Receiver2 m r ls ps = Receiver2 (R2Id m r) (Receiver2Function m r ls ps) [ReceiverAttribute ls ps] type Receiver2Function m r ls ps = m -> (ls,ps) -> GUI ps (r,(ls,ps)) data ReceiverAttribute ls ps -- Default: = ReceiverInit (GUIFun ls ps) -- no actions after opening receiver | ReceiverSelectState SelectState -- receiver Able class Receivers rdef where openReceiver :: ls -> rdef ls ps -> ps -> GUI ps ps instance Receiver (Receiver m) instance Receiver (Receiver2 m r) closeReceiver :: Id -> GUI ps () getReceivers :: GUI ps [Id] enableReceivers :: [Id] -> GUI ps () disableReceivers :: [Id] -> GUI ps () getReceiverSelectState :: Id -> GUI ps (Maybe SelectState) asyncSend :: RId msg -> msg -> GUI ps () syncSend :: RId msg -> msg -> ps -> GUI ps ps syncSend2 :: R2Id msg resp -> msg -> ps -> GUI ps (resp,ps)
Receivers can be created Receivers
class. This allows user to define his/her own receiver types
instead of built-in types
closeReceiver
closes the receiver with the specified id
getReceivers
returns the list of all existing receivers for an active process
enableReceivers
enables message handling for the specified receivers
disableReceivers
disables message handling for the specified receivers
getReceiverSelectState
returns the current select state for the specified receiver.
asyncSend
sends an asynchronous message to the receiver.
syncSend
sends a synchronous message to the receiver.
syncSend2
sends a synchronous message to the bi-receiver and returns the response from the receiver message handler.