shudingbo / node-cppmsg Goto Github PK
View Code? Open in Web Editor NEWparse binary data from the c++, can also be generate binary data(from json object) that c/c++ can phrase.
License: MIT License
parse binary data from the c++, can also be generate binary data(from json object) that c/c++ can phrase.
License: MIT License
1.0.2版本.node版本4.4
因需求,将原有的gb2312编码改为了utf8
依据DEMO。
调用解析时: msg.decodeMsg(buff)
{ reg: 2,
chkCode: 0,
iType: 2,
bMonitor: false,
workPath: 'no 你 wor',
processID: 1234,
subType: { mainType: 16909060, subType: 168496141 },
testint64: 52719 }
subType: { mainType: 16909060, subType: 168496141 }
正确解析应为
testObj: { mainType: 16909060, subType: 168496141 }
原因是在调用decodeObject的递归时,遗失了当前对象名。
临时解决方案
在获知是对象进行递归时,将当前key值传入。
values.push(decodeObject(buf, off, info[4],key));
设定全局key变量
this.objKey=null;//对象key
在decodeObject方法内赋值。
decodeObject(buf, offset, dsDecode,objKey)
if(objKey){
this.objKey=objKey;
}
追加data值时,判断当前value[0]是否为对象object
values[0] instanceof Object
是对象时,以全局key为相应key值。
data[this.objKey] = arrayLen <= 1 ? values[0] : values;
您好
无法正确写及读int64类型的数据
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.