Skip to content

Latest commit

 

History

History
474 lines (474 loc) · 21.3 KB

sensing.md

File metadata and controls

474 lines (474 loc) · 21.3 KB
  • Imports:
    • interface wasi:buffer-pool/data-types
    • interface wasi:sensor/property
    • interface wasi:sensor/sensor
    • interface wasi:io/[email protected]
    • interface wasi:buffer-pool/buffer-pool
  • Exports:
    • interface wasi:sensor/interface

WASI Sensor is an Sensor abstraction API


Types

sensor data type

Record Fields
  • x: float32
  • y: float32
  • z: float32
Record Fields
  • x: float32
  • y: float32
  • z: float32
  • w: float32
Enum Cases
Record Fields
Record Fields
Record Fields
  • payload: list<u8>

    dimension of depth image is updated later here

Variant Cases

Types

dimension

#### `record fraction`

Record Fields
Enum Cases
Variant Cases

Types

property-key

#### `type property-value` [`property-value`](#property_value)

#### `enum device-error`

Enum Cases

Sensor device

Functions

open the device. this might power on the device.

Params
Return values

get a list of names of devices available on the system.

Return values

start sending the data to buffer

Params
Return values

stop sending the data to buffer

Params
Return values

set property

Params
Return values

get property

Params
Return values

A poll API intended to let users wait for I/O events on multiple handles at once.


Types

pollable represents a single I/O event which may be ready, or not.

Functions

Return the readiness of a pollable. This function never blocks.

Returns true when the pollable is ready, and false otherwise.

Params
Return values
  • bool

block returns immediately if the pollable is ready, and otherwise blocks until ready.

This function is equivalent to calling poll.poll on a list containing only this pollable.

Params

Poll for completion on a set of pollables.

This function takes a list of pollables, which identify I/O sources of interest, and waits until one or more of the events is ready for I/O.

The result list<u32> contains one or more indices of handles in the argument list that is ready for I/O.

If the list contains more elements than can be indexed with a u32 value, this function traps.

A timeout can be implemented by adding a pollable from the wasi-clocks API to the list.

This function does not return a result; polling in itself does not do any I/O so it doesn't fail. If any of the I/O sources identified by the pollables has an error, it is indicated by marking the source as being reaedy for I/O.

Params
Return values
  • list<u32>

sensor frame/buffer management I/F


Types

pollable

#### `type data-type` [`data-type`](#data_type)

#### `enum buffer-error`

Enum Cases

u32

#### `type timestamp` `u64`

timestamp is the elasped time in nanoseconds since a fixed point in the past. it's supposed to increase monotonically.

Variant Cases
Record Fields
  • sequence-number: u64

    sequence number within the pool. it increases monotonically. a user of this api might observe discontiguous values when some of frames are discarded within the pool.

  • timestamp: timestamp

    timestamp of the frame. usually the time when it was read from the underlying hardware.

  • data: list<frame-data>

    1 or more raw-data for this frame.

Enum Cases
Record Fields

a pool consists of a set of buffers. the number of buffers in a pool is static. when data (a frame) comes in from an associated device, it's stored in one of free buffers. when a user app request data either by block-read or poll-read, the oldest frame is returned. when the user app is done with the frame, it should notify it to the pool by dropping the frame-info and associated resources like "memory".

Functions

Params
Return values
  • u64
Params
Return values
Params
Return values

create a pool.

size: the max size of each buffer in bytes. if frame-info::data has exactly one data and its type is data-types::image, this value controls the max payload size. otherwise, it's implementation-defined.

buffer-num: the max number of buffers in the pool. for buffering-discard and buffering-overwrite, this controls how many frames can be in the pool. for other buffering modes, this is ignored.

name: the name of the pool. you can use this for device.start().

Params
Return values

try to read frames. this function returns 0 frames when

  • max-results = 0
  • or, no frames are immediately available
Params
Return values
Params
Return values
Params
Return values

Functions

Return values
  • result