Git Product home page Git Product logo

b_tp's Introduction

b_tp

功能说明

1、支持通信数据传输的分包以及组包
2、通用协议格式,同时支持协议头自定义配置
3、接口简单,使用方便
4、数据校验方式可选CRC32, CRC16等

协议格式说明

【协议头】【数据】【校验】 协议头格式:

typedef struct
{
  B_TP_HEAD_TYPE          head;
  B_TP_FRAME_NUMBER_TYPE  f_num;
  b_TPU8                  number;         /**< 自定义一项 */
  B_TP_TOTAL_LEN_TYPE     total_len;
}b_tp_head_t;

非自定义的项变量名不能改变

头标志: 数据类型可以配置
分帧标志: 是否分帧传输
数据长度: 数据的长度,不包括协议头以及校验
校验: 校验方式可选,对协议头以及数据部分进行校验

使用接口说明

1、根据需求完成b_tp_config.h文件的配置
2、如果在协议头加入了自定义项,实现一下两个函数来操作自定义的部分:

b_tp_err_code_t _b_tp_rec_check_head(b_tp_head_t *);
void _b_tp_send_set_head(b_tp_head_t *);

3、完成b_tp_port.c里数据发送
4、收到数据后将收到的数据通过b_tp_receive_data函数提交给b_tp进行解析
5、解析完成后调用回调,所以通过b_tp_reg_callback注册回调

如有建议或者疑问: email: [email protected]

b_tp's People

Contributors

notrynohigh avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.