-
大小: 10.09MB文件類型: .zip金幣: 2下載: 1 次發(fā)布日期: 2023-11-10
- 語(yǔ)言: 其他
- 標(biāo)簽: stm32f4??onenet??物聯(lián)網(wǎng)??
資源簡(jiǎn)介
從onenet例程修改過(guò)來(lái)的,使用STM32F407+ESP8266接入onenet平臺(tái)的最終修改代碼。

代碼片段和文件信息
/**
************************************************************
************************************************************
************************************************************
* 文件名:? dStream.c
*
* 作者:? 張繼瑞
*
* 日期:? 2017-09-11
*
* 版本:? V1.1
*
* 說(shuō)明:? cJson格式數(shù)據(jù)流通用封裝
*
* 修改記錄: V1.1:修復(fù)當(dāng)數(shù)據(jù)流flag全為0時(shí)封裝錯(cuò)誤的bug。
************************************************************
************************************************************
************************************************************
**/
//協(xié)議封裝文件
#include?“dStream.h“
//C庫(kù)
#include?
#include?
//==========================================================
// 函數(shù)名稱: DSTREAM_toString
//
// 函數(shù)功能: 將數(shù)值轉(zhuǎn)為字符串
//
// 入口參數(shù): StreamArray:數(shù)據(jù)流
// buf:轉(zhuǎn)換后的緩存
// pos:數(shù)據(jù)流中的哪個(gè)數(shù)據(jù)
// bufLen:緩存長(zhǎng)度
//
// 返回參數(shù): 無(wú)
//
// 說(shuō)明:
//==========================================================
void?DSTREAM_toString(DATA_STREAM?*streamArray?char?*buf?unsigned?short?pos?unsigned?short?bufLen)
{
memset(buf?0?bufLen);
switch((unsigned?char)streamArray[pos].dataType)
{
case?TYPE_BOOL:
snprintf(buf?bufLen?“%d“?*(_Bool?*)streamArray[pos].dataPoint);
break;
case?TYPE_CHAR:
snprintf(buf?bufLen?“%d“?*(signed?char?*)streamArray[pos].dataPoint);
break;
case?TYPE_UCHAR:
snprintf(buf?bufLen?“%d“?*(unsigned?char?*)streamArray[pos].dataPoint);
break;
case?TYPE_SHORT:
snprintf(buf?bufLen?“%d“?*(signed?short?*)streamArray[pos].dataPoint);
break;
case?TYPE_USHORT:
snprintf(buf?bufLen?“%d“?*(unsigned?short?*)streamArray[pos].dataPoint);
break;
case?TYPE_INT:
snprintf(buf?bufLen?“%d“?*(signed?int?*)streamArray[pos].dataPoint);
break;
case?TYPE_UINT:
snprintf(buf?bufLen?“%d“?*(unsigned?int?*)streamArray[pos].dataPoint);
break;
case?TYPE_LONG:
snprintf(buf?bufLen?“%ld“?*(signed?long?*)streamArray[pos].dataPoint);
break;
case?TYPE_ULONG:
snprintf(buf?bufLen?“%ld“?*(unsigned?long?*)streamArray[pos].dataPoint);
break;
case?TYPE_FLOAT:
snprintf(buf?bufLen?“%f“?*(float?*)streamArray[pos].dataPoint);
break;
case?TYPE_DOUBLE:
snprintf(buf?bufLen?“%f“?*(double?*)streamArray[pos].dataPoint);
break;
case?TYPE_GPS:
snprintf(buf?bufLen?“{\“l(fā)on\“:%s\“l(fā)at\“:%s}“?(char?*)streamArray[pos].dataPoint?(char?*)(streamArray[pos].dataPoint)?+?16);
break;
case?TYPE_STRING:
snprintf(buf?bufLen?“\“%s\““?(char?*)streamArray[pos].dataPoint);
break;
}
}
//==========================================================
// 函數(shù)名稱: ?DSTREAM_GetDataStream_Body
//
// 函數(shù)功能: 獲取數(shù)據(jù)流格式消息體
//
// 入口參數(shù): type:格式類型
// streamArray:數(shù)據(jù)流結(jié)構(gòu)
// streamArrayCnt:數(shù)據(jù)流個(gè)數(shù)
// buffer:緩存
// maxLen:最大緩存長(zhǎng)度
// offset:偏移
//
// 返回參數(shù): Body的長(zhǎng)度,0-失敗
//
// 說(shuō)明:
//==========================================================
short?DSTREAM_GetDataStream_Body(uns
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-02-26?08:23??stm32f407_iot\
?????目錄???????????0??2018-02-26?12:31??stm32f407_iot\MDK\
?????目錄???????????0??2018-02-26?08:23??stm32f407_iot\MDK\DebugConfig\
?????文件????????2084??2015-10-27?12:06??stm32f407_iot\MDK\DebugConfig\Target_1_STM32F407ZGTx.dbgconf
?????文件????????2084??2015-10-27?12:06??stm32f407_iot\MDK\DebugConfig\stm32f4_project_STM32F407ZGTx.dbgconf
?????文件??????123683??2018-02-26?12:31??stm32f407_iot\MDK\Jli
?????文件?????????762??2018-02-26?09:06??stm32f407_iot\MDK\Jli
?????目錄???????????0??2018-02-26?08:23??stm32f407_iot\MDK\Listings\
?????文件???????77572??2018-02-26?08:24??stm32f407_iot\MDK\Listings\startup_stm32f40_41xxx.lst
?????文件??????203095??2018-02-26?12:31??stm32f407_iot\MDK\Listings\stm32f407_ex.map
?????目錄???????????0??2018-02-26?12:31??stm32f407_iot\MDK\ob
?????文件????????9817??2018-02-26?08:24??stm32f407_iot\MDK\ob
?????文件?????????237??2018-02-26?08:24??stm32f407_iot\MDK\ob
?????文件???????19248??2018-02-26?08:24??stm32f407_iot\MDK\ob
?????文件???????15087??2018-02-26?08:24??stm32f407_iot\MDK\ob
?????文件?????????276??2018-02-26?08:24??stm32f407_iot\MDK\ob
?????文件???????37792??2018-02-26?08:24??stm32f407_iot\MDK\ob
?????文件???????14474??2018-02-26?08:24??stm32f407_iot\MDK\ob
?????文件?????????357??2018-02-26?08:24??stm32f407_iot\MDK\ob
?????文件???????18276??2018-02-26?08:24??stm32f407_iot\MDK\ob
?????文件??????460115??2018-02-26?12:31??stm32f407_iot\MDK\ob
?????文件????????2152??2018-02-26?12:31??stm32f407_iot\MDK\ob
?????文件??????492288??2018-02-26?12:31??stm32f407_iot\MDK\ob
?????文件??????443768??2018-02-26?08:23??stm32f407_iot\MDK\ob
?????文件????????1743??2018-02-26?08:23??stm32f407_iot\MDK\ob
?????文件??????482424??2018-02-26?08:23??stm32f407_iot\MDK\ob
?????文件??????459918??2018-02-26?08:24??stm32f407_iot\MDK\ob
?????文件????????2292??2018-02-26?08:24??stm32f407_iot\MDK\ob
?????文件??????521616??2018-02-26?08:24??stm32f407_iot\MDK\ob
?????文件??????449814??2018-02-26?09:03??stm32f407_iot\MDK\ob
?????文件????????1986??2018-02-26?09:03??stm32f407_iot\MDK\ob
............此處省略242個(gè)文件信息
評(píng)論
共有 條評(píng)論