mirror of
https://gitlab.com/fabinfra/fabaccess/fabaccess-api.git
synced 2025-03-12 14:51:42 +01:00
Test Traits
This commit is contained in:
parent
158d307d74
commit
9d7c66b9dd
@ -15,8 +15,8 @@ using import "utils.capnp".Map;
|
|||||||
|
|
||||||
interface Claimable {
|
interface Claimable {
|
||||||
claim @0 () -> Fallible(Claim, ClaimError);
|
claim @0 () -> Fallible(Claim, ClaimError);
|
||||||
# returns NULL if the resource is *currently* not claimable.
|
# Returns NULL if the resource is *currently* not claimable.
|
||||||
# drop the returned claim capability to unclaim it.
|
# Disown the returned claim capability to unclaim it.
|
||||||
|
|
||||||
interface ClaimError {
|
interface ClaimError {
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ interface Bootstrap
|
|||||||
getServerInfo @2 () -> ( spacename :Text, instanceurl :Text );
|
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.
|
# 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) );
|
mechanisms @3 () -> ( mechs :List(Mechanism) );
|
||||||
# Get a list of Mechanisms this server allows in this context.
|
# Get a list of Mechanisms this server allows in this context.
|
||||||
|
|
||||||
|
@ -11,10 +11,14 @@ interface Resources {
|
|||||||
# Returns the list of valid claims the session owner of this `Resources` currently has.
|
# Returns the list of valid claims the session owner of this `Resources` currently has.
|
||||||
|
|
||||||
list @1 () -> ( resources :List(Resource) );
|
list @1 () -> ( resources :List(Resource) );
|
||||||
|
# Returns all resources that the user can currently disclose.
|
||||||
|
|
||||||
getByUrn @2 ( urn :Text ) -> ( resource :Resource, dummy :UInt8 = 0 );
|
getByName @2 ( name :Text ) -> ( resource :Resource );
|
||||||
# Returns a NULL capability if the resource doesn't exist or an user doesn't have disclose
|
# Returns a NULL capability if the resource doesn't exist or a user doesn't have read permission for that resource.
|
||||||
# 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.
|
||||||
}
|
}
|
||||||
|
83
traits.capnp
Normal file
83
traits.capnp
Normal file
@ -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" );
|
Loading…
x
Reference in New Issue
Block a user