Interface: moteiv.tos.lib.resource.ResourceCmdAsync

interface ResourceCmdAsync

Resource interface. This interface is to be used by components for providing access to shared resources. A component wishing to arbitrate the use of a shared resource should implement this interface in conjunction with the Resource interface.

For more information about this interface, please see TEP108.

Author:
Kevin Klues (klues@tkn.tu-berlin.de)
Cory Sharp (info@moteiv.com)

Commands
command uint8_t immediateRequest(uint8_t rh) Request access to a shared resource immediately.
command void release() Release a shared resource you previously acquired.
command void request(uint8_t rh) Request access to a shared resource.
command void urgentRequest(uint8_t rh) Request access to a shared resource urgently.

Events
event void granted(uint8_t rh) You have received access to this resource.

Commands - Details

immediateRequest

command uint8_t immediateRequest(uint8_t rh)

Request access to a shared resource immediately. Upon return from the function call, the resulting value is a resource handle. The resource handle may not be valid if the resource is not available. The user must check the handle using ResourceValidate before using.

release

command void release()

Release a shared resource you previously acquired.

request

command void request(uint8_t rh)

Request access to a shared resource. You must call release() when you are done with it.

Returns:
TRUE The request is deferred and granted() will be signaled for this request sometime in the future. FALSE The request has been immediately satisfied by signalling granted before returning from this request() call.

urgentRequest

command void urgentRequest(uint8_t rh)

Request access to a shared resource urgently. This gives the system information that the request should receive priority over other existing requests initiated through the request interface. Essentially a two-level priority queue.

Events - Details

granted

event void granted(uint8_t rh)

You have received access to this resource. Note that this event is NOT signaled when immediateRequest() succeeds. This event may be signalled from within a call to request.