MiraOS
1.22
|
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... | |
MiraOS provisioning application.
typedef void(* MiraConfigWrittenCallback) (uint8_t id) |
Function pointer to provisioning data written callback. Called when configuration data block has been written.
id | the configuration block ID that was written |
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.
selected_state | the device selected state |
provisioning_state | the new provisioning state |
enum MiraConfigDataError |
Result codes for provisioning configuration data.
enum MiraProvisionState |
void mira_provisioning_announce | ( | void | ) |
Makes the node announce itself by sending out a NetworkNeighborCustom message.
MiraConfigDataError mira_provisioning_config_data_read | ( | uint8_t | id, |
uint8_t | page_number, | ||
uint8_t * | data_ptr | ||
) |
Get a page of configuration data.
id | configuration data block ID |
page_number | page number within the data block |
data_ptr | pointer to where data should be written. Buffer MUST be at least 32 bytes. |
MiraConfigDataError mira_provisioning_config_data_write | ( | uint8_t | page_number, |
uint8_t * | data_ptr | ||
) |
Write a page to a configuration block.
page_number | page number within the data block |
data_ptr | pointer to where data should be written. Data length is always 32 bytes. |
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.
MiraConfigDataError mira_provisioning_config_data_write_done | ( | void | ) |
Finish a configuration block write.
MiraConfigDataError mira_provisioning_config_data_write_start | ( | uint8_t | id, |
MiraConfigWriteProtection | write_protection | ||
) |
Start a configuration block write.
id | configuration data block ID |
write_protect | write protection flag |
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.
callback | a function pointer to the callback function |
void mira_provisioning_disable_led | ( | void | ) |
Disable provisioning status LED output. Should be called before going to deep sleep to preserve battery.
void mira_provisioning_enable_led | ( | void | ) |
Re-enable provisioning status LED output.
MiraProvisionState mira_provisioning_get_state | ( | void | ) |
Get the provisioning state.
void mira_provisioning_init | ( | MiraGpioPorts | provisioning_led_port, |
uint8_t | provisioning_led_pin | ||
) |
Initialize provisioning application.
void mira_provisioning_override_led_set_off | ( | void | ) |
Override the provisioning status LED output. Force the LED to off.
void mira_provisioning_override_led_set_on | ( | void | ) |
Override the provisioning status LED output. Force the LED to on.
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.
callback | a function pointer to the callback function |
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.
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.
pointer | pointer to a 42 byte data block that will be returned as response to GetNEighborCustom messages. |
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.
state | which state to set (MIRA_PROV_PRE_PROVISIONED is not a valid state). |
void mira_provisioning_set_state_temppreprovisioned | ( | ) |
Sets the node into preprovisioned state.