diff --git a/claim.capnp b/claim.capnp index b5e5148..d6d649e 100644 --- a/claim.capnp +++ b/claim.capnp @@ -15,8 +15,8 @@ using import "utils.capnp".Map; interface Claimable { claim @0 () -> Fallible(Claim, ClaimError); - # returns NULL if the resource is *currently* not claimable. - # drop the returned claim capability to unclaim it. + # Returns NULL if the resource is *currently* not claimable. + # Disown the returned claim capability to unclaim it. interface ClaimError { diff --git a/main.capnp b/main.capnp index 8729e6f..5463539 100644 --- a/main.capnp +++ b/main.capnp @@ -31,7 +31,6 @@ interface Bootstrap getServerInfo @2 () -> ( spacename :Text, instanceurl :Text ); # Returns information about the server, which can be used to resolve MDNS to DNS and display the server name to the user. - mechanisms @3 () -> ( mechs :List(Mechanism) ); # Get a list of Mechanisms this server allows in this context. diff --git a/resources.capnp b/resources.capnp index 6dc6a24..22cffe6 100644 --- a/resources.capnp +++ b/resources.capnp @@ -11,10 +11,14 @@ interface Resources { # Returns the list of valid claims the session owner of this `Resources` currently has. list @1 () -> ( resources :List(Resource) ); + # Returns all resources that the user can currently disclose. - getByUrn @2 ( urn :Text ) -> ( resource :Resource, dummy :UInt8 = 0 ); - # Returns a NULL capability if the resource doesn't exist or an user doesn't have disclose - # permission for that resource. + getByName @2 ( name :Text ) -> ( resource :Resource ); + # Returns a NULL capability if the resource doesn't exist or a user doesn't have read permission for that resource. - getByName @3 ( name :Text ) -> ( resource :Resource ); + getByUrn @3 ( urn :Text ) -> ( resource :Resource ); + # Returns a NULL capability if the resource doesn't exist or a user doesn't have read permission for that resource. + + getByUrl @4 ( url :Text ) -> ( resource :Resource ); + # Returns a NULL capability if the resource doesn't exist or a user doesn't have read permission for that resource. } diff --git a/traits.capnp b/traits.capnp new file mode 100644 index 0000000..0bdc133 --- /dev/null +++ b/traits.capnp @@ -0,0 +1,83 @@ +@0xc0542f62613a5c5e + +using CSharp = import "programming_language/csharp.capnp"; +$CSharp.namespace("FabAccessAPI.Schema"); + +using import "utils.capnp".OID; +using import "utils.capnp".Map; +using import "utils.capnp".Fallible; + +using ID = Data; + +struct StateError +{ + +} + +struct MeasureError +{ + +} + +interface Action +{ + do @0 ( Map(ID, Data) ) -> Fallible( ID, StateError ); +} + + +interface Measure +{ + get @0 ( List(ID) ) -> Fallible( Map(ID, Data), MeasureError ); + set @1 ( Map(ID, Data) ) -> Fallible( Map(ID, Data), MeasureError ); +} + +struct FSM +{ + oid @0 :OID; + name @1 :Text; + description @2 :Text; + states @3 :List(State); +} + +struct State +{ + id @0 :ID; + name @1 :Text; + description @2 :Text; + traits @3 :List(Trait); + measurements @4 :List(Measurement); +} + +struct Trait +{ + id @0 :ID; + name @1 :Text; + description @2 :Text; + currentstate @3 :ID; + nextstate @4 :ID; +} + +struct Parameter +{ + id @0 :ID; + name @1 :Text; + description @2 :Text; +} + +struct Measurement +{ + id @0 :ID; + name @1 :Text; + description @2 :Text; + state @3 :ID; +} + +# Power +const power_s_off : State ( id = 0x"000", name = "off", description = "power is off", ); + +const power_m_consumption : Measurement ( id = 0x"000", name = "Power Consumption", description = "TODO", state = 0x"001" ); + +const power_t_turnon : Trait ( id = 0x"000", name = "turnon", description = "Turn Power to on", currentstate = 0x"000", nextstate = 0x"001" ); +const power_t_turnoff : Trait ( id = 0x"001", name = "turnoff", description = "Turn Power to off", currentstate = 0x"001", nextstate = 0x"000" ); + +const power_fsm :FSM = ( oid = 0x"TODO", name = "power1", description = "TODO" ); \ No newline at end of file