Code Monkey home page Code Monkey logo

pando-embedded-framework's Introduction

##pando-embedded-framework #introduction When connecting a hardware device to the internet, we need a cloud, a device, and a gateway. We have to code in the device to get the data of the real word by hardware driver, code in the gateway to connect our device to the cloud and send data to the cloud by network, code in the cloud to deal with the business. We have to do so much, on the other hand, because of the variety of gateway and device, we have to implement the save business on different platform, such as, esp8266, 5350, stm32, ardunio, and so on.
The structure of conneting things to the internet is like below:
normal-IOT-structure
pando-embedded-framwork is different in that, it abstracts the common gateway business, such as register, login, access, and so on, leave the driver interface to be implemented on different platform; on the other hand, it abstracts the device common operations.
pando-IOT_structure
#directory structure
-doc -framework |-gateway |-lib |-platform |-include |-src |-stm32 |-protocol |-subdevice -example |-stm32

doc:the document.
gateway:the common gateway business.
lib:the library used.
include:the function declarations used in the framework, which should be implemented in different platforms.
src:contains the implementation of the interface in include for different platforms.
subdevice:the abstractation of device common operation.
example:because of that this framework is a library, so example contains base initialization and main function to run.
#how to If you want to use this framework in your own project, what you need to do is to implement the interface in include directory, and to add your own devices which are defined in subdevice. We will offer examples for you to refer to.
If you want to know more about the whole framework, you can follow the project pando-cloud to learn about the cloud. And the project tisan-kit contains more examples about the framework by our development board tisan.
We also appreciate you to share your implementation on your platform or improve this framework. If you want to do so, there is a coding style for you to read first in order to cooperate better. #Example stm32+3G esp8266

pando-embedded-framework's People

Contributors

leeshinesz avatar lxx719 avatar moimo avatar ruizeng avatar sarahchina avatar sw0813 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pando-embedded-framework's Issues

write fifo error

begin to execute task! 20004ec0
the at command is in sending!
timer 2 interrupt!
begin to execute task! 20004ec0
fifo used:9/10
begin login device...
mem_malloc the used heap is 12
device login request:::
{
"device_id":2,
"device_secret":"9QYNdnDjm9o/iNmelI0oBT9PhA",
"protocol":"mqtt"
}
(end)
host_name:120.24.222
http_path:/v1/devices/authentication
fifo used:10/10
write fifo error!
fifo used:10/10
write fifo error!
http_para:AT+CCHOPEN=1,"120.24.222.",443

fifo used:10/10
write fifo error!
mem_malloc the used heap is 14
mem_malloc the used heap is 15
http post:POST /v1/devices/authentication HTTP/1.1
Host: 120.24.222.:443
Connection: close
User-Agent: SIM5360
Content-Type:application/json
Content-Length: 88

{
"device_id":2,
"device_secret":"9QYNdnDjm9o/iNmelI0oBT9PhAqblSru",
"protocol":"mqtt"
}fifo used:10/10
write fifo error!
fifo used:10/10
write fifo error!
fifo used:10/10
write fifo error!
time 4 interrupt!
begin to execute task! 20004ec0
the at command is in sending!
time 4 interrupt!
begin to execute task! 20004ec0
the at command is in sending!
time 4 interrupt!

topic_buf memory leak bug

在pando_cloud_access.c文件中的函数static void FUNCTION_ATTRIBUTE
mqtt_data_cb(uint32_t args, const char topic, uint32_t topic_len, const char *data, uint32_t data_len)
中topic_buf创建后,没有考虑在switch中default分支情况下的释放操作:

mqtt状态topic从d改为s

新版本服务器已经将状态topic统一改为s(之前是d),框架需要把状态下发和上报的topic统一由d改为s

[proposal]增加命令处理和事件上报接口

背景

之前的框架层只实现了对status的上报和设置,并未实现命令和事件接口。鉴于目前还未实现完整的原语设计,所以先提供subdevice层的事件和命令接口封装。

修改建议

子设备核心框架逻辑都在framework/subdevice/目录下,文件功能如下:

  • pando_subdevice.c: 提供子设备核心协议处理及分发逻辑。
  • pando_object.c :提供对象注册和管理接口。

要实现命令和事件接口,大体方案如下:

1

新增pando_command.c pando_command.h,新增数据结构pando_command:

typedef struct {
    uint8_t no;
    uint8_t priority;
    void (*unpack)(PARAMS*);
}pando_command;

新增如下接口:

void register_pando_command(pando_command command);
pando_command* find_pando_command(uint8_t no);

暂不考虑优先级的处理。(已经预留)

2

新增pando_event.c pando_event.h,新增数据结构pando_event:

typedef struct {
    uint8_t no;
    uint8_t priority;
    void (*pack)(PARAMS*);
}pando_event;

新增如下接口:

void register_pando_event(pando_event event);
pando_event* find_pando_event(uint8_t no);

暂不考虑优先级的处理。(已经预留)

3

pando_subdevice增加接口report_event(uint8_t no),提供事件的主动上报功能。

4

事件和命令都通过链表进行管理,具体方法参考pando_object;

当pando_subdevice中decode_command解析出的命令不是通用指令时,就调用find_pando_command调用其unpack方法。(参考object状态设置部分)

当用户主动上报事件时,调用report_event方法,此方法调用find_pando_event先找到对应的event,调用其pack方法,打包好数据后上报(参考object状态上报部分)。

@tianlongqiang @leeshineSZ @LottesLiu @sw0813

函数参数多余

mqtt.c文件里面一个mqtt连接的函数mqtt_tcpclient_connect_cb(void *arg, int8_t errno)的第二个参数在下面的函数体中未用到

image

Not date, but data

Not date, but data
When connecting a hardware device to the internet, we need a cloud, a device, and a gateway. We have to code in the device to get the date of the real word by hardware driver, code in the gateway to connect our device to the cloud and send date to the cloud by network, code in the cloud to deal with the business....

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.