asdasdasdasd
Dependencies: Audio EthernetInterface mbed-rtos mbed
Fork of FRDM_TCP_v4_copy by
Diff: LokerFraming.cpp
- Revision:
- 11:9280da8e40bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LokerFraming.cpp Fri Aug 10 09:12:27 2018 +0000 @@ -0,0 +1,40 @@ +#include "mbed.h" +#include "LokerFraming.h" + +extern Serial dbg; + +LokerFraming::LokerFraming() +{ + +} + +LokerFraming::~LokerFraming() +{ + +} + +void LokerFraming::ProcessFromHost(const std::vector<int> &stream) +{ + LokerFrm f; + + f.stx = stream[0]; + f.status = stream[1]; + f.Data.push_back(stream[2]); + f.Data.push_back(stream[3]); + f.etx = stream[4]; + RCV_QUE.push(f); +} + +std::vector<int> LokerFraming::CreateFrame(const LokerFrm &f) +{ + std::vector<int> result; + + result.push_back(f.stx); + result.push_back(f.status); + for(int i=0; i<f.Data.size(); i++) + { + result.push_back(f.Data[i] & 0x0FF); + } + result.push_back(f.etx); + return result; +} \ No newline at end of file