6#include "dawn/system/lte.hxx"
11#include "dawn/debug.hxx"
19 size_t bytes =
static_cast<size_t>(item->
cfgid.
s.
size) *
sizeof(uint32_t);
20 size_t n = (bytes < dstsz - 1) ? bytes : dstsz - 1;
22 std::memcpy(dst,
reinterpret_cast<const char *
>(&item->
data), n);
38void CSystemLte::loadParams()
48 std::strncpy(apn, CONFIG_DAWN_SYSTEM_LTE_APN,
sizeof(apn) - 1);
49 apn[
sizeof(apn) - 1] =
'\0';
50 std::strncpy(username, CONFIG_DAWN_SYSTEM_LTE_USERNAME,
sizeof(username) - 1);
51 username[
sizeof(username) - 1] =
'\0';
52 std::strncpy(password, CONFIG_DAWN_SYSTEM_LTE_PASSWORD,
sizeof(password) - 1);
53 password[
sizeof(password) - 1] =
'\0';
54 auth_type = CONFIG_DAWN_SYSTEM_LTE_AUTHTYPE;
55 ip_type = CONFIG_DAWN_SYSTEM_LTE_IPTYPE;
56 psave_mode = CONFIG_DAWN_SYSTEM_LTE_PSAVE;
57 reg_timeout = CONFIG_DAWN_SYSTEM_LTE_REG_TIMEOUT;
61 for (i = 0; i < count; i++)
77 cfgCopyStr(apn,
sizeof(apn), item);
81 cfgCopyStr(username,
sizeof(username), item);
85 cfgCopyStr(password,
sizeof(password), item);
89 auth_type =
static_cast<uint8_t
>(item->
data[0] & 0xff);
93 ip_type =
static_cast<uint8_t
>(item->
data[0] & 0xff);
97 reg_timeout = item->
data[0];
112 DAWNERR(
"LTE invalid auth/ip config\n");
121 struct SLteParams params;
126 params.apn = apn[0] ? apn :
nullptr;
127 params.username = username[0] ? username :
nullptr;
128 params.password = password[0] ? password :
nullptr;
129 params.auth_type = auth_type;
130 params.ip_type = ip_type;
131 params.psave_mode = psave_mode;
132 params.reg_timeout = reg_timeout;
134 ret = lte_port_connect(¶ms);
137 DAWNERR(
"LTE connect failed: %d\n", ret);
141 DAWNINFO(
"LTE connected (apn=%s)\n", params.apn ? params.apn :
"default");
147 return lte_port_disconnect();
Descriptor wrapper for individual object configuration.
size_t getSize() const
Get number of configuration items for this object.
SObjectCfg::SObjectCfgItem * objectCfgItemNext(size_t &offset) const
Get config item at current offset and advance past it.
CDescObject & getDesc()
Get descriptor object for this object.
Base class for OBJTYPE_ANY configuration objects.
@ SYSTEM_CLASS_LTE
LTE / cellular connectivity settings.
int configure()
Configure object from descriptor data.
@ LTE_CFG_AUTHTYPE
DAWN_LTE_AUTH_* (DTYPE_UINT8)
@ LTE_CFG_USERNAME
APN username (DTYPE_CHAR)
@ LTE_CFG_IPTYPE
DAWN_LTE_IPTYPE_* (DTYPE_UINT8)
@ LTE_CFG_REG_TIMEOUT
Registration timeout, seconds (DTYPE_UINT32)
@ LTE_CFG_PASSWORD
APN password (DTYPE_CHAR)
@ LTE_CFG_APN
APN (DTYPE_CHAR)
int doStart()
Start implementation hook.
int doStop()
Stop implementation hook.
Out-of-tree user-extension hooks for Dawn.
@ DAWN_LTE_AUTH_CHAP
CHAP.
@ DAWN_LTE_IPTYPE_V4V6
IPv4/IPv6.
Single configuration item within object.
ObjectCfgData_t data[]
Configuration data array (flexible, size from cfgid.s.size).
UObjectCfgId cfgid
Configuration ID header (type, class, id, size, rw, dtype).
uint32_t cls
Object class (bits 21-29, max 511).
uint32_t id
Configuration identifier (bits 0-4, max 31).
uint32_t size
Configuration data size in 32-bit words (bits 5-14, max 1023).
struct dawn::SObjectCfg::UObjectCfgId::@10 s
Bit-field structure for named member access.