Avoid more continuation confusion
This commit is contained in:
parent
9139fc8644
commit
6dccd4ce9e
|
@ -36,13 +36,21 @@ def main(args):
|
|||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
@dataspace.during(config, P.bind(P.quote(userSettings.Command(P.u_, P.u_))))
|
||||
def handle_command(c):
|
||||
c = userSettings.Command.try_decode(c)
|
||||
if c is None: return
|
||||
c.action._accept({
|
||||
def perform_action(action):
|
||||
action._accept({
|
||||
'assert': assert_item,
|
||||
'retract': retract_item,
|
||||
})
|
||||
if c.reply.VARIANT.name == 'replyWanted':
|
||||
turn.publish(c.reply.value, userSettings.CommandReply())
|
||||
|
||||
@dataspace.during(config, P.bind(P.quote(userSettings.CommandRPC(P.u_, P.u_))))
|
||||
def handle_command_rpc(c):
|
||||
c = userSettings.CommandRPC.try_decode(c)
|
||||
if c is None: return
|
||||
perform_action(c.action)
|
||||
turn.publish(c.reply, userSettings.CommandReply())
|
||||
|
||||
@dataspace.on_message(config, P.bind(P.quote(userSettings.CommandEvent(P.u_))))
|
||||
def handle_command_event(c):
|
||||
c = userSettings.CommandEvent.try_decode(c)
|
||||
if c is None: return
|
||||
perform_action(c.action)
|
||||
|
|
|
@ -18,6 +18,8 @@ call-state
|
|||
AnswerCall´³rec´³lit³answer-call„´³tupleµ´³named³callId´³atom³
SignedInteger„„„„„³
|
||||
NumberType´³orµµ±unknown´³lit³unknown„„µ±
international´³lit³
international„„µ±national´³lit³national„„µ±gsm0338´³lit³gsm0338„„„„³PeerRinging´³rec´³lit³peer-ringing„´³tupleµ„„„³SmsDelivery´³rec´³lit³sms-delivery„´³tupleµ´³named³smsc´³refµ„³Address„„´³named³peer´³refµ„³Address„„´³named³ timestamp´³refµ³time„³Stamp„„´³named³body´³atom³String„„„„„³ModemPresent´³rec´³lit³modem„´³tupleµ´³named³type´³atom³Symbol„„´³named³
|
||||
devicePath´³atom³String„„´³named³ dataspace´³embedded³any„„„„„³PhoneRinging´³rec´³lit³
phone-ringing„´³tupleµ„„„³ReleaseCause´³orµµ±unassignedNumber´³lit³unassignedNumber„„µ±normal´³lit³normal„„µ±busy´³lit³busy„„µ±noUserResponding´³lit³noUserResponding„„µ±callRejected´³lit³callRejected„„µ±destinationOutOfOrder´³lit³destinationOutOfOrder„„µ±normalUnspecified´³lit³normalUnspecified„„µ±incompatibleDestination´³lit³incompatibleDestination„„„„³Speakerphone´³rec´³lit³speakerphone„´³tupleµ„„„³
CallDirection´³orµµ±mo´³lit³mo„„µ±mt´³lit³mt„„„„³CallIdSelector´³orµµ±specificCall´³atom³
SignedInteger„„µ±allCalls´³lit³all„„„„³CallInProgress´³rec´³lit³call-in-progress„´³tupleµ„„„³DisconnectCall´³rec´³lit³disconnect-call„´³tupleµ´³named³callId´³refµ„³CallIdSelector„„´³named³cause´³refµ„³ReleaseCause„„„„„³SmsTransmission´³rec´³lit³sms-transmission„´³tupleµ´³named³smsc´³refµ„³Address„„´³named³peer´³refµ„³Address„„´³named³body´³atom³String„„´³named³continuation´³embedded´³lit³ok„„„„„„„³embeddedType€„„µ³soundEffects„´³schema·³version‘³definitions·³
|
||||
AlertSound´³rec´³lit³alert-sound„´³tupleµ´³named³data´³refµ³mime„³Value„„„„„³ContinuousSound´³rec´³lit³continuous-sound„´³tupleµ´³named³data´³refµ³mime„³Value„„„„„³AlertSoundPlaying´³rec´³lit³alert-sound-playing„´³tupleµ„„„³ContinuousSoundPlaying´³rec´³lit³continuous-sound-playing„´³tupleµ„„„„³embeddedType€„„µ³userSettings„´³schema·³version‘³definitions·³Value´³rec´³lit³user-setting„´³tupleµ´³named³item³any„„„„³Action´³orµµ±assert´³rec´³lit³assert„´³tupleµ´³named³item³any„„„„„µ±retract´³rec´³lit³retract„´³tupleµ´³named³item³any„„„„„„„³Command´³rec´³lit³user-settings-command„´³tupleµ´³named³action´³refµ„³Action„„´³named³reply´³refµ„³CommandContinuation„„„„„³CommandReply´³lit³done„³CommandContinuation´³orµµ±replyWanted´³embedded´³refµ„³CommandReply„„„µ±
fireAndForget´³lit€„„„„„³embeddedType€„„µ³usersAndGroups„´³schema·³version‘³definitions·³Spec´³orµµ±userAccount´³lit³user„„µ±
systemAccount´³lit³system„„µ±id´³atom³
SignedInteger„„„„³Group´³rec´³lit³grent„´³tupleµ´³dict·³gid´³named³gid´³atom³
SignedInteger„„³name´³named³name´³atom³String„„„„„„„³Account´³rec´³lit³pwent„´³tupleµ´³dict·³gid´³named³gid´³atom³
SignedInteger„„³uid´³named³uid´³atom³
SignedInteger„„³home´³named³home´³atom³String„„³info´³named³info´³atom³String„„³name´³named³name´³atom³String„„³shell´³named³shell´³atom³String„„„„„„„³EnsureGroup´³rec´³lit³ensure-group„´³tupleµ´³named³name´³atom³String„„´³named³spec´³refµ„³Spec„„„„„³GroupMember´³rec´³lit³group-member„´³tupleµ´³named³uid´³atom³
SignedInteger„„´³named³gid´³atom³
SignedInteger„„„„„³
EnsureAccount´³rec´³lit³ensure-account„´³tupleµ´³named³name´³atom³String„„´³named³spec´³refµ„³Spec„„„„„„³embeddedType€„„µ³samsungGalaxyS7„´³schema·³version‘³definitions·³ FmtPacket´³rec´³lit³fmt„´³tupleµ´³named³body´³embedded³any„„„„„³ RfsPacket´³rec´³lit³rfs„´³tupleµ´³named³body´³embedded³any„„„„„³ModemPacket´³orµµ±in´³rec´³lit³
|
||||
from-modem„´³tupleµ´³named³packet³any„„„„„µ±out´³rec´³lit³to-modem„´³tupleµ´³named³packet³any„„„„„„„³ModemPresent´³rec´³lit³modem„´³tupleµ´³lit³samsung-galaxy-s7„´³named³
|
||||
devicePath´³atom³String„„´³named³ dataspace´³embedded´³refµ„³InternalProtocol„„„„„„³ExecuteCommand´³rec´³lit³execute-command„´³tupleµ´³named³command´³refµ„³ FmtPacket„„´³named³replyTo´³refµ„³CommandContinuation„„„„„³InternalProtocol³any³CommandContinuation´³orµµ±replyWanted´³embedded´³refµ„³ FmtPacket„„„µ±
fireAndForget´³lit€„„„„„³embeddedType€„„„„
|
||||
AlertSound´³rec´³lit³alert-sound„´³tupleµ´³named³data´³refµ³mime„³Value„„„„„³ContinuousSound´³rec´³lit³continuous-sound„´³tupleµ´³named³data´³refµ³mime„³Value„„„„„³AlertSoundPlaying´³rec´³lit³alert-sound-playing„´³tupleµ„„„³ContinuousSoundPlaying´³rec´³lit³continuous-sound-playing„´³tupleµ„„„„³embeddedType€„„µ³userSettings„´³schema·³version‘³definitions·³Value´³rec´³lit³user-setting„´³tupleµ´³named³item³any„„„„³Action´³orµµ±assert´³rec´³lit³assert„´³tupleµ´³named³item³any„„„„„µ±retract´³rec´³lit³retract„´³tupleµ´³named³item³any„„„„„„„³
|
||||
CommandRPC´³rec´³lit³user-settings-command„´³tupleµ´³named³action´³refµ„³Action„„´³named³reply´³embedded´³refµ„³CommandReply„„„„„„³CommandEvent´³rec´³lit³user-settings-command„´³tupleµ´³named³action´³refµ„³Action„„„„„³CommandReply´³lit³done„„³embeddedType€„„µ³usersAndGroups„´³schema·³version‘³definitions·³Spec´³orµµ±userAccount´³lit³user„„µ±
systemAccount´³lit³system„„µ±id´³atom³
SignedInteger„„„„³Group´³rec´³lit³grent„´³tupleµ´³dict·³gid´³named³gid´³atom³
SignedInteger„„³name´³named³name´³atom³String„„„„„„„³Account´³rec´³lit³pwent„´³tupleµ´³dict·³gid´³named³gid´³atom³
SignedInteger„„³uid´³named³uid´³atom³
SignedInteger„„³home´³named³home´³atom³String„„³info´³named³info´³atom³String„„³name´³named³name´³atom³String„„³shell´³named³shell´³atom³String„„„„„„„³EnsureGroup´³rec´³lit³ensure-group„´³tupleµ´³named³name´³atom³String„„´³named³spec´³refµ„³Spec„„„„„³GroupMember´³rec´³lit³group-member„´³tupleµ´³named³uid´³atom³
SignedInteger„„´³named³gid´³atom³
SignedInteger„„„„„³
EnsureAccount´³rec´³lit³ensure-account„´³tupleµ´³named³name´³atom³String„„´³named³spec´³refµ„³Spec„„„„„„³embeddedType€„„µ³samsungGalaxyS7„´³schema·³version‘³definitions·³ FmtPacket´³rec´³lit³fmt„´³tupleµ´³named³body´³embedded³any„„„„„³ RfsPacket´³rec´³lit³rfs„´³tupleµ´³named³body´³embedded³any„„„„„³
|
||||
CommandRPC´³rec´³lit³execute-command„´³tupleµ´³named³command´³refµ„³ FmtPacket„„´³named³replyTo´³embedded´³refµ„³ FmtPacket„„„„„„³ModemPacket´³orµµ±in´³rec´³lit³
|
||||
from-modem„´³tupleµ´³named³packet³any„„„„„µ±out´³rec´³lit³to-modem„´³tupleµ´³named³packet³any„„„„„„„³CommandEvent´³rec´³lit³execute-command„´³tupleµ´³named³commandText´³refµ„³ FmtPacket„„„„„³ModemPresent´³rec´³lit³modem„´³tupleµ´³lit³samsung-galaxy-s7„´³named³
|
||||
devicePath´³atom³String„„´³named³ dataspace´³embedded´³refµ„³InternalProtocol„„„„„„³InternalProtocol³any„³embeddedType€„„„„
|
|
@ -14,5 +14,6 @@ FmtPacket = <fmt @body #!any> .
|
|||
RfsPacket = <rfs @body #!any> .
|
||||
|
||||
; Assertion. Asks the modem to execute the given command.
|
||||
ExecuteCommand = <execute-command @command FmtPacket @replyTo CommandContinuation> .
|
||||
CommandContinuation = @replyWanted #!FmtPacket / @fireAndForget #f .
|
||||
CommandRPC = <execute-command @command FmtPacket @replyTo #!FmtPacket> .
|
||||
; Message. Asks the modem to execute the given command, but not to send back the reply.
|
||||
CommandEvent = <execute-command @commandText FmtPacket> .
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
version 1 .
|
||||
|
||||
; Assertion.
|
||||
Command = <user-settings-command @action Action @reply CommandContinuation> .
|
||||
CommandContinuation = @replyWanted #!CommandReply / @fireAndForget #f .
|
||||
CommandRPC = <user-settings-command @action Action @reply #!CommandReply> .
|
||||
; Message.
|
||||
CommandEvent = <user-settings-command @action Action> .
|
||||
|
||||
CommandReply = =done .
|
||||
Action = <assert @item any> / <retract @item any> .
|
||||
|
||||
|
|
Loading…
Reference in New Issue