MiraOS  1.22
Typedefs | Enumerations | Functions
mira_provisioning.h File Reference

MiraOS provisioning application. More...

#include "mira_gpio.h"

Go to the source code of this file.

Typedefs

typedef void(* MiraProvisioningCallback) (MiraProvisionDeviceSelectedState selected_state, MiraProvisionState provisioning_state)
 Function pointer to provisioning state change callback. Called when provisioning state changes or if device gets selected/deselected. More...
 
typedef void(* MiraConfigWrittenCallback) (uint8_t id)
 Function pointer to provisioning data written callback. Called when configuration data block has been written. More...
 

Enumerations

enum  MiraProvisionState { MIRA_PROV_UNKOWN = 0, MIRA_PROV_PROVISIONED = 1, MIRA_PROV_PRE_PROVISIONED = 2, MIRA_PROV_TEMP_PRE_PROVISIONED = 3 }
 Provisioning States. More...
 
enum  MiraProvisionDeviceSelectedState { MIRA_PROV_DEVICE_NOT_SELECTED = 0, MIRA_PROV_DEVICE_SELECTED = 1 }
 Device selection states. More...
 
enum  MiraConfigDataError {
  MIRA_CONFIG_DATA_SUCCESS = 0, MIRA_CONFIG_DATA_UNKNOWN_PAGE = 1, MIRA_CONFIG_DATA_EMPTY = 2, MIRA_CONFIG_DATA_WRITE_IN_PROGRESS = 3,
  MIRA_CONFIG_DATA_WRITE_NOT_IN_PROGRESS = 4, MIRA_CONFIG_DATA_WRITE_PROTECTED = 5
}
 Result codes for provisioning configuration data. More...
 
enum  MiraConfigWriteProtection { MIRA_CONFIG_WRITE_PROTECTION_WRITE_ONCE = 0, MIRA_CONFIG_WRITE_PROTECTION_NONE = 1 }
 Write protection configuration options. More...
 

Functions

void mira_provisioning_init (MiraGpioPorts provisioning_led_port, uint8_t provisioning_led_pin)
 Initialize provisioning application. More...
 
void mira_provisioning_disable_led (void)
 Disable provisioning status LED output. Should be called before going to deep sleep to preserve battery. More...
 
void mira_provisioning_enable_led (void)
 Re-enable provisioning status LED output. More...
 
void mira_provisioning_override_led_set_on (void)
 Override the provisioning status LED output. Force the LED to on. More...
 
void mira_provisioning_override_led_set_off (void)
 Override the provisioning status LED output. Force the LED to off. More...
 
void mira_provisioning_release_overridden_led (void)
 Release control of the provisioning status LED. Used to release the LED after its state has been overridden. More...
 
void mira_provisioning_register_callback (MiraProvisioningCallback callback)
 Register the provisioning state change callback. More...
 
MiraProvisionState mira_provisioning_get_state (void)
 Get the provisioning state. More...
 
void mira_provisioning_config_register_data_written_callback (MiraConfigWrittenCallback callback)
 Register the configuration write callback. More...
 
MiraConfigDataError mira_provisioning_config_data_read (uint8_t id, uint8_t page_number, uint8_t *data_ptr)
 Get a page of configuration data. More...
 
MiraConfigDataError mira_provisioning_config_data_write_start (uint8_t id, MiraConfigWriteProtection write_protection)
 Start a configuration block write. More...
 
MiraConfigDataError mira_provisioning_config_data_write (uint8_t page_number, uint8_t *data_ptr)
 Write a page to a configuration block. More...
 
MiraConfigDataError mira_provisioning_config_data_write_done (void)
 Finish a configuration block write. More...
 
MiraConfigDataError mira_provisioning_config_data_write_cancel (void)
 Cancel a configuration block write. More...
 
void mira_provisioning_set_custom_data_pointer (void *pointer)
 Set pointer to data block that will be return in custom neighbor responses. More...
 
void mira_provisioning_announce (void)
 Makes the node announce itself by sending out a NetworkNeighborCustom message. More...
 
void mira_provisioning_set_state_temppreprovisioned ()
 Sets the node into preprovisioned state. More...
 
void mira_provisioning_set_state (MiraProvisionState state)
 Set device into a specific provisioning state. More...
 

Detailed Description

MiraOS provisioning application.

Author
LumenRadio AB
Date
17 Jan 2016 The MiraOS library provides functions for controlling the Mira radio module, sending/receiving messages, controlling peripherals, etc.
See also
http://docs.lumenrad.io/mira

Typedef Documentation

typedef void(* MiraConfigWrittenCallback) (uint8_t id)

Function pointer to provisioning data written callback. Called when configuration data block has been written.

Parameters
idthe configuration block ID that was written
Returns
void
typedef void(* MiraProvisioningCallback) (MiraProvisionDeviceSelectedState selected_state, MiraProvisionState provisioning_state)

Function pointer to provisioning state change callback. Called when provisioning state changes or if device gets selected/deselected.

Parameters
selected_statethe device selected state
provisioning_statethe new provisioning state
Returns
void

