Core types, global configuration macros, and framework initialization routines.
More...
|
| enum | otapp_deviceType_t {
OTAPP_NO_DEVICE_TYPE = 0
, OTAPP_CONTROL_PANEL = 1
, OTAPP_SWITCH
, OTAPP_LIGHTING
,
OTAPP_LIGHTING_ON_OFF
, OTAPP_LIGHTING_DIMM
, OTAPP_LIGHTING_RGB
, OTAPP_THERMOSTAT
,
OTAPP_THERMOSTAT_SET_TEMP
, OTAPP_THERMOSTAT_READ_SET_TEMP
, OTAPP_THERMOSTAT_READ_CURRENT_TEMP
, OTAPP_SENSOR
,
OTAPP_DOOR_LOCK
, OTAPP_MOTION_DETECTOR
, OTAPP_REMOTE_CONTROL
, OTAPP_ENERGY_METER
,
OTAPP_SMART_PLUG
, OTAPP_ENVIRONMENT_SENSOR
, OTAPP_DOOR_SENSOR
, OTAPP_ALARM
,
OTAPP_END_OF_DEVICE_TYPE
} |
| | Supported Device Types. Identifies the functional role of the device within the OpenThread network. This enum is used during the discovery phase to filter devices (e.g., a Switch looking for Lights). More...
|
Core types, global configuration macros, and framework initialization routines.
This module defines the fundamental structures used across the framework, including the supported device types (otapp_deviceType_t) and global accessors for OpenThread instances and network addresses.
- Author
- Jan Łukaszewicz (plhar.nosp@m.eo@g.nosp@m.mail..nosp@m.com)
- Version
- 0.1
- Date
- 14-07-2025
- Copyright
- © 2025 MIT LICENCE
◆ OTAPP_CCA_THRESHOLD
| #define OTAPP_CCA_THRESHOLD (-70) |
Clear Channel Assessment threshold in dBm.
◆ OTAPP_CHAR_BUFFER_SIZE
| #define OTAPP_CHAR_BUFFER_SIZE 1024 |
Size for temporary string buffers.
◆ OTAPP_DEVICE_NAME_FULL_SIZE
◆ OTAPP_DNS_SRV_LABEL_SIZE
| #define OTAPP_DNS_SRV_LABEL_SIZE 32 |
OT_DNS_MAX_LABEL_SIZE host name: "device1_1_588c81fffe301ea4".
◆ OTAPP_DNS_SRV_NAME_SIZE
| #define OTAPP_DNS_SRV_NAME_SIZE 64 |
OT_DNS_MAX_NAME_SIZE full service name: "_coap._udp.default.service.arpa.".
◆ OTAPP_DNS_SRV_TXT_SIZE
| #define OTAPP_DNS_SRV_TXT_SIZE 512 |
DNS TXT record buffer size.
◆ OTAPP_ERROR
◆ OTAPP_LOG_ENABLE
◆ OTAPP_OK
◆ OTAPP_PAIRED_DEVICES_MAX
| #define OTAPP_PAIRED_DEVICES_MAX 10 |
Max number of devices to save from DNS query results.
◆ OTAPP_PAIRED_URI_MAX
| #define OTAPP_PAIRED_URI_MAX 3 |
Max number of URIs per paired device.
◆ OTAPP_PRINTF
◆ OTAPP_UDP_PORT
| #define OTAPP_UDP_PORT 12345 |
Default UDP port for application traffic.
◆ OTAPP_URI_MAX_NAME_LENGHT
| #define OTAPP_URI_MAX_NAME_LENGHT 24 |
Max length of URI string name (e.g. "light/dimm").
◆ ot_app_devDrv_t
| typedef struct ot_app_devDrv_t ot_app_devDrv_t |
◆ otapp_deviceType_t
Supported Device Types. Identifies the functional role of the device within the OpenThread network. This enum is used during the discovery phase to filter devices (e.g., a Switch looking for Lights).
| Enumerator |
|---|
| OTAPP_NO_DEVICE_TYPE | Undefined device type.
|
| OTAPP_CONTROL_PANEL | Central control panel or gateway.
|
| OTAPP_SWITCH | Physical button or switch.
|
| OTAPP_LIGHTING | Generic lighting device.
|
| OTAPP_LIGHTING_ON_OFF | Simple On/Off light.
|
| OTAPP_LIGHTING_DIMM | Dimmable light.
|
| OTAPP_LIGHTING_RGB | Color changing light (RGB).
|
| OTAPP_THERMOSTAT | Generic thermostat.
|
| OTAPP_THERMOSTAT_SET_TEMP | Thermostat: Set point control.
|
| OTAPP_THERMOSTAT_READ_SET_TEMP | Thermostat: Read set point.
|
| OTAPP_THERMOSTAT_READ_CURRENT_TEMP | Thermostat: Read ambient temp.
|
| OTAPP_SENSOR | Generic sensor (output only).
|
| OTAPP_DOOR_LOCK | Smart door lock.
|
| OTAPP_MOTION_DETECTOR | PIR or microwave motion sensor.
|
| OTAPP_REMOTE_CONTROL | Handheld remote.
|
| OTAPP_ENERGY_METER | Power consumption meter.
|
| OTAPP_SMART_PLUG | Smart socket/plug.
|
| OTAPP_ENVIRONMENT_SENSOR | Environmental sensor (Humidity, Air Quality, etc.).
|
| OTAPP_DOOR_SENSOR | Reed switch / door open sensor.
|
| OTAPP_ALARM | Siren or alarm system.
|
| OTAPP_END_OF_DEVICE_TYPE | Sentinel value.
|
◆ otapp_getDevDrvInstance()
Retrieves the singleton instance of the Device Driver.
- Returns
- ot_app_devDrv_t* Pointer to the driver instance containing hardware callbacks and config.
◆ otapp_getOpenThreadInstancePtr()
| otInstance * otapp_getOpenThreadInstancePtr |
( |
void | | ) |
|
Retrieves the global OpenThread instance pointer.
- Returns
- otInstance* Pointer to the OpenThread stack instance.
◆ otapp_init()
| int8_t otapp_init |
( |
void | | ) |
|
Main initialization of the OpenThread Application Framework. Initializes the driver instance, OpenThread instance (port), pairing module, and shared buffers.
- Returns
- int8_t OTAPP_OK on success.
◆ otapp_ip6AddressGet()
Gets the current Mesh-Local EID (IPv6 address) of this device.
- Returns
- const otIp6Address* Pointer to the IPv6 address.
◆ otapp_ip6AddressPrint()
Prints an IPv6 address to the log output.
- Parameters
-
| aAddress | Pointer to the IPv6 address to print. |
◆ otapp_ip6AddressRefresh()
Refreshes and returns the current Mesh-Local EID. Updates the internal cache of the device's IP address from the OpenThread stack.
- Returns
- const otIp6Address* Pointer to the refreshed IPv6 address.
◆ otapp_macAddrGet()
Gets the Factory Assigned IEEE EUI-64 address.
- Returns
- const otExtAddress* Pointer to the hardware MAC address.
◆ otapp_multicastAddressGet()
Gets the framework-defined multicast address. Used for group communication or discovery.
- Returns
- const otIp6Address* Pointer to the multicast IPv6 address.
◆ otapp_network_init()
| void otapp_network_init |
( |
void | | ) |
|
Initializes the network layer components. Sets up the operational dataset, device name, CoAP services, and SRP client. Typically called within the OpenThread task context.
◆ otapp_setDataset_tlv()
| void otapp_setDataset_tlv |
( |
void | | ) |
|
Applies the Operational Dataset TLV to the OpenThread stack. Configures network parameters like Channel, PANID, Network Key, etc.