资源简介
1. 包含消息集BSM/RSM/RSI/MAP/SPAT的XPER编解码接口
2. libasn1c库
安装asn1c-0.9.28开源工具,使用 asn1c -pdu=all -fcompound-names -gen-PER LTEV2X.asn命令
生成对应.c和.h文件,再连接成libasn1c库
3. 编译命令,详见Makefile
第一次编译:
source ./build_project.sh
编译模块:
mm
清除模块:
mc
4. 生成可执行文件 v2x_msg
./v2x_msg 运行编解码库
会保存消息集的二进制文件:
asn1c_bsm
asn1c_map
asn1c_rsi
asn1c_rsm
asn1c_spat
5. log
xzb@ubuntu:/home/myshare/code/asn1c_v2x_app$ ./v2x_msg
[bsm_msg_test][549] begin
[main.c,bsm_msg_fill:338]fill bsm end
[main.c,bsm_msg_test:563]----------bsm encode---------
10
10 20 30 00 00 00 00 00
1234
12
23
1234
456
12
34
56
78
90
100
20
[main.c,bsm_msg_test:566]----------bsm decode---------
10
10 20 30 00 00 00 00 00
1234
12
23
1234
456
12
34
56
78
代码片段和文件信息
#include
#include
#include “V2xMessageEncode.h“
#include “V2xMessageDecode.h“
#define FILENAME “asn1c_v2x_message“
#define FUNC_BEGIN printf(“[%s][%d] begin\n“ __FUNCTION__ __LINE__)
#define FUNC_END printf(“[%s][%d] end\n“ __FUNCTION__ __LINE__)
#define MAX_BUF_SIZE 256
#define IF_THEN_EXEC(condition action) do {\
if (condition) { \
action; \
} \
} while(0)
#define SAFE_FREE(x) do {\
if (x) { \
free(x); \
x = NULL; \
} \
}while(0)
/* Write the encoded output into some FILE stream. */
static int write_out(const void *buffer size_t size void *app_key)
{
FILE *out_fp = app_key;
size_t wrote = fwrite(buffer 1 size out_fp);
V2X_LOG_ERROR(“write_out buffer:0x%x size:%d\n“ buffer size);
return (wrote == size) ? 0 : -1;
}
static uint8_t* RM_SDK_V2X_FillOctetString(OCTET_STRING_t* octetStr)
{
const uint32_t size = 8;
const uint8_t buf[8] = {0x10 0x20 0x30 };
octetStr->buf = calloc(1 size);
if (octetStr->buf == NULL)
{
return NULL;
}
memset(octetStr->buf 0 size);
memcpy(octetStr->buf buf size);
octetStr->size = size;
return octetStr->buf;
}
static int RM_SDK_V2X_MsgframeEncodeTest()
{
Messageframe_t *msgframe; /* Type to encode */
BSM_t *bsm;
uint8_t *octetStrBuf = NULL;
asn_enc_rval_t ec; /* Encoder return value */
/* Allocate the msgframe_t */
msgframe = calloc(1 sizeof(Messageframe_t)); /* not malloc! */
if(!msgframe) {
perror(“calloc() failed“);
exit(1);
}
/* Initialize the msgframe members */
msgframe->present = Messageframe_PR_bsmframe;
bsm = calloc(1 sizeof(BSM_t)); /* not malloc! */
if(!bsm) {
perror(“calloc() failed“);
exit(1);
}
/* Initialize the msgframe members */
bsm->msgCnt = 10; /* any random value */
octetStrBuf = RM_SDK_V2X_FillOctetString(&bsm->id);
bsm->plateNo = NULL;
bsm->secMark = 1234;
bsm->pos.lat = 12;
bsm->pos.Long = 23;
bsm->pos.elevation = NULL;
bsm->accuracy.pos = 1;
bsm->accuracy.elevation = NULL;
bsm->transmission = 2;
bsm->speed = 1234;
bsm->heading = 456;
bsm->accelSet.Long = 12;
bsm->accelSet.lat = 34;
bsm->accelSet.vert = 56;
bsm->accelSet.yaw = 78;
bsm->size.width = 90;
bsm->size.vehicleLength = 100;
bsm->vehicleClass.classification = 20;
memcpy(&msgframe->choice.bsmframe bsm sizeof(BSM_t));
FILE *fp = fopen(FILENAME “wb“); /* for BER output */
if(!fp) {
perror(FILENAME);
exit(1);
}
/* Encode the Rectangle type as PER (DER) */
ec = u
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 624 2020-06-17 16:49 asn1c_v2x_app\build_project.sh
文件 1160 2020-06-17 16:49 asn1c_v2x_app\V2xLog.h
文件 1025528 2020-06-17 16:49 asn1c_v2x_app\libasn1c_release.a
文件 1191 2020-06-17 16:49 asn1c_v2x_app\include\BrakeBoostApplied.h
文件 1629 2020-06-17 16:49 asn1c_v2x_app\include\asn_codecs_prim.h
文件 851 2020-06-17 16:49 asn1c_v2x_app\include\ConnectsToList.h
文件 1682 2020-06-17 16:49 asn1c_v2x_app\include\LaneAttributes-Crosswalk.h
文件 902 2020-06-17 16:49 asn1c_v2x_app\include\AlertType.h
文件 990 2020-06-17 16:49 asn1c_v2x_app\include\Node.h
文件 977 2020-06-17 16:49 asn1c_v2x_app\include\VertOffset-B09.h
文件 3515 2020-06-17 16:49 asn1c_v2x_app\include\asn_system.h
文件 1270 2020-06-17 16:49 asn1c_v2x_app\include\BrakeSystemStatus.h
文件 3443 2020-06-17 16:49 asn1c_v2x_app\include\asn_codecs.h
文件 995 2020-06-17 16:49 asn1c_v2x_app\include\Desc
文件 1469 2020-06-17 16:49 asn1c_v2x_app\include\SteeringWheelAngleConfidence.h
文件 886 2020-06-17 16:49 asn1c_v2x_app\include\AccelerationSet4Way.h
文件 857 2020-06-17 16:49 asn1c_v2x_app\include\LaneID.h
文件 1736 2020-06-17 16:49 asn1c_v2x_app\include\BSM.h
文件 1610 2020-06-17 16:49 asn1c_v2x_app\include\AllowedManeuvers.h
文件 977 2020-06-17 16:49 asn1c_v2x_app\include\VertOffset-B12.h
文件 1961 2020-06-17 16:49 asn1c_v2x_app\include\constraints.h
文件 841 2020-06-17 16:49 asn1c_v2x_app\include\VehicleSize.h
文件 1945 2020-06-17 16:49 asn1c_v2x_app\include\der_encoder.h
文件 4177 2020-06-17 16:49 asn1c_v2x_app\include\asn_internal.h
文件 1287 2020-06-17 16:49 asn1c_v2x_app\include\AuxiliaryBrakeStatus.h
文件 966 2020-06-17 16:49 asn1c_v2x_app\include\MotionConfidenceSet.h
文件 934 2020-06-17 16:49 asn1c_v2x_app\include\PhaseState.h
文件 780 2020-06-17 16:49 asn1c_v2x_app\include\Position-LLmD-64b.h
文件 842 2020-06-17 16:49 asn1c_v2x_app\include\DHour.h
文件 754 2020-06-17 16:49 asn1c_v2x_app\include\Position-LL-36B.h
............此处省略499个文件信息
- 上一篇:基于MIniGUI的贪吃蛇小游戏
- 下一篇:DS1621温度传感器实验仿真图和程序
相关资源
- 衰减的辐射校正$$ \\ varSigma ^ 0 \\ rig
- Apache Subversion1.10.3服务端SVN
- FolderSize Professional 3.4
- THERMAL ANNEALING TREATMENT TO ACHIEVE SWITCHA
- A Novel Algorithm for Ternary Reversible Logic
- Discovery of Reversible and Persistent Electri
- CiA-402-2-version-3.0.0
- 利用BSMV-VIGS鉴定TaPAL2的抗赤霉病功能
- BSMV-VIGS技术在小麦抗赤霉病基因鉴定
- CollabNetSubversionEdge for linux 5.2.4
- PeerSim chord仿真
- Peersim研究资料
- zw_xmuleea-11168271-1001BattleOverCities-HardV
- Seismic Frequency-domain Full waveform 2-D inv
- 植物内生真菌Pestalotiopsis versicolor代谢
- 3PAR高可用性解决方案 Peer Persistence
- 大学数据分析课程R软件实验教材
- 图像识别程序代码Version 2.0 January 20
- OV2778-Preliminary-Specification-a-CSP_Version
- DFT Compiler Scan User Guide Version E-2010.12
- NetReflectorVersion9.0.1.374.zip
- EmguCV 官方学习库文档 版本Version: 2.
- Parsing Techniques 英文带书签版
- OpenDDS Version 3.12中文版
- Carsim软件入门与精通PDF
- CarSim Training2—— 参数详解.ppt
- Signals and Systems
- 5G NR标准文件:3GPP TS 38.521-1 version 1
- CarSim软件入门与精通.PDF
- Beaver Builder Plugin (Pro Version)
评论
共有 条评论