Enumeration Type Documentation

Result codes for provisioning configuration data.

Enumerator
MIRA_CONFIG_DATA_SUCCESS 

Success

MIRA_CONFIG_DATA_UNKNOWN_PAGE 

Configuration block or page number is unknown

MIRA_CONFIG_DATA_EMPTY 

Configuration block is empty

MIRA_CONFIG_DATA_WRITE_IN_PROGRESS 

A write is currently in progress

MIRA_CONFIG_DATA_WRITE_NOT_IN_PROGRESS 

Writing has not been started

MIRA_CONFIG_DATA_WRITE_PROTECTED 

Data block is write protected

Write protection configuration options.

Enumerator
MIRA_CONFIG_WRITE_PROTECTION_WRITE_ONCE 

Write once

MIRA_CONFIG_WRITE_PROTECTION_NONE 

Write/erase enabled

Device selection states.

Enumerator
MIRA_PROV_DEVICE_NOT_SELECTED 

Not selected

MIRA_PROV_DEVICE_SELECTED 

Device selected

Provisioning States.

Enumerator
MIRA_PROV_UNKOWN 

Unprovisioned or otherwise unknown state

MIRA_PROV_PROVISIONED 

Provisioned state

MIRA_PROV_PRE_PROVISIONED 

Pre-provisioned state

MIRA_PROV_TEMP_PRE_PROVISIONED 

Temporary pre-provisioned state

Function Documentation

void mira_provisioning_announce ( void  )

Makes the node announce itself by sending out a NetworkNeighborCustom message.

Returns
void
MiraConfigDataError mira_provisioning_config_data_read ( uint8_t  id,
uint8_t  page_number,
uint8_t *  data_ptr 
)

Get a page of configuration data.

Parameters
idconfiguration data block ID
page_numberpage number within the data block
data_ptrpointer to where data should be written. Buffer MUST be at least 32 bytes.
Returns
Result code
MiraConfigDataError mira_provisioning_config_data_write ( uint8_t  page_number,
uint8_t *  data_ptr 
)

Write a page to a configuration block.

Parameters
page_numberpage number within the data block
data_ptrpointer to where data should be written. Data length is always 32 bytes.
Returns
Result code
MiraConfigDataError mira_provisioning_config_data_write_cancel ( void  )

Cancel a configuration block write.

If this function is called, any data written to this page will be discarded and the old data kept.

Returns
Result code
MiraConfigDataError mira_provisioning_config_data_write_done ( void  )

Finish a configuration block write.

Returns
Result code
MiraConfigDataError mira_provisioning_config_data_write_start ( uint8_t  id,
MiraConfigWriteProtection  write_protection 
)

Start a configuration block write.

Parameters
idconfiguration data block ID
write_protectwrite protection flag
Returns
Result code
void mira_provisioning_config_register_data_written_callback ( MiraConfigWrittenCallback  callback)

Register the configuration write callback.

The callback will be called whenever the configuration flash is written via radio.

Parameters
callbacka function pointer to the callback function
Returns
void
void mira_provisioning_disable_led ( void  )

Disable provisioning status LED output. Should be called before going to deep sleep to preserve battery.

Returns
void
void mira_provisioning_enable_led ( void  )

Re-enable provisioning status LED output.

Returns
void
MiraProvisionState mira_provisioning_get_state ( void  )

Get the provisioning state.

Returns
The current state of the device provisioning application
void mira_provisioning_init ( MiraGpioPorts  provisioning_led_port,
uint8_t  provisioning_led_pin 
)

Initialize provisioning application.

Returns
void
void mira_provisioning_override_led_set_off ( void  )

Override the provisioning status LED output. Force the LED to off.

Returns
void
void mira_provisioning_override_led_set_on ( void  )

Override the provisioning status LED output. Force the LED to on.

Returns
void
void mira_provisioning_register_callback ( MiraProvisioningCallback  callback)

Register the provisioning state change callback.

The callback will be called every time the device is selected, deselected, or if the provisioning state changes.

Parameters
callbacka function pointer to the callback function
Returns
void
void mira_provisioning_release_overridden_led ( void  )

Release control of the provisioning status LED. Used to release the LED after its state has been overridden.

Returns
void
void mira_provisioning_set_custom_data_pointer ( void *  pointer)

Set pointer to data block that will be return in custom neighbor responses.

The data pointed to will be returned automatically as a response to GetNeighborCustom messages.

Parameters
pointerpointer to a 42 byte data block that will be returned as response to GetNEighborCustom messages.
Returns
void
void mira_provisioning_set_state ( MiraProvisionState  state)

Set device into a specific provisioning state.

After a state change the device will be reset for all states but MIRA_PROV_TEMP_PRE_PROVISIONED. The callback registered with mira_provisioning_register_callback will be called.

Parameters
statewhich state to set (MIRA_PROV_PRE_PROVISIONED is not a valid state).
Returns
void
void mira_provisioning_set_state_temppreprovisioned ( )

Sets the node into preprovisioned state.

Returns
void