diff --git a/packaging/packages/synit-config/files/usr/lib/synit/python/synit/daemon/user_settings_daemon.py b/packaging/packages/synit-config/files/usr/lib/synit/python/synit/daemon/user_settings_daemon.py index 615b640..7c0fd0c 100644 --- a/packaging/packages/synit-config/files/usr/lib/synit/python/synit/daemon/user_settings_daemon.py +++ b/packaging/packages/synit-config/files/usr/lib/synit/python/synit/daemon/user_settings_daemon.py @@ -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) diff --git a/protocols/schema-bundle.bin b/protocols/schema-bundle.bin index bcd4487..296c8a8 100644 --- a/protocols/schema-bundle.bin +++ b/protocols/schema-bundle.bin @@ -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€„„„„ \ No newline at end of file +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€„„„„ \ No newline at end of file diff --git a/protocols/schemas/samsungGalaxyS7.prs b/protocols/schemas/samsungGalaxyS7.prs index 7d35c8c..eb8e8d3 100644 --- a/protocols/schemas/samsungGalaxyS7.prs +++ b/protocols/schemas/samsungGalaxyS7.prs @@ -14,5 +14,6 @@ FmtPacket = . RfsPacket = . ; Assertion. Asks the modem to execute the given command. -ExecuteCommand = . -CommandContinuation = @replyWanted #!FmtPacket / @fireAndForget #f . +CommandRPC = . +; Message. Asks the modem to execute the given command, but not to send back the reply. +CommandEvent = . diff --git a/protocols/schemas/userSettings.prs b/protocols/schemas/userSettings.prs index b51b9a1..814210d 100644 --- a/protocols/schemas/userSettings.prs +++ b/protocols/schemas/userSettings.prs @@ -1,8 +1,10 @@ version 1 . ; Assertion. -Command = . -CommandContinuation = @replyWanted #!CommandReply / @fireAndForget #f . +CommandRPC = . +; Message. +CommandEvent = . + CommandReply = =done . Action = / .