Prototypes API

Notes

  • For all functions, enter the parameters in the order listed.
  • Italicized parameters are optional.
  • Received Events are events of the "wrangler" domain that Wrangler will respond to
  • Raised Events are events that can be selected on within any ruleset in the pico when they occur
  • Sent Events are events that the pico will send elsewhere as a result of triggering a Wrangler event.

Implementation In Progress

The io.picolabs.prototypes ruleset is still being written. The documentation below describes the currently implemented events and functions for your use.

Received Events

prototype_instance_requested

wrangler:prototype_instance_requested

Attributes

AttributeDatatypeDescription
prototypeMapThe prototype definition. For more information on the expected Map structure, see the Prototypes page.

Any extra attributes provided are propagated to the wrangler:prototype_initialized event.

Here is an example of raising this event:

rule examplePrototype {
	select when example prototype
	pre {
		prototype = {
			"new_picos": [{
				"name": "examplePico",
				"rids": []
			}],
			"subscriptions": []
		}
	}
	always {
		raise wrangler event "prototype_instance_requested"
			attributes { "prototype": prototype }
	}
}

Directives Returned

No directives are returned.

Raised Events

prototype_initialized

wrangler:prototype_initialized

This event is raised after all of the new picos and subscriptions are created in the system. Any subscriptions defined via a tuple are guaranteed to be established, but subscriptions defined via an external event (a map) are not guaranteed to be established because the prototypes ruleset has no guarantee of authority over the accepting pico.

Here is what the event attributes of this raised event will look like:

{
	"__prototypeCorrelationID": <the event correlation ID>,
	//all the other original attributes passed into the wrangler:prototype_instance_requested event.
}

Copyright Picolabs | Licensed under Creative Commons.