...
Parameter | Datatype | Required |
---|
<eci> | <string> | YES |
Code Block |
---|
|
pico_id = engine:getPicoIDByECI(eci)
/*
"some_pico_id"
*/ |
...
Get the parent's pico_id for the current or given pico_id.
Parameter | Datatype | Required | Default |
---|
<pico_id> | <string> | NO | the running pico_id |
Code Block |
---|
title | newChannel |
---|
parent_id = engine:getParent(pico_id)
/*
"the parent's pico_id"
*/ |
...
List the pico's children pico_ids.
Parameter | Datatype | Required | Default |
---|
<pico_id> | <string> | NO | the running pico_id |
Code Block |
---|
title | newChannel |
---|
children = engine:listChildren(pico_id)
/*
[
"child 0 pico_id",
"child 1 pico_id",
...
]
*/ |
...
List the pico's channels.
Parameter | Datatype | Required | Default |
---|
<pico_id> | <string> | NO | the running pico_id |
Code Block |
---|
title | newChannel |
---|
channels = engine:listChannels(pico_id)
/*
[
{
"id" : "eci-0...",
"pico_id": <pico_id>,
"name": "name 0",
"type": "type 0"
},
{
"id" : "eci-1...",
"pico_id": <pico_id>,
"name": "name 1",
"type": "type 1"
}
]
*/ |
...
List the rid's installed on the pico.
Parameter | Datatype | Required | Default |
---|
<pico_id> | <string> | NO | the running pico_id |
Code Block |
---|
title | newChannel |
---|
rids = engine:listInstalledRIDs(pico_id)
/*
["io.picolabs.pico", ...]
*/ |
...
List all enabled ruleset ids. No parameters are given.
Code Block |
---|
title | intall ruleset |
---|
rids = engine:listAllEnabledRIDs();
/*
["io.picolabs.pico", "io.picolabs.logging"]
*/ |
...
Parameter | Datatype | Required |
---|
<rid> | <string> | YES |
Code Block |
---|
title | intall ruleset |
---|
desc = engine:describeRuleset("io.picolabs.hello_world");
/*
{
"rid": "io.picolabs.hello_world",
"src": "ruleset io.picolabs.hello_world{ ...<cut for brevity> ... }",
"hash": "a096f2f3bfbd63e54bf4f39081814dbc895f3f003ae9918dbe24aec8acc097b9",
"url": "https://raw.githubusercontent.com/Picolab/node-pico-engine-core/master/test-rulesets/hello-world.krl",
"timestamp_stored": "2017-05-17T21:31:21.663Z",
"timestamp_enable": "2017-05-17T21:31:21.663Z",
"meta": {
"name": "Hello World",
"description": "\nA first ruleset for the Quickstart\n ",
"author": "Phil Windley"
}
}
*/ |
...
newPico
Creates a new pico.
Parameter | Datatype | Required | Default |
---|
<parent_id> | <string> | NO | the running pico_id |
Code Block |
title |
---|
newPico | engine:newPico() setting(resp)
/*
{
"id" : <new_pico_id>,
"parent_id" : <current pico_id>,
}
*/ |
Note: newPico does not provide an eci. This action is used in conjunction with engine:createChannel to create a pico with both an id and eci. See wranglerNPE.krl for an example of how to fully create a pico according to a given prototype.
removePico
Parameter | Datatype | Required | Default |
---|
<pico_id> | <string> | NO | the running pico_id |
Code Block |
---|
title | removePico |
---|
engine:removePico(id) |
newChannel
...
Parameter | Datatype | Required | Default |
---|
<pico_id> | <string> | NO | the running pico_id |
<name> | <string> | YES |
|
<type> | <string> | YES |
|
Code Block |
---|
title | newChannel |
---|
engine:newChannel(name = "channel_name", type = "channel_type") setting(resp)
/*
{
"id" : <new_eci>,
"pico_id": <pico_id>,
"name": "channel_name",
"type": "channel_type"
}
*/ |
...
Parameter | Datatype | Required |
---|
<eci> | <string> | YES |
Code Block |
---|
title | removeChannel |
---|
engine:removeChannel("eci123...") |
...
If you register a ruleset sharing a rid with a system ruleset, the system ruleset will be restored when the engine is restarted.
Code Block |
title |
---|
registerRuleset | engine:registerRuleset("some.cool.ruleset.krl", base = "http://example.com/krl-files/") setting(resp)
/*
"some.cool.ruleset.id"
*/ |
...
Parameter | Datatype | Required |
---|
<rid> | string | array | YES |
Code Block |
---|
title | unregisterRuleset |
---|
engine:unregisterRuleset("myRuleset")
engine:unregisterRuleset(["rid.1", "rid.2"]) |
...
Do not provide the "rid" key if you want to retrieve the krl file from a remote repository (just provide the "base" and "url" keys). If you provide the "rid" key at all, this function will assume the ruleset is already registered with the engine and will simply throw an error if it is not found, ignoring the "base" and "url" as if they were not submitted. If the "base" and "url" are provided, then the krl file will be registered to the engine (if not already) and then installed on the pico with the given "pico_id".
Code Block |
title |
---|
intall ruleset | engine:installRuleset( ent:id, "wrangler" ) setting(resp)
/*
"wrangler"
*/
engine:installRuleset( ent:id, ["wrangler","Pds"] ) setting(resp)
/*
["wrangler","Pds"]
*/
engine:installRuleset( ent:id, base = <base>, url = <url> ) setting(resp)
/*
"the.rid.at.that.url"
*/ |
...
This does not return anything
Code Block |
---|
title | unregisterRuleset |
---|
engine:uninstallRuleset( rid = "myRuleset")
engine:uninstallRuleset( meta:picoId, ["rid.1", "rid.2"]) |
...