資源簡介
中移物聯全球最小nb模塊,內置esim,內置onenet協議,含全套開發手冊、at命令集、pcb封裝、onenet調試器等

代碼片段和文件信息
#include?
#include?
#include?
#include?
#include?
typedef?enum
{
MIPL_DEBUG_LEVEL_NONE?=?0
MIPL_DEBUG_LEVEL_RXL
MIPL_DEBUG_LEVEL_RXL_RXD
MIPL_DEBUG_LEVEL_TXL_TXD
}?MIPL_DEBUG_LEVEL_E;
typedef?unsigned?short?uint16;
typedef?unsigned?uint32;
typedef?struct
{
bool?boot;
bool?encrypt;
MIPL_DEBUG_LEVEL_E?debug;
uint16?port;
uint32?keep_alive;
size_t?uri_len;
char*?uri;
size_t?ep_len;
char*?ep;
}?MIPL_T;
void?usage(?const?char?*name?)
{
printf(?“Usage:?%s?[OPTION]\r\n“?name?);
printf(?“Launch?a?client.\r\n“?);
printf(?“Options:\r\n“?);
printf(?“-b?BOOT\t\tSet?the?bootstrap?mode?of?the?client.Default:?0\r\n“?);
printf(?“-d?DEBUG\tSet?the?debug?mode?of?the?client.Default:?0\r\n“?);
printf(?“-e?ENCRYPT\tSet?the?encrypt?of?the?client.\r\n“?);
printf(?“-i?URI\t\tSet?the?coap?uri?of?the?server?to?connect?to.?For?example:?coap://localhost:5683\r\n“?);
printf(?“-n?NAME\t\tSet?the?endpoint?name[imei;imsi]?of?the?client.\r\n“?);
printf(?“-p?PORT\t\tSet?the?local?port?of?the?client?to?bind?to.?Default:?srand\r\n“?);
printf(?“-t?TIME\t\tSet?the?lifetime?of?the?client.?Default:?300\r\n“?);
printf(?“\r\n“?);
}
void?output_buffer(unsigned?char?*buffer?int?lengthint?index?int?flag)
{
int?i?=?0;
while?(?i? {
printf(?“%02X“?buffer[i++]?);
}
printf(“%d%d\r\n“indexflag);
}
void?mipl_generate(char?*buf?size_t?buflen?MIPL_T?*mipl)
{
uint32?offset?=?0;
int?mipl_num?=?0;
memset(buf?0?buflen);
char?mode?=?((mipl->boot?&?0x1)?<4)?|?(mipl->encrypt?&?0x1);
memcpy(buf?+?offset?&mode?1);
offset++;
memcpy(buf?+?offset?&mipl->debug?1);
offset++;
memcpy(buf?+?offset?&mipl->port?2);
offset?+=?2;
memcpy(buf+offset?&mipl->keep_alive?4);
offset?+=?4;
memcpy(buf?+?offset?&mipl->uri_len?2);
offset?+=?2;
memcpy(buf?+?offset?mipl->uri?mipl->uri_len);
offset?+=?mipl->uri_len;
memcpy(buf?+?offset?&mipl->ep_len?2);
offset?+=?2;
memcpy(buf?+?offset?mipl->ep?mipl->ep_len);
offset?+=?mipl->ep_len;
mipl_num?=?0;
while(offset?>?1024)//每條+MIPLCONF命令最多輸入1024字節配置數據
{
printf(“AT+MIPLCONF=%d“1024);
output_buffer(?(unsigned?char?*)(buf?+?(mipl_num?>>?10))1024mipl_num?+?10);//index從1起始
mipl_num++;
offset?-=?1024;
}
printf(“AT+MIPLCONF=%d“offset);
output_buffer(?(unsigned?char?*)(buf?+?(mipl_num?>>?10))offsetmipl_num?+?11);//結束
}
int?main(int?argc?char?*argv[])
{
char?conf[1024];
MIPL_T?mipl;
char*?const?short_options?=?“i:p:t:n:d:b:e:h“;
char?c;
struct?option?long_options[]?=
{
{“uri“?1?NULL?‘i‘}
{“port“?1?NULL?‘p‘}
{“keep_alive“?1?NULL?‘t‘}
{“ep“?1?NULL?‘n‘}
{“debug“?1?NULL?‘d‘}
{“boot“?1?NULL?‘b‘}
{“encrypt“?1?NULL?‘e‘}
{“help“?0?NULL?‘h‘}
{0?0?0?0}
};
while((c?=?getopt_long?(argc?argv?short_options?long_options?NULL))?!=?-1)
{
switch?(c)
{
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-11-30?21:55??M5310資料B657SP1\
?????文件???????79872??2017-11-07?10:48??M5310資料B657SP1\M5310.PcbLib
?????文件?????1635291??2017-08-30?17:47??M5310資料B657SP1\M5310EVB用戶使用指南V1.1.pdf
?????文件?????1702152??2017-08-30?17:47??M5310資料B657SP1\M5310?AT?Command?B657SP1-v2.1.0822.pdf
?????文件???????73062??2017-11-03?15:21??M5310資料B657SP1\M5310參考設計V1.1.pdf
?????文件?????2799746??2017-11-03?15:21??M5310資料B657SP1\M5310硬件設計手冊_V1.2.pdf
?????文件?????1360143??2017-08-30?17:47??M5310資料B657SP1\M5310通信流程示例v2.0.0828.pdf
?????文件????????3655??2017-08-30?17:47??M5310資料B657SP1\miplconf_generate_v1.1.c
?????文件??????188473??2017-08-04?11:00??M5310資料B657SP1\OneNET_config.exe
?????文件??????????79??2017-11-30?21:54??M5310資料B657SP1\購買方式.txt
- 上一篇:基于STM32的RC663編程
- 下一篇:基于stm32單片機多功能計步手環
評論
共有 條評論