3.2.5 beta1 重写波形解析逻辑,
This commit is contained in:
parent
981380013d
commit
c1fc6584f2
@ -86,6 +86,17 @@ struct DevData{
|
|||||||
memset(mDataMing, 0, 128);
|
memset(mDataMing, 0, 128);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
struct compressWaveChannel
|
||||||
|
{
|
||||||
|
int compressChannelX;
|
||||||
|
int compressChannelY;
|
||||||
|
int compressChannelZ;
|
||||||
|
compressWaveChannel(){
|
||||||
|
compressChannelX = 0;
|
||||||
|
compressChannelY = 0;
|
||||||
|
compressChannelZ = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
struct DevDataOfGwid{
|
struct DevDataOfGwid{
|
||||||
std::string mDevdata;
|
std::string mDevdata;
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "../API_log/SH_log.h"
|
#include "../API_log/SH_log.h"
|
||||||
#include "SH_CommonFunc.hpp"
|
#include "SH_CommonFunc.hpp"
|
||||||
#include "../mqttclient/SH_MqttClient.h"
|
#include "../mqttclient/SH_MqttClient.h"
|
||||||
|
#include "../minilzo-2.10/minilzo.h"
|
||||||
|
|
||||||
|
|
||||||
#define SECTION_MAX_LEN 1024
|
#define SECTION_MAX_LEN 1024
|
||||||
@ -55,6 +56,7 @@ public :
|
|||||||
static GPIOInfo GPIO_G;
|
static GPIOInfo GPIO_G;
|
||||||
static enumZigBeeTransmitStatus EnterZigBeeWaveTransmittingFlag_G; // 进入ZigBee网络原始数据传输状态标志
|
static enumZigBeeTransmitStatus EnterZigBeeWaveTransmittingFlag_G; // 进入ZigBee网络原始数据传输状态标志
|
||||||
static int EnterZigBeeWaveTransmittingCnt_G; // 进入ZigBee网络原始数据传输状态计数器,以秒为单位进行计数
|
static int EnterZigBeeWaveTransmittingCnt_G; // 进入ZigBee网络原始数据传输状态计数器,以秒为单位进行计数
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NONE "\033[m"
|
#define NONE "\033[m"
|
||||||
|
@ -91,6 +91,10 @@ void SqliteDB::SqliteInit(const char *pDbName, bool isDB2)
|
|||||||
if(iRet == 0){
|
if(iRet == 0){
|
||||||
CreateTable("ALTER TABLE t_sensor_info ADD COLUMN 'MeasurementID'");
|
CreateTable("ALTER TABLE t_sensor_info ADD COLUMN 'MeasurementID'");
|
||||||
}
|
}
|
||||||
|
iRet = GetTableRows(" sqlite_master "," name = 't_sensor_info' and sql LIKE '%NodeWaveSend%' ");
|
||||||
|
if(iRet == 0){
|
||||||
|
CreateTable("ALTER TABLE t_sensor_info ADD COLUMN 'NodeWaveSend'");
|
||||||
|
}
|
||||||
|
|
||||||
memset(sql_exec, 0, 2048);
|
memset(sql_exec, 0, 2048);
|
||||||
sprintf(sql_exec,"update t_sensor_info set MeasurementID = dataNodeNo where MeasurementID IS NULL ;");
|
sprintf(sql_exec,"update t_sensor_info set MeasurementID = dataNodeNo where MeasurementID IS NULL ;");
|
||||||
@ -1237,6 +1241,7 @@ std::string SqliteDB::GetNodeConfigureInfor(const char* whereCon)
|
|||||||
jsSensorData["looseValue"] = arrRes[j][42];
|
jsSensorData["looseValue"] = arrRes[j][42];
|
||||||
jsSensorData["battery"] = arrRes[j][43];
|
jsSensorData["battery"] = arrRes[j][43];
|
||||||
jsSensorData["MeasurementID"] = arrRes[j][44];
|
jsSensorData["MeasurementID"] = arrRes[j][44];
|
||||||
|
jsSensorData["nodeWaveSend"] = arrRes[j][45];
|
||||||
jsArray.append(jsSensorData);
|
jsArray.append(jsSensorData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -280,6 +280,7 @@ std::string JsonData::JsonCmd_26(Param_26 ¶m)
|
|||||||
jsSensorData["looseValue"] = arrRes[j][42];
|
jsSensorData["looseValue"] = arrRes[j][42];
|
||||||
jsSensorData["battery"] = arrRes[j][43];
|
jsSensorData["battery"] = arrRes[j][43];
|
||||||
jsSensorData["MeasurementID"] = arrRes[j][44];
|
jsSensorData["MeasurementID"] = arrRes[j][44];
|
||||||
|
jsSensorData["nodeWaveSend"] = arrRes[j][45];
|
||||||
jsArray.append(jsSensorData);
|
jsArray.append(jsSensorData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
18
main.cpp
18
main.cpp
@ -22,8 +22,9 @@ namespace{
|
|||||||
PlatformInit *platform = PlatformInit::instance();
|
PlatformInit *platform = PlatformInit::instance();
|
||||||
Uart *pUart = Uart::instance();
|
Uart *pUart = Uart::instance();
|
||||||
}
|
}
|
||||||
|
extern std::vector<RecvData> g_VecWaveDataX;
|
||||||
|
extern std::vector<RecvData> g_VecWaveDataY;
|
||||||
|
extern std::vector<RecvData> g_VecWaveDataZ;
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
printf(" Firmware compile time:%s %s,version %s\n", __DATE__, __TIME__,GlobalConfig::Version.c_str());
|
printf(" Firmware compile time:%s %s,version %s\n", __DATE__, __TIME__,GlobalConfig::Version.c_str());
|
||||||
@ -36,6 +37,9 @@ int main(int argc, char *argv[])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_VecWaveDataX.resize(300000);
|
||||||
|
g_VecWaveDataY.resize(300000);
|
||||||
|
g_VecWaveDataZ.resize(500000);
|
||||||
// 设置线程属性之栈空间大小
|
// 设置线程属性之栈空间大小
|
||||||
boost::thread::attributes attrs;
|
boost::thread::attributes attrs;
|
||||||
attrs.set_stack_size(1024*1024*2);//2M
|
attrs.set_stack_size(1024*1024*2);//2M
|
||||||
@ -137,7 +141,13 @@ int main(int argc, char *argv[])
|
|||||||
boost::thread startHeart(HeartRep);
|
boost::thread startHeart(HeartRep);
|
||||||
startHeart.detach();
|
startHeart.detach();
|
||||||
|
|
||||||
int fd = OpenWatchDog();
|
if (lzo_init() != LZO_E_OK)
|
||||||
|
{
|
||||||
|
printf("internal error - lzo_init() failed !!!\n");
|
||||||
|
printf("(this usually indicates a compiler bug - try recompiling\nwithout optimizations, and enable '-DLZO_DEBUG' for diagnostics)\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
//int fd = OpenWatchDog();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (GlobalConfig::QuitFlag_G) {
|
while (GlobalConfig::QuitFlag_G) {
|
||||||
#ifdef G2UL_GATEWAY
|
#ifdef G2UL_GATEWAY
|
||||||
@ -145,7 +155,7 @@ int main(int argc, char *argv[])
|
|||||||
usleep(20000);
|
usleep(20000);
|
||||||
gpio_set(GlobalConfig::GPIO_G.hardWatchDog,0);
|
gpio_set(GlobalConfig::GPIO_G.hardWatchDog,0);
|
||||||
#endif
|
#endif
|
||||||
WriteWatchDog(fd);
|
//WriteWatchDog(fd);
|
||||||
sleep(20);
|
sleep(20);
|
||||||
if(GlobalConfig::threadStatus == 0){
|
if(GlobalConfig::threadStatus == 0){
|
||||||
count ++;
|
count ++;
|
||||||
|
339
minilzo-2.10/COPYING
Normal file
339
minilzo-2.10/COPYING
Normal file
@ -0,0 +1,339 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License.
|
123
minilzo-2.10/README.LZO
Normal file
123
minilzo-2.10/README.LZO
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
|
||||||
|
============================================================================
|
||||||
|
miniLZO -- mini subset of the LZO real-time data compression library
|
||||||
|
============================================================================
|
||||||
|
|
||||||
|
Author : Markus Franz Xaver Johannes Oberhumer
|
||||||
|
<markus@oberhumer.com>
|
||||||
|
http://www.oberhumer.com/opensource/lzo/
|
||||||
|
Version : 2.10
|
||||||
|
Date : 01 Mar 2017
|
||||||
|
|
||||||
|
I've created miniLZO for projects where it is inconvenient to
|
||||||
|
include (or require) the full LZO source code just because you
|
||||||
|
want to add a little bit of data compression to your application.
|
||||||
|
|
||||||
|
miniLZO implements the LZO1X-1 compressor and both the standard and
|
||||||
|
safe LZO1X decompressor. Apart from fast compression it also useful
|
||||||
|
for situations where you want to use pre-compressed data files (which
|
||||||
|
must have been compressed with LZO1X-999).
|
||||||
|
|
||||||
|
miniLZO consists of one C source file and three header files:
|
||||||
|
minilzo.c
|
||||||
|
minilzo.h, lzoconf.h, lzodefs.h
|
||||||
|
|
||||||
|
To use miniLZO just copy these files into your source directory, add
|
||||||
|
minilzo.c to your Makefile and #include minilzo.h from your program.
|
||||||
|
Note: you also must distribute this file ('README.LZO') with your project.
|
||||||
|
|
||||||
|
minilzo.o compiles to about 6 KiB (using gcc or Visual C on an i386), and
|
||||||
|
the sources are about 30 KiB when packed with zip - so there's no more
|
||||||
|
excuse that your application doesn't support data compression :-)
|
||||||
|
|
||||||
|
For more information, documentation, example programs and other support
|
||||||
|
files (like Makefiles and build scripts) please download the full LZO
|
||||||
|
package from
|
||||||
|
http://www.oberhumer.com/opensource/lzo/
|
||||||
|
|
||||||
|
Have fun,
|
||||||
|
Markus
|
||||||
|
|
||||||
|
|
||||||
|
P.S. minilzo.c is generated automatically from the LZO sources and
|
||||||
|
therefore functionality is completely identical
|
||||||
|
|
||||||
|
|
||||||
|
Appendix A: building miniLZO
|
||||||
|
----------------------------
|
||||||
|
miniLZO is written such a way that it should compile and run
|
||||||
|
out-of-the-box on most machines.
|
||||||
|
|
||||||
|
If you are running on a very unusual architecture and lzo_init() fails then
|
||||||
|
you should first recompile with '-DLZO_DEBUG' to see what causes the failure.
|
||||||
|
The most probable case is something like 'sizeof(void *) != sizeof(size_t)'.
|
||||||
|
After identifying the problem you can compile by adding some defines
|
||||||
|
like '-DSIZEOF_VOID_P=8' to your Makefile.
|
||||||
|
|
||||||
|
The best solution is (of course) using Autoconf - if your project uses
|
||||||
|
Autoconf anyway just add '-DMINILZO_HAVE_CONFIG_H' to your compiler
|
||||||
|
flags when compiling minilzo.c. See the LZO distribution for an example
|
||||||
|
how to set up configure.ac.
|
||||||
|
|
||||||
|
|
||||||
|
Appendix B: list of public functions available in miniLZO
|
||||||
|
---------------------------------------------------------
|
||||||
|
Library initialization
|
||||||
|
lzo_init()
|
||||||
|
|
||||||
|
Compression
|
||||||
|
lzo1x_1_compress()
|
||||||
|
|
||||||
|
Decompression
|
||||||
|
lzo1x_decompress()
|
||||||
|
lzo1x_decompress_safe()
|
||||||
|
|
||||||
|
Checksum functions
|
||||||
|
lzo_adler32()
|
||||||
|
|
||||||
|
Version functions
|
||||||
|
lzo_version()
|
||||||
|
lzo_version_string()
|
||||||
|
lzo_version_date()
|
||||||
|
|
||||||
|
Portable (but slow) string functions
|
||||||
|
lzo_memcmp()
|
||||||
|
lzo_memcpy()
|
||||||
|
lzo_memmove()
|
||||||
|
lzo_memset()
|
||||||
|
|
||||||
|
|
||||||
|
Appendix C: suggested macros for 'configure.ac' when using Autoconf
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Checks for typedefs and structures
|
||||||
|
AC_CHECK_TYPE(ptrdiff_t,long)
|
||||||
|
AC_TYPE_SIZE_T
|
||||||
|
AC_CHECK_SIZEOF(short)
|
||||||
|
AC_CHECK_SIZEOF(int)
|
||||||
|
AC_CHECK_SIZEOF(long)
|
||||||
|
AC_CHECK_SIZEOF(long long)
|
||||||
|
AC_CHECK_SIZEOF(__int64)
|
||||||
|
AC_CHECK_SIZEOF(void *)
|
||||||
|
AC_CHECK_SIZEOF(size_t)
|
||||||
|
AC_CHECK_SIZEOF(ptrdiff_t)
|
||||||
|
|
||||||
|
Checks for compiler characteristics
|
||||||
|
AC_C_CONST
|
||||||
|
|
||||||
|
Checks for library functions
|
||||||
|
AC_CHECK_FUNCS(memcmp memcpy memmove memset)
|
||||||
|
|
||||||
|
|
||||||
|
Appendix D: Copyright
|
||||||
|
---------------------
|
||||||
|
LZO and miniLZO are Copyright (C) 1996-2017 Markus Franz Xaver Oberhumer
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
LZO and miniLZO are distributed under the terms of the GNU General
|
||||||
|
Public License (GPL). See the file COPYING.
|
||||||
|
|
||||||
|
Special licenses for commercial and other applications which
|
||||||
|
are not willing to accept the GNU General Public License
|
||||||
|
are available by contacting the author.
|
||||||
|
|
||||||
|
|
453
minilzo-2.10/lzoconf.h
Normal file
453
minilzo-2.10/lzoconf.h
Normal file
@ -0,0 +1,453 @@
|
|||||||
|
/* lzoconf.h -- configuration of the LZO data compression library
|
||||||
|
|
||||||
|
This file is part of the LZO real-time data compression library.
|
||||||
|
|
||||||
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
The LZO library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The LZO library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with the LZO library; see the file COPYING.
|
||||||
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
Markus F.X.J. Oberhumer
|
||||||
|
<markus@oberhumer.com>
|
||||||
|
http://www.oberhumer.com/opensource/lzo/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __LZOCONF_H_INCLUDED
|
||||||
|
#define __LZOCONF_H_INCLUDED 1
|
||||||
|
|
||||||
|
#define LZO_VERSION 0x20a0 /* 2.10 */
|
||||||
|
#define LZO_VERSION_STRING "2.10"
|
||||||
|
#define LZO_VERSION_DATE "Mar 01 2017"
|
||||||
|
|
||||||
|
/* internal Autoconf configuration file - only used when building LZO */
|
||||||
|
#if defined(LZO_HAVE_CONFIG_H)
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
// LZO requires a conforming <limits.h>
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(CHAR_BIT) || (CHAR_BIT != 8)
|
||||||
|
# error "invalid CHAR_BIT"
|
||||||
|
#endif
|
||||||
|
#if !defined(UCHAR_MAX) || !defined(USHRT_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
|
||||||
|
# error "check your compiler installation"
|
||||||
|
#endif
|
||||||
|
#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
|
||||||
|
# error "your limits.h macros are broken"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* get OS and architecture defines */
|
||||||
|
#ifndef __LZODEFS_H_INCLUDED
|
||||||
|
#include <lzodefs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
// some core defines
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/* memory checkers */
|
||||||
|
#if !defined(__LZO_CHECKER)
|
||||||
|
# if defined(__BOUNDS_CHECKING_ON)
|
||||||
|
# define __LZO_CHECKER 1
|
||||||
|
# elif defined(__CHECKER__)
|
||||||
|
# define __LZO_CHECKER 1
|
||||||
|
# elif defined(__INSURE__)
|
||||||
|
# define __LZO_CHECKER 1
|
||||||
|
# elif defined(__PURIFY__)
|
||||||
|
# define __LZO_CHECKER 1
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
// integral and pointer types
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/* lzo_uint must match size_t */
|
||||||
|
#if !defined(LZO_UINT_MAX)
|
||||||
|
# if (LZO_ABI_LLP64)
|
||||||
|
# if (LZO_OS_WIN64)
|
||||||
|
typedef unsigned __int64 lzo_uint;
|
||||||
|
typedef __int64 lzo_int;
|
||||||
|
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF___INT64
|
||||||
|
# else
|
||||||
|
typedef lzo_ullong_t lzo_uint;
|
||||||
|
typedef lzo_llong_t lzo_int;
|
||||||
|
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG_LONG
|
||||||
|
# endif
|
||||||
|
# define LZO_SIZEOF_LZO_INT 8
|
||||||
|
# define LZO_UINT_MAX 0xffffffffffffffffull
|
||||||
|
# define LZO_INT_MAX 9223372036854775807LL
|
||||||
|
# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
|
||||||
|
# elif (LZO_ABI_IP32L64) /* MIPS R5900 */
|
||||||
|
typedef unsigned int lzo_uint;
|
||||||
|
typedef int lzo_int;
|
||||||
|
# define LZO_SIZEOF_LZO_INT LZO_SIZEOF_INT
|
||||||
|
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_INT
|
||||||
|
# define LZO_UINT_MAX UINT_MAX
|
||||||
|
# define LZO_INT_MAX INT_MAX
|
||||||
|
# define LZO_INT_MIN INT_MIN
|
||||||
|
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
||||||
|
typedef unsigned long lzo_uint;
|
||||||
|
typedef long lzo_int;
|
||||||
|
# define LZO_SIZEOF_LZO_INT LZO_SIZEOF_LONG
|
||||||
|
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG
|
||||||
|
# define LZO_UINT_MAX ULONG_MAX
|
||||||
|
# define LZO_INT_MAX LONG_MAX
|
||||||
|
# define LZO_INT_MIN LONG_MIN
|
||||||
|
# else
|
||||||
|
# error "lzo_uint"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The larger type of lzo_uint and lzo_uint32_t. */
|
||||||
|
#if (LZO_SIZEOF_LZO_INT >= 4)
|
||||||
|
# define lzo_xint lzo_uint
|
||||||
|
#else
|
||||||
|
# define lzo_xint lzo_uint32_t
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef int lzo_bool;
|
||||||
|
|
||||||
|
/* sanity checks */
|
||||||
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int) == LZO_SIZEOF_LZO_INT)
|
||||||
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == LZO_SIZEOF_LZO_INT)
|
||||||
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint))
|
||||||
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint32_t))
|
||||||
|
|
||||||
|
#ifndef __LZO_MMODEL
|
||||||
|
#define __LZO_MMODEL /*empty*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* no typedef here because of const-pointer issues */
|
||||||
|
#define lzo_bytep unsigned char __LZO_MMODEL *
|
||||||
|
#define lzo_charp char __LZO_MMODEL *
|
||||||
|
#define lzo_voidp void __LZO_MMODEL *
|
||||||
|
#define lzo_shortp short __LZO_MMODEL *
|
||||||
|
#define lzo_ushortp unsigned short __LZO_MMODEL *
|
||||||
|
#define lzo_intp lzo_int __LZO_MMODEL *
|
||||||
|
#define lzo_uintp lzo_uint __LZO_MMODEL *
|
||||||
|
#define lzo_xintp lzo_xint __LZO_MMODEL *
|
||||||
|
#define lzo_voidpp lzo_voidp __LZO_MMODEL *
|
||||||
|
#define lzo_bytepp lzo_bytep __LZO_MMODEL *
|
||||||
|
|
||||||
|
#define lzo_int8_tp lzo_int8_t __LZO_MMODEL *
|
||||||
|
#define lzo_uint8_tp lzo_uint8_t __LZO_MMODEL *
|
||||||
|
#define lzo_int16_tp lzo_int16_t __LZO_MMODEL *
|
||||||
|
#define lzo_uint16_tp lzo_uint16_t __LZO_MMODEL *
|
||||||
|
#define lzo_int32_tp lzo_int32_t __LZO_MMODEL *
|
||||||
|
#define lzo_uint32_tp lzo_uint32_t __LZO_MMODEL *
|
||||||
|
#if defined(lzo_int64_t)
|
||||||
|
#define lzo_int64_tp lzo_int64_t __LZO_MMODEL *
|
||||||
|
#define lzo_uint64_tp lzo_uint64_t __LZO_MMODEL *
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Older LZO versions used to support ancient systems and memory models
|
||||||
|
* such as 16-bit MSDOS with __huge pointers or Cray PVP, but these
|
||||||
|
* obsolete configurations are not supported any longer.
|
||||||
|
*/
|
||||||
|
#if defined(__LZO_MMODEL_HUGE)
|
||||||
|
#error "__LZO_MMODEL_HUGE memory model is unsupported"
|
||||||
|
#endif
|
||||||
|
#if (LZO_MM_PVP)
|
||||||
|
#error "LZO_MM_PVP memory model is unsupported"
|
||||||
|
#endif
|
||||||
|
#if (LZO_SIZEOF_INT < 4)
|
||||||
|
#error "LZO_SIZEOF_INT < 4 is unsupported"
|
||||||
|
#endif
|
||||||
|
#if (__LZO_UINTPTR_T_IS_POINTER)
|
||||||
|
#error "__LZO_UINTPTR_T_IS_POINTER is unsupported"
|
||||||
|
#endif
|
||||||
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) >= 4)
|
||||||
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) >= 4)
|
||||||
|
/* Strange configurations where sizeof(lzo_uint) != sizeof(size_t) should
|
||||||
|
* work but have not received much testing lately, so be strict here.
|
||||||
|
*/
|
||||||
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(size_t))
|
||||||
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(ptrdiff_t))
|
||||||
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(lzo_uintptr_t))
|
||||||
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_uintptr_t))
|
||||||
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_uintptr_t))
|
||||||
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long *) == sizeof(lzo_uintptr_t))
|
||||||
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_voidp))
|
||||||
|
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_bytep))
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
// function types
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/* name mangling */
|
||||||
|
#if !defined(__LZO_EXTERN_C)
|
||||||
|
# ifdef __cplusplus
|
||||||
|
# define __LZO_EXTERN_C extern "C"
|
||||||
|
# else
|
||||||
|
# define __LZO_EXTERN_C extern
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* calling convention */
|
||||||
|
#if !defined(__LZO_CDECL)
|
||||||
|
# define __LZO_CDECL __lzo_cdecl
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* DLL export information */
|
||||||
|
#if !defined(__LZO_EXPORT1)
|
||||||
|
# define __LZO_EXPORT1 /*empty*/
|
||||||
|
#endif
|
||||||
|
#if !defined(__LZO_EXPORT2)
|
||||||
|
# define __LZO_EXPORT2 /*empty*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* __cdecl calling convention for public C and assembly functions */
|
||||||
|
#if !defined(LZO_PUBLIC)
|
||||||
|
# define LZO_PUBLIC(r) __LZO_EXPORT1 r __LZO_EXPORT2 __LZO_CDECL
|
||||||
|
#endif
|
||||||
|
#if !defined(LZO_EXTERN)
|
||||||
|
# define LZO_EXTERN(r) __LZO_EXTERN_C LZO_PUBLIC(r)
|
||||||
|
#endif
|
||||||
|
#if !defined(LZO_PRIVATE)
|
||||||
|
# define LZO_PRIVATE(r) static r __LZO_CDECL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* function types */
|
||||||
|
typedef int
|
||||||
|
(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem );
|
||||||
|
|
||||||
|
typedef int
|
||||||
|
(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem );
|
||||||
|
|
||||||
|
typedef int
|
||||||
|
(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem );
|
||||||
|
|
||||||
|
typedef int
|
||||||
|
(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem,
|
||||||
|
const lzo_bytep dict, lzo_uint dict_len );
|
||||||
|
|
||||||
|
typedef int
|
||||||
|
(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem,
|
||||||
|
const lzo_bytep dict, lzo_uint dict_len );
|
||||||
|
|
||||||
|
|
||||||
|
/* Callback interface. Currently only the progress indicator ("nprogress")
|
||||||
|
* is used, but this may change in a future release. */
|
||||||
|
|
||||||
|
struct lzo_callback_t;
|
||||||
|
typedef struct lzo_callback_t lzo_callback_t;
|
||||||
|
#define lzo_callback_p lzo_callback_t __LZO_MMODEL *
|
||||||
|
|
||||||
|
/* malloc & free function types */
|
||||||
|
typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
|
||||||
|
(lzo_callback_p self, lzo_uint items, lzo_uint size);
|
||||||
|
typedef void (__LZO_CDECL *lzo_free_func_t)
|
||||||
|
(lzo_callback_p self, lzo_voidp ptr);
|
||||||
|
|
||||||
|
/* a progress indicator callback function */
|
||||||
|
typedef void (__LZO_CDECL *lzo_progress_func_t)
|
||||||
|
(lzo_callback_p, lzo_uint, lzo_uint, int);
|
||||||
|
|
||||||
|
struct lzo_callback_t
|
||||||
|
{
|
||||||
|
/* custom allocators (set to 0 to disable) */
|
||||||
|
lzo_alloc_func_t nalloc; /* [not used right now] */
|
||||||
|
lzo_free_func_t nfree; /* [not used right now] */
|
||||||
|
|
||||||
|
/* a progress indicator callback function (set to 0 to disable) */
|
||||||
|
lzo_progress_func_t nprogress;
|
||||||
|
|
||||||
|
/* INFO: the first parameter "self" of the nalloc/nfree/nprogress
|
||||||
|
* callbacks points back to this struct, so you are free to store
|
||||||
|
* some extra info in the following variables. */
|
||||||
|
lzo_voidp user1;
|
||||||
|
lzo_xint user2;
|
||||||
|
lzo_xint user3;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
// error codes and prototypes
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/* Error codes for the compression/decompression functions. Negative
|
||||||
|
* values are errors, positive values will be used for special but
|
||||||
|
* normal events.
|
||||||
|
*/
|
||||||
|
#define LZO_E_OK 0
|
||||||
|
#define LZO_E_ERROR (-1)
|
||||||
|
#define LZO_E_OUT_OF_MEMORY (-2) /* [lzo_alloc_func_t failure] */
|
||||||
|
#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */
|
||||||
|
#define LZO_E_INPUT_OVERRUN (-4)
|
||||||
|
#define LZO_E_OUTPUT_OVERRUN (-5)
|
||||||
|
#define LZO_E_LOOKBEHIND_OVERRUN (-6)
|
||||||
|
#define LZO_E_EOF_NOT_FOUND (-7)
|
||||||
|
#define LZO_E_INPUT_NOT_CONSUMED (-8)
|
||||||
|
#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
|
||||||
|
#define LZO_E_INVALID_ARGUMENT (-10)
|
||||||
|
#define LZO_E_INVALID_ALIGNMENT (-11) /* pointer argument is not properly aligned */
|
||||||
|
#define LZO_E_OUTPUT_NOT_CONSUMED (-12)
|
||||||
|
#define LZO_E_INTERNAL_ERROR (-99)
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef lzo_sizeof_dict_t
|
||||||
|
# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* lzo_init() should be the first function you call.
|
||||||
|
* Check the return code !
|
||||||
|
*
|
||||||
|
* lzo_init() is a macro to allow checking that the library and the
|
||||||
|
* compiler's view of various types are consistent.
|
||||||
|
*/
|
||||||
|
#define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
|
||||||
|
(int)sizeof(long),(int)sizeof(lzo_uint32_t),(int)sizeof(lzo_uint),\
|
||||||
|
(int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
|
||||||
|
(int)sizeof(lzo_callback_t))
|
||||||
|
LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
|
||||||
|
|
||||||
|
/* version functions (useful for shared libraries) */
|
||||||
|
LZO_EXTERN(unsigned) lzo_version(void);
|
||||||
|
LZO_EXTERN(const char *) lzo_version_string(void);
|
||||||
|
LZO_EXTERN(const char *) lzo_version_date(void);
|
||||||
|
LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
|
||||||
|
LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
|
||||||
|
|
||||||
|
/* string functions */
|
||||||
|
LZO_EXTERN(int)
|
||||||
|
lzo_memcmp(const lzo_voidp a, const lzo_voidp b, lzo_uint len);
|
||||||
|
LZO_EXTERN(lzo_voidp)
|
||||||
|
lzo_memcpy(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
|
||||||
|
LZO_EXTERN(lzo_voidp)
|
||||||
|
lzo_memmove(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
|
||||||
|
LZO_EXTERN(lzo_voidp)
|
||||||
|
lzo_memset(lzo_voidp buf, int c, lzo_uint len);
|
||||||
|
|
||||||
|
/* checksum functions */
|
||||||
|
LZO_EXTERN(lzo_uint32_t)
|
||||||
|
lzo_adler32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len);
|
||||||
|
LZO_EXTERN(lzo_uint32_t)
|
||||||
|
lzo_crc32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len);
|
||||||
|
LZO_EXTERN(const lzo_uint32_tp)
|
||||||
|
lzo_get_crc32_table(void);
|
||||||
|
|
||||||
|
/* misc. */
|
||||||
|
LZO_EXTERN(int) _lzo_config_check(void);
|
||||||
|
typedef union {
|
||||||
|
lzo_voidp a00; lzo_bytep a01; lzo_uint a02; lzo_xint a03; lzo_uintptr_t a04;
|
||||||
|
void *a05; unsigned char *a06; unsigned long a07; size_t a08; ptrdiff_t a09;
|
||||||
|
#if defined(lzo_int64_t)
|
||||||
|
lzo_uint64_t a10;
|
||||||
|
#endif
|
||||||
|
} lzo_align_t;
|
||||||
|
|
||||||
|
/* align a char pointer on a boundary that is a multiple of 'size' */
|
||||||
|
LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size);
|
||||||
|
#define LZO_PTR_ALIGN_UP(p,size) \
|
||||||
|
((p) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(p),(lzo_uint)(size)))
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
// deprecated macros - only for backward compatibility
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/* deprecated - use 'lzo_bytep' instead of 'lzo_byte *' */
|
||||||
|
#define lzo_byte unsigned char
|
||||||
|
/* deprecated type names */
|
||||||
|
#define lzo_int32 lzo_int32_t
|
||||||
|
#define lzo_uint32 lzo_uint32_t
|
||||||
|
#define lzo_int32p lzo_int32_t __LZO_MMODEL *
|
||||||
|
#define lzo_uint32p lzo_uint32_t __LZO_MMODEL *
|
||||||
|
#define LZO_INT32_MAX LZO_INT32_C(2147483647)
|
||||||
|
#define LZO_UINT32_MAX LZO_UINT32_C(4294967295)
|
||||||
|
#if defined(lzo_int64_t)
|
||||||
|
#define lzo_int64 lzo_int64_t
|
||||||
|
#define lzo_uint64 lzo_uint64_t
|
||||||
|
#define lzo_int64p lzo_int64_t __LZO_MMODEL *
|
||||||
|
#define lzo_uint64p lzo_uint64_t __LZO_MMODEL *
|
||||||
|
#define LZO_INT64_MAX LZO_INT64_C(9223372036854775807)
|
||||||
|
#define LZO_UINT64_MAX LZO_UINT64_C(18446744073709551615)
|
||||||
|
#endif
|
||||||
|
/* deprecated types */
|
||||||
|
typedef union { lzo_bytep a; lzo_uint b; } __lzo_pu_u;
|
||||||
|
typedef union { lzo_bytep a; lzo_uint32_t b; } __lzo_pu32_u;
|
||||||
|
/* deprecated defines */
|
||||||
|
#if !defined(LZO_SIZEOF_LZO_UINT)
|
||||||
|
# define LZO_SIZEOF_LZO_UINT LZO_SIZEOF_LZO_INT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LZO_CFG_COMPAT)
|
||||||
|
|
||||||
|
#define __LZOCONF_H 1
|
||||||
|
|
||||||
|
#if defined(LZO_ARCH_I086)
|
||||||
|
# define __LZO_i386 1
|
||||||
|
#elif defined(LZO_ARCH_I386)
|
||||||
|
# define __LZO_i386 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LZO_OS_DOS16)
|
||||||
|
# define __LZO_DOS 1
|
||||||
|
# define __LZO_DOS16 1
|
||||||
|
#elif defined(LZO_OS_DOS32)
|
||||||
|
# define __LZO_DOS 1
|
||||||
|
#elif defined(LZO_OS_WIN16)
|
||||||
|
# define __LZO_WIN 1
|
||||||
|
# define __LZO_WIN16 1
|
||||||
|
#elif defined(LZO_OS_WIN32)
|
||||||
|
# define __LZO_WIN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __LZO_CMODEL /*empty*/
|
||||||
|
#define __LZO_DMODEL /*empty*/
|
||||||
|
#define __LZO_ENTRY __LZO_CDECL
|
||||||
|
#define LZO_EXTERN_CDECL LZO_EXTERN
|
||||||
|
#define LZO_ALIGN LZO_PTR_ALIGN_UP
|
||||||
|
|
||||||
|
#define lzo_compress_asm_t lzo_compress_t
|
||||||
|
#define lzo_decompress_asm_t lzo_decompress_t
|
||||||
|
|
||||||
|
#endif /* LZO_CFG_COMPAT */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* already included */
|
||||||
|
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
3268
minilzo-2.10/lzodefs.h
Normal file
3268
minilzo-2.10/lzodefs.h
Normal file
File diff suppressed because it is too large
Load Diff
6365
minilzo-2.10/minilzo.c
Normal file
6365
minilzo-2.10/minilzo.c
Normal file
File diff suppressed because it is too large
Load Diff
106
minilzo-2.10/minilzo.h
Normal file
106
minilzo-2.10/minilzo.h
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
/* minilzo.h -- mini subset of the LZO real-time data compression library
|
||||||
|
|
||||||
|
This file is part of the LZO real-time data compression library.
|
||||||
|
|
||||||
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
The LZO library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The LZO library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with the LZO library; see the file COPYING.
|
||||||
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
Markus F.X.J. Oberhumer
|
||||||
|
<markus@oberhumer.com>
|
||||||
|
http://www.oberhumer.com/opensource/lzo/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NOTE:
|
||||||
|
* the full LZO package can be found at
|
||||||
|
* http://www.oberhumer.com/opensource/lzo/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __MINILZO_H_INCLUDED
|
||||||
|
#define __MINILZO_H_INCLUDED 1
|
||||||
|
|
||||||
|
#define MINILZO_VERSION 0x20a0 /* 2.10 */
|
||||||
|
|
||||||
|
#if defined(__LZOCONF_H_INCLUDED)
|
||||||
|
# error "you cannot use both LZO and miniLZO"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* internal Autoconf configuration file - only used when building miniLZO */
|
||||||
|
#ifdef MINILZO_HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifndef __LZODEFS_H_INCLUDED
|
||||||
|
#include "lzodefs.h"
|
||||||
|
#endif
|
||||||
|
#undef LZO_HAVE_CONFIG_H
|
||||||
|
#include "lzoconf.h"
|
||||||
|
|
||||||
|
#if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION)
|
||||||
|
# error "version mismatch in header files"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
//
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/* Memory required for the wrkmem parameter.
|
||||||
|
* When the required size is 0, you can also pass a NULL pointer.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS
|
||||||
|
#define LZO1X_1_MEM_COMPRESS ((lzo_uint32_t) (16384L * lzo_sizeof_dict_t))
|
||||||
|
#define LZO1X_MEM_DECOMPRESS (0)
|
||||||
|
|
||||||
|
|
||||||
|
/* compression */
|
||||||
|
LZO_EXTERN(int)
|
||||||
|
lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem );
|
||||||
|
|
||||||
|
/* decompression */
|
||||||
|
LZO_EXTERN(int)
|
||||||
|
lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem /* NOT USED */ );
|
||||||
|
|
||||||
|
/* safe decompression with overrun testing */
|
||||||
|
LZO_EXTERN(int)
|
||||||
|
lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem /* NOT USED */ );
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* already included */
|
||||||
|
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
@ -12,7 +12,7 @@ int GlobalConfig::LinkCount = 0;
|
|||||||
int GlobalConfig::net0Status = 1;
|
int GlobalConfig::net0Status = 1;
|
||||||
|
|
||||||
|
|
||||||
std::string GlobalConfig::Version = "3.2.4";
|
std::string GlobalConfig::Version = "3.2.5";
|
||||||
std::string GlobalConfig::MacAddr_G = "";
|
std::string GlobalConfig::MacAddr_G = "";
|
||||||
std::string GlobalConfig::MacAddr_G2 = "";
|
std::string GlobalConfig::MacAddr_G2 = "";
|
||||||
std::string GlobalConfig::IpAddr_G = "";
|
std::string GlobalConfig::IpAddr_G = "";
|
||||||
@ -25,6 +25,7 @@ int GlobalConfig::NetSignal = 0;
|
|||||||
int GlobalConfig::ServerPort = 0;
|
int GlobalConfig::ServerPort = 0;
|
||||||
int GlobalConfig::threadStatus = 1;
|
int GlobalConfig::threadStatus = 1;
|
||||||
|
|
||||||
|
extern map<string,compressWaveChannel> g_mapCompress;
|
||||||
|
|
||||||
TopicList GlobalConfig::Topic_G;
|
TopicList GlobalConfig::Topic_G;
|
||||||
ZigbeeInfo GlobalConfig::ZigbeeInfo_G;
|
ZigbeeInfo GlobalConfig::ZigbeeInfo_G;
|
||||||
@ -106,6 +107,13 @@ try{
|
|||||||
print_error("PlatFormInit exception happend.\n");
|
print_error("PlatFormInit exception happend.\n");
|
||||||
std::string errorinfo = "系统初始化异常";
|
std::string errorinfo = "系统初始化异常";
|
||||||
}
|
}
|
||||||
|
vec_t vecResult = sql_ctl->GetDataMultiLineOfOneColumn(T_SENSOR_INFO(TNAME)," zigbeeShortAddr ",NULL);
|
||||||
|
for (size_t i = 0; i < vecResult.size(); i++)
|
||||||
|
{
|
||||||
|
compressWaveChannel tempchannel;
|
||||||
|
g_mapCompress.insert(std::make_pair(vecResult[0],tempchannel));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlatformInit::TopicInit()
|
void PlatformInit::TopicInit()
|
||||||
|
@ -110,7 +110,7 @@ void CheckThread()
|
|||||||
GlobalConfig::net0Status = iStatus;
|
GlobalConfig::net0Status = iStatus;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (300 == time_check) {
|
if (7200 == time_check) {//2h
|
||||||
char buf[256] = {0};
|
char buf[256] = {0};
|
||||||
char buf2[256] = {0};
|
char buf2[256] = {0};
|
||||||
sprintf(buf, "{\"dataNodeGatewayNo\":\"%s\",\"cmd\":\"12\",\"status\":\"REQ\"}",
|
sprintf(buf, "{\"dataNodeGatewayNo\":\"%s\",\"cmd\":\"12\",\"status\":\"REQ\"}",
|
||||||
|
414
uart/SH_Uart.cpp
414
uart/SH_Uart.cpp
@ -22,6 +22,10 @@ namespace{
|
|||||||
char g_UartRecvBuf[GENERAL_BUF_SIZE];
|
char g_UartRecvBuf[GENERAL_BUF_SIZE];
|
||||||
int offSize = 0;
|
int offSize = 0;
|
||||||
pTestRecvCallBack pTestRecv ;
|
pTestRecvCallBack pTestRecv ;
|
||||||
|
std::vector<RecvData> g_VecWaveDataX;
|
||||||
|
std::vector<RecvData> g_VecWaveDataY;
|
||||||
|
std::vector<RecvData> g_VecWaveDataZ;
|
||||||
|
map<string,compressWaveChannel> g_mapCompress;
|
||||||
// namespace{
|
// namespace{
|
||||||
// PlatformInit *platform = PlatformInit::instance();
|
// PlatformInit *platform = PlatformInit::instance();
|
||||||
// LocalServer *wlServer = LocalServer::instance();
|
// LocalServer *wlServer = LocalServer::instance();
|
||||||
@ -94,7 +98,7 @@ int Uart::UartRecv(int fd, char srcshow,char* buffer)
|
|||||||
}
|
}
|
||||||
else if(ret > 0){
|
else if(ret > 0){
|
||||||
maxSize += ret;
|
maxSize += ret;
|
||||||
print_debug("0x9999===str_recv===,ret = %d offSize = %d,bUpdatePre = %d,bUpdateconfig = %d\n",ret,maxSize,bUpdatePre,bUpdateconfig);
|
// print_debug("0x9999===str_recv===,ret = %d offSize = %d,bUpdatePre = %d,bUpdateconfig = %d\n",ret,maxSize,bUpdatePre,bUpdateconfig);
|
||||||
// for(int i = 0; i < ret;i++){
|
// for(int i = 0; i < ret;i++){
|
||||||
// printf("[%02x]", buff[i]&0xff);
|
// printf("[%02x]", buff[i]&0xff);
|
||||||
// }
|
// }
|
||||||
@ -203,6 +207,9 @@ Uart::Uart():mUart(mIoSev),mStrand(mIoSev)
|
|||||||
bModifyAddr = false;
|
bModifyAddr = false;
|
||||||
bUpdatePre = false;
|
bUpdatePre = false;
|
||||||
bSendTimeStamp = false;
|
bSendTimeStamp = false;
|
||||||
|
m_waveCountX = 0;
|
||||||
|
m_waveCountY = 0;
|
||||||
|
m_waveCountZ = 0;
|
||||||
}
|
}
|
||||||
Uart::~Uart()
|
Uart::~Uart()
|
||||||
{
|
{
|
||||||
@ -486,7 +493,7 @@ int Uart::FindRecvPackage(int bytesRead, char* mUartRecvBuf,char* head)
|
|||||||
bSendTimeStamp = false;
|
bSendTimeStamp = false;
|
||||||
GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = NO_ENTER_TRANSMITTING_STATUS;
|
GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = NO_ENTER_TRANSMITTING_STATUS;
|
||||||
GlobalConfig::EnterZigBeeWaveTransmittingCnt_G = 0;
|
GlobalConfig::EnterZigBeeWaveTransmittingCnt_G = 0;
|
||||||
std::vector<RecvData>().swap(m_VecWaveData);
|
//std::vector<RecvData>().swap(m_VecWaveData);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +545,7 @@ int Uart::FindRecvPackage(int bytesRead, char* mUartRecvBuf,char* head)
|
|||||||
bSendTimeStamp = false;
|
bSendTimeStamp = false;
|
||||||
GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = NO_ENTER_TRANSMITTING_STATUS;
|
GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = NO_ENTER_TRANSMITTING_STATUS;
|
||||||
GlobalConfig::EnterZigBeeWaveTransmittingCnt_G = 0;
|
GlobalConfig::EnterZigBeeWaveTransmittingCnt_G = 0;
|
||||||
std::vector<RecvData>().swap(m_VecWaveData);
|
//std::vector<RecvData>().swap(m_VecWaveData);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mlastSize = 0;
|
mlastSize = 0;
|
||||||
@ -550,7 +557,7 @@ int Uart::FindRecvPackage(int bytesRead, char* mUartRecvBuf,char* head)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memcpy(RecvBuf,(char*)&UartRecvBuf[i],100);
|
memcpy(RecvBuf,(char*)&UartRecvBuf[i],100);
|
||||||
DealDataNodeWave(RecvBuf);
|
DealDataNodeWave(RecvBuf,command);
|
||||||
}else if(!bUpdate && !bUpdateconfig && (command == 1 || command == 2 || command == 6 || command == 7)){
|
}else if(!bUpdate && !bUpdateconfig && (command == 1 || command == 2 || command == 6 || command == 7)){
|
||||||
char RecvBuf[100] = {0x00};
|
char RecvBuf[100] = {0x00};
|
||||||
memcpy(RecvBuf,&UartRecvBuf[i],100);
|
memcpy(RecvBuf,&UartRecvBuf[i],100);
|
||||||
@ -1250,7 +1257,7 @@ void Uart::UpdateWirelessNode(unsigned short shortAdd)
|
|||||||
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
|
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
|
||||||
GlobalConfig::Zigbee_G.MyAddr = 0x8888;
|
GlobalConfig::Zigbee_G.MyAddr = 0x8888;
|
||||||
DataNodeUpdateFile = "";
|
DataNodeUpdateFile = "";
|
||||||
std::vector<RecvData>().swap(m_VecWaveData);
|
// std::vector<RecvData>().swap(m_VecWaveData);
|
||||||
// WriteShortAddr2Zigbee(shortAddr);
|
// WriteShortAddr2Zigbee(shortAddr);
|
||||||
// UpdateZigbeeInfoCtrl();
|
// UpdateZigbeeInfoCtrl();
|
||||||
GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = NO_ENTER_TRANSMITTING_STATUS;
|
GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = NO_ENTER_TRANSMITTING_STATUS;
|
||||||
@ -1290,7 +1297,7 @@ int Uart::UpdateConfig(unsigned char* pDestShortAddr)
|
|||||||
boost::this_thread::sleep(boost::posix_time::milliseconds(500));
|
boost::this_thread::sleep(boost::posix_time::milliseconds(500));
|
||||||
vec_t vecResult;
|
vec_t vecResult;
|
||||||
sprintf(selCon,"featureInterVal,waveInterVal,range,samplingRate,ACCSampleTime,startBrands,stopBrands,\
|
sprintf(selCon,"featureInterVal,waveInterVal,range,samplingRate,ACCSampleTime,startBrands,stopBrands,\
|
||||||
envelopeBandPass,faultFrequency,timeStamp,viff,ZigbeePower,ZigbeeRetry,MeasurementID");
|
envelopeBandPass,faultFrequency,timeStamp,viff,ZigbeePower,ZigbeeRetry,MeasurementID,NodeWaveSend");
|
||||||
vecResult = sql_ctl->GetDataSingleLine(T_SENSOR_INFO(TNAME),selCon,whereCon);
|
vecResult = sql_ctl->GetDataSingleLine(T_SENSOR_INFO(TNAME),selCon,whereCon);
|
||||||
print_info("vecResult size = %d\n",vecResult.size());
|
print_info("vecResult size = %d\n",vecResult.size());
|
||||||
if(vecResult.size() < 1){
|
if(vecResult.size() < 1){
|
||||||
@ -1343,11 +1350,12 @@ int Uart::UpdateConfig(unsigned char* pDestShortAddr)
|
|||||||
UpdateData[21] = BUILD_UINT2(x,y);
|
UpdateData[21] = BUILD_UINT2(x,y);
|
||||||
UpdateData[22] = atoi(vecResult[4].c_str()) & 0xFF;
|
UpdateData[22] = atoi(vecResult[4].c_str()) & 0xFF;
|
||||||
print_info("vecResult size = %s==%s==%s==%s\n",vecResult[5].c_str(),vecResult[6].c_str(),vecResult[7].c_str(),vecResult[8].c_str());
|
print_info("vecResult size = %s==%s==%s==%s\n",vecResult[5].c_str(),vecResult[6].c_str(),vecResult[7].c_str(),vecResult[8].c_str());
|
||||||
vector<string> vStart,vStop,vEnvelopeBandPass,vfaultFrequency;
|
vector<string> vStart,vStop,vEnvelopeBandPass,vfaultFrequency,vNodeWaveSend;
|
||||||
boost::split( vStart, vecResult[5], boost::is_any_of( "," ), boost::token_compress_on );
|
boost::split( vStart, vecResult[5], boost::is_any_of( "," ), boost::token_compress_on );
|
||||||
boost::split( vStop, vecResult[6], boost::is_any_of( "," ), boost::token_compress_on );
|
boost::split( vStop, vecResult[6], boost::is_any_of( "," ), boost::token_compress_on );
|
||||||
boost::split( vEnvelopeBandPass, vecResult[7], boost::is_any_of( "," ), boost::token_compress_on );
|
boost::split( vEnvelopeBandPass, vecResult[7], boost::is_any_of( "," ), boost::token_compress_on );
|
||||||
boost::split( vfaultFrequency, vecResult[8], boost::is_any_of( "," ), boost::token_compress_on );
|
boost::split( vfaultFrequency, vecResult[8], boost::is_any_of( "," ), boost::token_compress_on );
|
||||||
|
boost::split( vNodeWaveSend, vecResult[14], boost::is_any_of( "," ), boost::token_compress_on );
|
||||||
|
|
||||||
UpdateData[23] = UINT16_HIGH(atoi(vStart[0].c_str()));
|
UpdateData[23] = UINT16_HIGH(atoi(vStart[0].c_str()));
|
||||||
UpdateData[24] = UINT16_LOW(atoi(vStart[0].c_str()));
|
UpdateData[24] = UINT16_LOW(atoi(vStart[0].c_str()));
|
||||||
@ -1411,6 +1419,30 @@ int Uart::UpdateConfig(unsigned char* pDestShortAddr)
|
|||||||
UpdateData[66] = bytes[6];
|
UpdateData[66] = bytes[6];
|
||||||
UpdateData[67] = bytes[7];
|
UpdateData[67] = bytes[7];
|
||||||
}
|
}
|
||||||
|
if (vNodeWaveSend[0] == "0");
|
||||||
|
{
|
||||||
|
UpdateData[68] &= ~(1 << 0);
|
||||||
|
}
|
||||||
|
if (vNodeWaveSend[0] == "1");
|
||||||
|
{
|
||||||
|
UpdateData[68] |= (1 << 0);
|
||||||
|
}
|
||||||
|
if (vNodeWaveSend[1] == "0");
|
||||||
|
{
|
||||||
|
UpdateData[68] &= ~(1 << 1);
|
||||||
|
}
|
||||||
|
if (vNodeWaveSend[1] == "1");
|
||||||
|
{
|
||||||
|
UpdateData[68] |= (1 << 1);
|
||||||
|
}
|
||||||
|
if (vNodeWaveSend[2] == "0");
|
||||||
|
{
|
||||||
|
UpdateData[68] &= ~(1 << 2);
|
||||||
|
}
|
||||||
|
if (vNodeWaveSend[2] == "1");
|
||||||
|
{
|
||||||
|
UpdateData[68] |= (1 << 2);
|
||||||
|
}
|
||||||
|
|
||||||
free(bytes);
|
free(bytes);
|
||||||
unsigned char tmp1 = 0x00;
|
unsigned char tmp1 = 0x00;
|
||||||
@ -1597,6 +1629,7 @@ void Uart::DealDataNodeName(const char* pData)
|
|||||||
char whereCon[64] = { 0 };
|
char whereCon[64] = { 0 };
|
||||||
char uplCon[200]={0x00};
|
char uplCon[200]={0x00};
|
||||||
int iRet = -1;
|
int iRet = -1;
|
||||||
|
char nodeWaveSend[10]={0x00};
|
||||||
|
|
||||||
UpdateWirelessNodeTime((unsigned char*)shortAdd,1);
|
UpdateWirelessNodeTime((unsigned char*)shortAdd,1);
|
||||||
|
|
||||||
@ -1606,6 +1639,7 @@ void Uart::DealDataNodeName(const char* pData)
|
|||||||
char MeasurementID[100]={0x00};
|
char MeasurementID[100]={0x00};
|
||||||
sprintf(MeasurementID, "%02x%02x%02x%02x%02x%02x%02x%02x", pData[71], pData[72], pData[73], pData[74],
|
sprintf(MeasurementID, "%02x%02x%02x%02x%02x%02x%02x%02x", pData[71], pData[72], pData[73], pData[74],
|
||||||
pData[75], pData[76], pData[77],pData[78]);
|
pData[75], pData[76], pData[77],pData[78]);
|
||||||
|
sprintf(nodeWaveSend,"%d,%d,%d",GET_BIT(pData[79], 0 ),GET_BIT(pData[79], 1 ),GET_BIT(pData[79], 2 ));
|
||||||
char gbkNodeName[128]={0x00};
|
char gbkNodeName[128]={0x00};
|
||||||
sprintf(whereCon, "zigbeeShortAddr='%s'", szShortAdd);
|
sprintf(whereCon, "zigbeeShortAddr='%s'", szShortAdd);
|
||||||
print_info("whereCon = %s\n",whereCon);
|
print_info("whereCon = %s\n",whereCon);
|
||||||
@ -1641,7 +1675,7 @@ void Uart::DealDataNodeName(const char* pData)
|
|||||||
string utfNodeName = GBKToUTF8(gbkNodeName);
|
string utfNodeName = GBKToUTF8(gbkNodeName);
|
||||||
print_info("NodeName = %s\n",NodeName);
|
print_info("NodeName = %s\n",NodeName);
|
||||||
print_info("whereCon = %s\n",whereCon);
|
print_info("whereCon = %s\n",whereCon);
|
||||||
sprintf(uplCon,"dataNodeName = '%s' , MeasurementID = '%s'",gbkNodeName,MeasurementID);
|
sprintf(uplCon,"dataNodeName = '%s' , MeasurementID = '%s',NodeWaveSend = '%s'",gbkNodeName,MeasurementID,nodeWaveSend);
|
||||||
iRet = sql_ctl->UpdateTableData(T_SENSOR_INFO(TNAME),uplCon,whereCon,0);
|
iRet = sql_ctl->UpdateTableData(T_SENSOR_INFO(TNAME),uplCon,whereCon,0);
|
||||||
string strData = sql_ctl->GetNodeConfigureInfor(whereCon);
|
string strData = sql_ctl->GetNodeConfigureInfor(whereCon);
|
||||||
iRet = data_publish(strData.c_str(), GlobalConfig::Topic_G.mPubConfig.c_str());
|
iRet = data_publish(strData.c_str(), GlobalConfig::Topic_G.mPubConfig.c_str());
|
||||||
@ -1900,7 +1934,7 @@ void Uart::DealDataNodeInfo(const char *pData)
|
|||||||
'%d','%d','%d','%s','%d','%s',\
|
'%d','%d','%d','%s','%d','%s',\
|
||||||
'%s','%u','%d','%d','%s','%d', '%s', '%s',\
|
'%s','%u','%d','%d','%s','%d', '%s', '%s',\
|
||||||
'%s','%d','%s','%s','%s',\
|
'%s','%d','%s','%s','%s',\
|
||||||
'%d','%d','%d','%d','%s','%s', '%d', '0,%d','1','0,0','',''",
|
'%d','%d','%d','%d','%s','%s', '%d', '0,%d','1','0,0','','',''",
|
||||||
dataNodeInfo.ZigbeeLongAddr.c_str(), " ", dataNodeInfo.InitFlag, dataNodeInfo.AccFlag, dataNodeInfo.ZigbeeFlag, dataNodeInfo.TemTopFlag, dataNodeInfo.TemBotFlag,dataNodeInfo.EquipSta,\
|
dataNodeInfo.ZigbeeLongAddr.c_str(), " ", dataNodeInfo.InitFlag, dataNodeInfo.AccFlag, dataNodeInfo.ZigbeeFlag, dataNodeInfo.TemTopFlag, dataNodeInfo.TemBotFlag,dataNodeInfo.EquipSta,\
|
||||||
dataNodeInfo.HardVersion.c_str(), dataNodeInfo.SoftVersion.c_str(), dataNodeInfo.BpNo.c_str(), dataNodeInfo.SerialNo.c_str(), dataNodeInfo.FirstPowerTime.c_str(), dataNodeInfo.WakeupTime,\
|
dataNodeInfo.HardVersion.c_str(), dataNodeInfo.SoftVersion.c_str(), dataNodeInfo.BpNo.c_str(), dataNodeInfo.SerialNo.c_str(), dataNodeInfo.FirstPowerTime.c_str(), dataNodeInfo.WakeupTime,\
|
||||||
dataNodeInfo.StaticTime,dataNodeInfo.WaveTime,dataNodeInfo.BateryV,dataNodeInfo.ProductNo.c_str(),dataNodeInfo.ConfigFlag, dataNodeInfo.StartBrands.c_str(), \
|
dataNodeInfo.StaticTime,dataNodeInfo.WaveTime,dataNodeInfo.BateryV,dataNodeInfo.ProductNo.c_str(),dataNodeInfo.ConfigFlag, dataNodeInfo.StartBrands.c_str(), \
|
||||||
@ -1972,7 +2006,12 @@ void Uart::DealDataNodeInfo(const char *pData)
|
|||||||
dataNodeInfo.SoftVersion.c_str(), dataNodeInfo.StartBrands.c_str(), dataNodeInfo.StopBrands.c_str(), dataNodeInfo.TemBotFlag, dataNodeInfo.TemTopFlag, dataNodeInfo.WaveInterVal,\
|
dataNodeInfo.SoftVersion.c_str(), dataNodeInfo.StartBrands.c_str(), dataNodeInfo.StopBrands.c_str(), dataNodeInfo.TemBotFlag, dataNodeInfo.TemTopFlag, dataNodeInfo.WaveInterVal,\
|
||||||
dataNodeInfo.ZigbeeChannel, dataNodeInfo.ZigbeeDesAddr.c_str(), dataNodeInfo.ZigbeeFlag, dataNodeInfo.ZigbeeLongAddr.c_str(), dataNodeInfo.ZigbeePanId.c_str(), dataNodeInfo.ZigbeeShortAddr.c_str(), dataNodeInfo.ConfigDate.c_str(), dataNodeInfo.VIntegralFilterFrequency, dataNodeInfo.RSSI);
|
dataNodeInfo.ZigbeeChannel, dataNodeInfo.ZigbeeDesAddr.c_str(), dataNodeInfo.ZigbeeFlag, dataNodeInfo.ZigbeeLongAddr.c_str(), dataNodeInfo.ZigbeePanId.c_str(), dataNodeInfo.ZigbeeShortAddr.c_str(), dataNodeInfo.ConfigDate.c_str(), dataNodeInfo.VIntegralFilterFrequency, dataNodeInfo.RSSI);
|
||||||
|
|
||||||
|
if (g_mapCompress.find(dataNodeInfo.ZigbeeShortAddr) == g_mapCompress.end()){
|
||||||
|
|
||||||
|
compressWaveChannel tempchannel;
|
||||||
|
g_mapCompress.insert(std::make_pair(dataNodeInfo.ZigbeeShortAddr,tempchannel));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Uart::RecordBattery(string & strLongAddr,DataRecvStatic& dataStatic,string& nowTimetamp)
|
void Uart::RecordBattery(string & strLongAddr,DataRecvStatic& dataStatic,string& nowTimetamp)
|
||||||
@ -2065,7 +2104,14 @@ void Uart::DealDataNodeFeature(const char *pData, int flag)
|
|||||||
GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = ENTER_TRANSMITTING_STATUS;
|
GlobalConfig::EnterZigBeeWaveTransmittingFlag_G = ENTER_TRANSMITTING_STATUS;
|
||||||
GlobalConfig::EnterZigBeeWaveTransmittingCnt_G = 0;
|
GlobalConfig::EnterZigBeeWaveTransmittingCnt_G = 0;
|
||||||
}
|
}
|
||||||
|
unsigned char compressChannel = pRecvData->Data[34];
|
||||||
|
compressWaveChannel tempchannel;
|
||||||
|
tempchannel.compressChannelX = GET_BIT(compressChannel ,1);
|
||||||
|
tempchannel.compressChannelY = GET_BIT(compressChannel ,2);
|
||||||
|
tempchannel.compressChannelZ = GET_BIT(compressChannel ,4);
|
||||||
|
g_mapCompress[strShortAddr] = tempchannel;
|
||||||
|
|
||||||
|
print_info("compress X = %d,Y = %d,Z = %d \n",tempchannel.compressChannelX,tempchannel.compressChannelY,tempchannel.compressChannelZ);
|
||||||
}else{
|
}else{
|
||||||
memset(whereCon,0x00,sizeof(whereCon));
|
memset(whereCon,0x00,sizeof(whereCon));
|
||||||
memset(updateSql,0x00,sizeof(updateSql));
|
memset(updateSql,0x00,sizeof(updateSql));
|
||||||
@ -2182,6 +2228,8 @@ void Uart::DealDataNodeFeature(const char *pData, int flag)
|
|||||||
|
|
||||||
RecordBattery(strLongAddr,dataStatic,nowTimetamp);
|
RecordBattery(strLongAddr,dataStatic,nowTimetamp);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char szTableName[50]={0x00},szTableNameStatic[50]={0x00},szTableNameData[50]={0x00};
|
char szTableName[50]={0x00},szTableNameStatic[50]={0x00},szTableNameData[50]={0x00};
|
||||||
sprintf(szTableName,"t_dataStatic_%s",strLongAddr.c_str());
|
sprintf(szTableName,"t_dataStatic_%s",strLongAddr.c_str());
|
||||||
memcpy(szTableNameStatic,szTableName,sizeof(szTableNameStatic));
|
memcpy(szTableNameStatic,szTableName,sizeof(szTableNameStatic));
|
||||||
@ -3470,11 +3518,22 @@ void Uart::DealDataNodeFeature(const char *pData, int flag)
|
|||||||
LOG_INFO("DealDataNodeFeature end %02x%02x\n",pRecvData->ShortAddr[0], pRecvData->ShortAddr[1]);
|
LOG_INFO("DealDataNodeFeature end %02x%02x\n",pRecvData->ShortAddr[0], pRecvData->ShortAddr[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Uart::DealDataNodeWave(const char *pData)
|
void Uart::DealDataNodeWave(const char *pData,int comand)
|
||||||
{
|
{
|
||||||
//print_info("recv wave\n");
|
//print_info("recv wave\n");
|
||||||
RecvData * pRecvData = (RecvData *)pData;
|
RecvData * pRecvData = (RecvData *)pData;
|
||||||
m_VecWaveData.push_back(*pRecvData);
|
//m_VecWaveData.push_back(*pRecvData);
|
||||||
|
if (comand == 3)
|
||||||
|
{
|
||||||
|
g_VecWaveDataX[m_waveCountX] = *pRecvData;
|
||||||
|
m_waveCountX++;
|
||||||
|
}else if(comand == 4){
|
||||||
|
g_VecWaveDataY[m_waveCountY] = *pRecvData;
|
||||||
|
m_waveCountY++;
|
||||||
|
}else if(comand == 5){
|
||||||
|
g_VecWaveDataZ[m_waveCountZ] = *pRecvData;
|
||||||
|
m_waveCountZ++;
|
||||||
|
}
|
||||||
//print_blue("wave data size is(m_VecWaveData.size) : %d\n",m_VecWaveData.size());
|
//print_blue("wave data size is(m_VecWaveData.size) : %d\n",m_VecWaveData.size());
|
||||||
char localtimestamp[32] = { 0 };
|
char localtimestamp[32] = { 0 };
|
||||||
GetTimeNet(localtimestamp, 1);
|
GetTimeNet(localtimestamp, 1);
|
||||||
@ -3529,7 +3588,124 @@ void Uart::DealWaveThread() //连续三秒没有原始数据,则处理缓存
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
std::vector<float> Uart::DealData(int iChannel,float coe,int sampleRate,int ACCSampleTime,string strProduct)
|
||||||
|
{
|
||||||
|
|
||||||
|
int waveCount = 0 ;
|
||||||
|
unsigned char data[1024*100]={0x00};
|
||||||
|
unsigned char outdata[1024*100]={0x00};
|
||||||
|
unsigned char dealdata[1024*100]={0x00};
|
||||||
|
long unsigned int new_len = 0,deallen = 0;
|
||||||
|
int compress = 0;
|
||||||
|
long iTemp = 0;
|
||||||
|
char buf[8] = {0x00};
|
||||||
|
std::vector<float> vecData;
|
||||||
|
print_info("data1 = %02x\n",g_VecWaveDataX[0].Data[0]);
|
||||||
|
print_info("data2 = %02x\n",g_VecWaveDataY[0].Data[0]);
|
||||||
|
print_info("data3 = %02x\n",g_VecWaveDataZ[0].Data[0]);
|
||||||
|
size_t j = 0;
|
||||||
|
if (iChannel == 3)
|
||||||
|
{
|
||||||
|
waveCount = m_waveCountX;
|
||||||
|
for (; j < waveCount; j++)
|
||||||
|
{
|
||||||
|
RecvData recvData = g_VecWaveDataX[j];
|
||||||
|
memcpy(data + j * 92 ,recvData.Data,92);
|
||||||
|
}
|
||||||
|
memset(buf,0x00,sizeof(buf));
|
||||||
|
sprintf(buf, "%02x%02x", g_VecWaveDataX[0].ShortAddr[0], g_VecWaveDataX[0].ShortAddr[1]);
|
||||||
|
std::string strShortAddr = std::string(buf);
|
||||||
|
compress = g_mapCompress[strShortAddr].compressChannelX;
|
||||||
|
}
|
||||||
|
if (iChannel == 4)
|
||||||
|
{
|
||||||
|
waveCount = m_waveCountY;
|
||||||
|
for (; j < waveCount; j++)
|
||||||
|
{
|
||||||
|
RecvData recvData = g_VecWaveDataY[j];
|
||||||
|
memcpy(data + j * 92 ,recvData.Data,92);
|
||||||
|
}
|
||||||
|
memset(buf,0x00,sizeof(buf));
|
||||||
|
sprintf(buf, "%02x%02x", g_VecWaveDataY[0].ShortAddr[0], g_VecWaveDataY[0].ShortAddr[1]);
|
||||||
|
std::string strShortAddr = std::string(buf);
|
||||||
|
compress = g_mapCompress[strShortAddr].compressChannelY;
|
||||||
|
}
|
||||||
|
if (iChannel == 5)
|
||||||
|
{
|
||||||
|
waveCount = m_waveCountZ;
|
||||||
|
for (; j < waveCount; j++)
|
||||||
|
{
|
||||||
|
RecvData recvData = g_VecWaveDataZ[j];
|
||||||
|
memcpy(data + j * 92 ,recvData.Data,92);
|
||||||
|
}
|
||||||
|
memset(buf,0x00,sizeof(buf));
|
||||||
|
sprintf(buf, "%02x%02x", g_VecWaveDataZ[0].ShortAddr[0], g_VecWaveDataZ[0].ShortAddr[1]);
|
||||||
|
std::string strShortAddr = std::string(buf);
|
||||||
|
compress = g_mapCompress[strShortAddr].compressChannelZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print_info("len = %d,data = %02x\n",j,data[0]);
|
||||||
|
if(compress){
|
||||||
|
print_info("iChannel = %d,compress = %d\n",iChannel,compress);
|
||||||
|
int r = lzo1x_decompress(data,j * 92,outdata,&new_len,NULL);
|
||||||
|
if (r == LZO_E_OK ){
|
||||||
|
printf("decompressed %lu bytes back into %lu bytes\n",
|
||||||
|
(unsigned long) j * 92, (unsigned long) new_len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* this should NEVER happen */
|
||||||
|
printf("internal error - decompression failed: %d\n", r);
|
||||||
|
}
|
||||||
|
memcpy(dealdata,outdata,new_len);
|
||||||
|
deallen = new_len;
|
||||||
|
}else{
|
||||||
|
memcpy(dealdata,data,j * 92);
|
||||||
|
deallen = j * 92;
|
||||||
|
}
|
||||||
|
print_info("len = %d,dealdata = %02x\n",deallen,dealdata[0]);
|
||||||
|
for (int i = 0; i < deallen; i++) {
|
||||||
|
float fTemp = 0.0;
|
||||||
|
memset(buf, 0, 8);
|
||||||
|
sprintf(buf, "%02x%02x", dealdata[2*i+1],dealdata[i*2]);
|
||||||
|
iTemp = strtol(buf, NULL, 16);
|
||||||
|
if (iTemp < 0x8000) {
|
||||||
|
fTemp = iTemp * coe * 9.8; //convert to m/s2
|
||||||
|
} else {
|
||||||
|
fTemp = (((~iTemp)&0xffff) + 1) * - coe * 9.8; //convert to m/s2
|
||||||
|
}
|
||||||
|
vecData.push_back(fTemp);
|
||||||
|
if(strProduct == "01"){
|
||||||
|
//print_blue("vecData.size() = %d,sampleRate * ACCSampleTime = %d,iChannel = %d\n",vecData.size(),sampleRate * ACCSampleTime,iChannel);
|
||||||
|
if(vecData.size() == sampleRate * ACCSampleTime && iChannel == 3 ){//过滤数据包结尾空数据
|
||||||
|
print_blue("%d vecData.size() == %d,sampleRate * ACCSampleTime = %d\n",iChannel,vecData.size(),sampleRate * ACCSampleTime);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(vecData.size() == sampleRate * ACCSampleTime && iChannel == 4 ){//过滤数据包结尾空数据
|
||||||
|
print_blue("%d vecData.size() == %d,sampleRate * ACCSampleTime = %d\n",iChannel,vecData.size(),sampleRate * ACCSampleTime);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(vecData.size() == sampleRate * ACCSampleTime && iChannel == 5 ){//过滤数据包结尾空数据
|
||||||
|
print_blue("%d vecData.size() == %d,sampleRate * ACCSampleTime = %d\n",iChannel,vecData.size(),sampleRate * ACCSampleTime);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}else if(strProduct == "02"){
|
||||||
|
if(vecData.size() == 8192 && iChannel == 3 ){//过滤数据包结尾空数据
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(vecData.size() == 8192 && iChannel == 4 ){//过滤数据包结尾空数据
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(vecData.size() == sampleRate * ACCSampleTime && iChannel == 5 ){//过滤数据包结尾空数据
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return vecData;
|
||||||
|
}
|
||||||
void Uart::DealWave()
|
void Uart::DealWave()
|
||||||
{
|
{
|
||||||
//LOG_DEBUG("begin deal Wave data !\n");
|
//LOG_DEBUG("begin deal Wave data !\n");
|
||||||
@ -3539,38 +3715,27 @@ void Uart::DealWave()
|
|||||||
std::string strLongAddr = "";
|
std::string strLongAddr = "";
|
||||||
std::string strMeasurementID= "";
|
std::string strMeasurementID= "";
|
||||||
std::string strFileName = "";
|
std::string strFileName = "";
|
||||||
|
std::string strProduct = "";
|
||||||
int iChannel = 0;
|
int iChannel = 0;
|
||||||
int iChannelTemp = 0;
|
int iChannelTemp = 0;
|
||||||
long iTemp = 0;
|
|
||||||
std::vector<float> vecData;
|
std::vector<float> vecData;
|
||||||
char buf[8];
|
|
||||||
RecvData recvTemp;
|
RecvData recvTemp;
|
||||||
|
if (m_waveTrans) { //对每个传感器的每个通道进行遍历然后处理数据,例如:传感器1x轴的数据处理完后,再去处理y轴的。传感器1的所有数据处理完后,再处理传感器2的
|
||||||
//LOG_INFO("all wave data size is(m_VecWaveData.size) : %d \n",\
|
LOG_INFO("all wave data size is(m_waveCount) : %d \n",\
|
||||||
m_VecWaveData.size());
|
m_waveCountX);
|
||||||
while (m_VecWaveData.size() > 0) { //对每个传感器的每个通道进行遍历然后处理数据,例如:传感器1x轴的数据处理完后,再去处理y轴的。传感器1的所有数据处理完后,再处理传感器2的
|
print_blue("wave data size is(m_waveCount.size) : %d\n",m_waveCountX);
|
||||||
std::vector<RecvData>::iterator iter = m_VecWaveData.begin();
|
|
||||||
recvTemp = *iter;
|
|
||||||
memset(buf, 0, 8);
|
|
||||||
sprintf(buf, "%02x%02x", recvTemp.ShortAddr[0], recvTemp.ShortAddr[1]);
|
|
||||||
strShortAddr = std::string(buf);
|
|
||||||
|
|
||||||
memset(buf, 0, 8);
|
|
||||||
sprintf(buf, "%02d", recvTemp.Type&0xFF);
|
|
||||||
iChannel = atoi(buf);
|
|
||||||
|
|
||||||
char getLongAddr_sql[32] = { 0 };
|
char getLongAddr_sql[32] = { 0 };
|
||||||
sprintf(getLongAddr_sql, "zigbeeShortAddr='%s'", strShortAddr.c_str());
|
sprintf(getLongAddr_sql, "zigbeeShortAddr='%s'", m_strDestShortAddr.c_str());
|
||||||
//strLongAddr = sql_ctl->GetData(T_SENSOR_INFO(TNAME), T_SENSOR_INFO(ZIGBEELONGADDR), getLongAddr_sql);
|
|
||||||
vec_t res = sql_ctl->GetDataSingleLine(T_SENSOR_INFO(TNAME)," * ",getLongAddr_sql);
|
vec_t res = sql_ctl->GetDataSingleLine(T_SENSOR_INFO(TNAME)," * ",getLongAddr_sql);
|
||||||
strLongAddr = res[0];
|
strLongAddr = res[0];
|
||||||
strMeasurementID = res[44];
|
strMeasurementID = res[44];
|
||||||
//print_info("3.1.2.3--->strLongAddr : %s\n", strLongAddr.c_str());
|
|
||||||
if ( 0 == strLongAddr.length() ) {
|
if ( 0 == strLongAddr.length() ) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ran = "";
|
std::string ran = "";
|
||||||
int n = 0;
|
int n = 0;
|
||||||
int range = 0;
|
int range = 0;
|
||||||
@ -3583,13 +3748,61 @@ void Uart::DealWave()
|
|||||||
ran = res[25];
|
ran = res[25];
|
||||||
sampleRate = atoi(res[23].c_str());
|
sampleRate = atoi(res[23].c_str());
|
||||||
ACCSampleTime = atoi(res[36].c_str());
|
ACCSampleTime = atoi(res[36].c_str());
|
||||||
// print_info("@@@@@@@@@@@@@@@@@@@@@@ran=%s\n",ran.c_str());
|
strProduct = res[17];
|
||||||
memset(getrange, 0, 32);
|
memset(getrange, 0, 32);
|
||||||
sprintf(getrange, "%s", ran.c_str());
|
sprintf(getrange, "%s", ran.c_str());
|
||||||
n = (int)strtol(getrange, NULL, 32);
|
n = (int)strtol(getrange, NULL, 32);
|
||||||
// print_light_purple("!!!!!!!!!!!!!n=%d\n",n);
|
if (m_waveCountX > 0)
|
||||||
if(res[17] == "01"){
|
{
|
||||||
switch (n)
|
coe = Calcoe(n,3,strProduct,range);
|
||||||
|
vecData = DealData(3,coe,sampleRate,ACCSampleTime,strProduct);
|
||||||
|
WriteDatFile(sampleRate, strMeasurementID, 3,vecData);
|
||||||
|
}
|
||||||
|
if (m_waveCountY > 0)
|
||||||
|
{
|
||||||
|
coe = Calcoe(n,4,strProduct,range);
|
||||||
|
vecData = DealData(4,coe,sampleRate,ACCSampleTime,strProduct);
|
||||||
|
WriteDatFile(sampleRate, strMeasurementID, 4,vecData);
|
||||||
|
}
|
||||||
|
if (m_waveCountZ > 0)
|
||||||
|
{
|
||||||
|
coe = Calcoe(n,5,strProduct,range);
|
||||||
|
vecData = DealData(5,coe,sampleRate,ACCSampleTime,strProduct);
|
||||||
|
WriteDatFile(sampleRate, strMeasurementID, 5,vecData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if (strLongAddr != "")
|
||||||
|
{
|
||||||
|
char whereCon[1024] = {0x00};
|
||||||
|
char updateSql[1024] = {0x00};
|
||||||
|
sprintf(whereCon, "dataNodeNo='%s'", strLongAddr.c_str());
|
||||||
|
sprintf(updateSql, "WaveTime = WaveTime + 1");
|
||||||
|
sql_ctl->UpdateTableData(T_SENSOR_INFO(TNAME), updateSql, whereCon);
|
||||||
|
m_waveCountX = 0;
|
||||||
|
m_waveCountY = 0;
|
||||||
|
m_waveCountZ = 0;
|
||||||
|
g_VecWaveDataX.clear();
|
||||||
|
g_VecWaveDataY.clear();
|
||||||
|
g_VecWaveDataZ.clear();
|
||||||
|
m_waveTrans = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//string strData = sql_ctl->GetNodeConfigureInfor(whereCon);
|
||||||
|
//data_publish(strData.c_str(), GlobalConfig::Topic_G.mPubConfig.c_str());
|
||||||
|
// memset(buf, 0, 8);
|
||||||
|
// sprintf(buf, "%02x%02x", recvTemp.ShortAddr[0], recvTemp.ShortAddr[1]);
|
||||||
|
// std::string strShortAddr = std::string(buf);
|
||||||
|
|
||||||
|
}
|
||||||
|
float Uart::Calcoe(int ran,int iChannel,string& product,int range)
|
||||||
|
{
|
||||||
|
float coe = 0.0;
|
||||||
|
if(product== "01"){
|
||||||
|
switch (ran)
|
||||||
{
|
{
|
||||||
case 0:{
|
case 0:{
|
||||||
range = 8;
|
range = 8;
|
||||||
@ -3612,89 +3825,24 @@ void Uart::DealWave()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else if(res[17] == "02"){
|
}else if(product == "02"){
|
||||||
if(iChannel == 3 || iChannel == 4){
|
if(iChannel == 3 || iChannel == 4){
|
||||||
coe = 0.00048828125;
|
coe = 0.00048828125;
|
||||||
}
|
}
|
||||||
if(iChannel == 5){
|
if(iChannel == 5){
|
||||||
if(res[8] == "0.1"){
|
/*if(res[8] == "0.1"){
|
||||||
coe = 0.0034521484375;//0.03265968810083316;
|
coe = 0.0034521484375;//0.03265968810083316;
|
||||||
}else{
|
}else*/
|
||||||
|
{
|
||||||
coe = 0.00172607421875;
|
coe = 0.00172607421875;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//print_blue("##############range = %d,%f\n",range,coe);
|
return coe;
|
||||||
for(; iter != m_VecWaveData.end();)
|
}
|
||||||
{
|
void Uart::WriteDatFile(int sampleRate,string& strMeasurementID,int iChannel,std::vector<float>& vecData)
|
||||||
recvTemp = *iter;
|
{
|
||||||
memset(buf, 0, 8);
|
std::string strFileName = "";
|
||||||
sprintf(buf, "%02x%02x", recvTemp.ShortAddr[0], recvTemp.ShortAddr[1]);
|
|
||||||
strShortAddrTemp = std::string(buf);
|
|
||||||
|
|
||||||
memset(buf, 0, 8);
|
|
||||||
sprintf(buf, "%02d", recvTemp.Type & 0xFF);
|
|
||||||
iChannelTemp = atoi(buf);
|
|
||||||
|
|
||||||
if( 0 == strShortAddr.compare(strShortAddrTemp) && (iChannel == iChannelTemp) ) {
|
|
||||||
float fTemp;
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 46; i++) {
|
|
||||||
memset(buf, 0, 8);
|
|
||||||
sprintf(buf, "%02x%02x", recvTemp.Data[2*i+1],recvTemp.Data[i*2]);
|
|
||||||
iTemp = strtol(buf, NULL, 16);
|
|
||||||
if (iTemp < 0x8000) {
|
|
||||||
fTemp = iTemp * coe * 9.8; //convert to m/s2
|
|
||||||
} else {
|
|
||||||
fTemp = (((~iTemp)&0xffff) + 1) * - coe * 9.8; //convert to m/s2
|
|
||||||
}
|
|
||||||
// print_blue("wave data is %u,%f,%f\n",iTemp,fTemp, coe);
|
|
||||||
vecData.push_back(fTemp);
|
|
||||||
if(res[17] == "01"){
|
|
||||||
//print_blue("vecData.size() = %d,sampleRate * ACCSampleTime = %d,iChannel = %d\n",vecData.size(),sampleRate * ACCSampleTime,iChannel);
|
|
||||||
if(vecData.size() >= sampleRate * ACCSampleTime && iChannel == 3 ){//过滤数据包结尾空数据
|
|
||||||
print_blue("%d vecData.size() == %d,sampleRate * ACCSampleTime = %d\n",iChannel,vecData.size(),sampleRate * ACCSampleTime);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(vecData.size() >= sampleRate * ACCSampleTime && iChannel == 4 ){//过滤数据包结尾空数据
|
|
||||||
print_blue("%d vecData.size() == %d,sampleRate * ACCSampleTime = %d\n",iChannel,vecData.size(),sampleRate * ACCSampleTime);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(vecData.size() >= sampleRate * ACCSampleTime && iChannel == 5 ){//过滤数据包结尾空数据
|
|
||||||
print_blue("%d vecData.size() == %d,sampleRate * ACCSampleTime = %d\n",iChannel,vecData.size(),sampleRate * ACCSampleTime);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}else if(res[17] == "02"){
|
|
||||||
if(vecData.size() >= 8192 && iChannel == 3 ){//过滤数据包结尾空数据
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(vecData.size() >= 8192 && iChannel == 4 ){//过滤数据包结尾空数据
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(vecData.size() >= sampleRate * ACCSampleTime && iChannel == 5 ){//过滤数据包结尾空数据
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
iter = m_VecWaveData.erase(iter);
|
|
||||||
//print_blue("m_VecWaveData.size() == %d,vecData = %d\n",m_VecWaveData.size(),vecData.size());
|
|
||||||
} else {
|
|
||||||
iter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*char getLongAddr_sql[32] = { 0 };
|
|
||||||
sprintf(getLongAddr_sql, "zigbeeShortAddr='%s'", strShortAddr.c_str());
|
|
||||||
strLongAddr = sql_ctl->GetData(T_SENSOR_INFO(TNAME), T_SENSOR_INFO(ZIGBEELONGADDR), getLongAddr_sql);
|
|
||||||
|
|
||||||
print_info("strLongAddr : %s\n", strLongAddr.c_str());*/
|
|
||||||
if ( 0 == strLongAddr.length() ) {
|
|
||||||
sleep(1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
char localtimestamp[32] = { 0 };
|
char localtimestamp[32] = { 0 };
|
||||||
GetTimeNet(localtimestamp, 1);
|
GetTimeNet(localtimestamp, 1);
|
||||||
std::string nowTimetamp = std::string(localtimestamp);
|
std::string nowTimetamp = std::string(localtimestamp);
|
||||||
@ -3719,7 +3867,6 @@ void Uart::DealWave()
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (access(strFileName.c_str(), 0) > 0) { //如果存在原始数据删除原来的,只保留一份
|
if (access(strFileName.c_str(), 0) > 0) { //如果存在原始数据删除原来的,只保留一份
|
||||||
std::string strCmd = "rm " + strFileName;
|
std::string strCmd = "rm " + strFileName;
|
||||||
system(strCmd.c_str());
|
system(strCmd.c_str());
|
||||||
@ -3765,35 +3912,6 @@ void Uart::DealWave()
|
|||||||
Json::FastWriter WaveValue;
|
Json::FastWriter WaveValue;
|
||||||
std::string WaveData = WaveValue.write(valWaveData);
|
std::string WaveData = WaveValue.write(valWaveData);
|
||||||
|
|
||||||
if(res[17] == "01"){
|
|
||||||
//print_blue("vecData.size() = %d,sampleRate * ACCSampleTime = %d,iChannel = %d\n",vecData.size(),sampleRate * ACCSampleTime,iChannel);
|
|
||||||
if(vecData.size() != sampleRate * ACCSampleTime && iChannel == 3 ){//过滤数据包结尾空数据
|
|
||||||
print_blue("%d vecData.size() == %d,sampleRate * ACCSampleTime = %d\n",iChannel,vecData.size(),sampleRate * ACCSampleTime);
|
|
||||||
std::vector<float>().swap(vecData);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(vecData.size() != sampleRate * ACCSampleTime && iChannel == 4 ){//过滤数据包结尾空数据
|
|
||||||
print_blue("%d vecData.size() == %d,sampleRate * ACCSampleTime = %d\n",iChannel,vecData.size(),sampleRate * ACCSampleTime);
|
|
||||||
std::vector<float>().swap(vecData);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(vecData.size() != sampleRate * ACCSampleTime && iChannel == 5 ){//过滤数据包结尾空数据
|
|
||||||
print_blue("%d vecData.size() == %d,sampleRate * ACCSampleTime = %d\n",iChannel,vecData.size(),sampleRate * ACCSampleTime);
|
|
||||||
std::vector<float>().swap(vecData);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}else if(res[17] == "02"){
|
|
||||||
if(vecData.size() != 8192 && iChannel == 3 ){//过滤数据包结尾空数据
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(vecData.size() != 8192 && iChannel == 4 ){//过滤数据包结尾空数据
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(vecData.size() != sampleRate * ACCSampleTime && iChannel == 5 ){//过滤数据包结尾空数据
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char selectCon[128] = { 0 };
|
char selectCon[128] = { 0 };
|
||||||
sprintf(selectCon, "channelID='%s' and sendMsg = '1' ORDER BY timeStamp ASC LIMIT 0,1",strChannelID.c_str());
|
sprintf(selectCon, "channelID='%s' and sendMsg = '1' ORDER BY timeStamp ASC LIMIT 0,1",strChannelID.c_str());
|
||||||
std::string strTime = sql_ctl->GetData("t_data_waveSend", "timeStamp", selectCon);
|
std::string strTime = sql_ctl->GetData("t_data_waveSend", "timeStamp", selectCon);
|
||||||
@ -3917,24 +4035,6 @@ void Uart::DealWave()
|
|||||||
print_info("write data to filename %s\n", strFileName.c_str());
|
print_info("write data to filename %s\n", strFileName.c_str());
|
||||||
std::vector<float>().swap(vecData);
|
std::vector<float>().swap(vecData);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
|
||||||
if (strLongAddr != "")
|
|
||||||
{
|
|
||||||
std::vector<RecvData>().swap(m_VecWaveData);
|
|
||||||
char whereCon[1024] = {0x00};
|
|
||||||
char updateSql[1024] = {0x00};
|
|
||||||
sprintf(whereCon, "dataNodeNo='%s'", strLongAddr.c_str());
|
|
||||||
sprintf(updateSql, "WaveTime = WaveTime + 1");
|
|
||||||
sql_ctl->UpdateTableData(T_SENSOR_INFO(TNAME), updateSql, whereCon);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//string strData = sql_ctl->GetNodeConfigureInfor(whereCon);
|
|
||||||
//data_publish(strData.c_str(), GlobalConfig::Topic_G.mPubConfig.c_str());
|
|
||||||
// memset(buf, 0, 8);
|
|
||||||
// sprintf(buf, "%02x%02x", recvTemp.ShortAddr[0], recvTemp.ShortAddr[1]);
|
|
||||||
// std::string strShortAddr = std::string(buf);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void Uart::DealNodeSendTime(unsigned char* shortaddr)
|
void Uart::DealNodeSendTime(unsigned char* shortaddr)
|
||||||
|
@ -35,6 +35,7 @@ private :
|
|||||||
|
|
||||||
//DataNodeInfo dataNodeInfo;
|
//DataNodeInfo dataNodeInfo;
|
||||||
std::string m_strDestShortAddr;
|
std::string m_strDestShortAddr;
|
||||||
|
|
||||||
int waittime;
|
int waittime;
|
||||||
enum{BUF_LENGTH = 40960};
|
enum{BUF_LENGTH = 40960};
|
||||||
unsigned char mUartRecvBuf[BUF_LENGTH];
|
unsigned char mUartRecvBuf[BUF_LENGTH];
|
||||||
@ -70,9 +71,12 @@ public :
|
|||||||
void DealDataNodeInfo(const char *pData);
|
void DealDataNodeInfo(const char *pData);
|
||||||
void DealDataNodeName(const char *pData);
|
void DealDataNodeName(const char *pData);
|
||||||
void DealDataNodeFeature(const char *pData, int flag);
|
void DealDataNodeFeature(const char *pData, int flag);
|
||||||
void DealDataNodeWave(const char *pData);
|
void DealDataNodeWave(const char *pData,int comand);
|
||||||
void DealWaveThread();
|
void DealWaveThread();
|
||||||
void DealWave();
|
void DealWave();
|
||||||
|
std::vector<float> DealData(int ichannel,float coe,int sampleRate,int ACCSampleTime,string strProduct);
|
||||||
|
float Calcoe(int ran,int iChannel,string& product,int range);
|
||||||
|
void WriteDatFile(int sampleRate,string& strMeasurementID,int iChannel,std::vector<float>& vecData);
|
||||||
void DealNodeSendTime(unsigned char* shortaddr);
|
void DealNodeSendTime(unsigned char* shortaddr);
|
||||||
void ZigbeeInit();
|
void ZigbeeInit();
|
||||||
int ZigbeeTest();
|
int ZigbeeTest();
|
||||||
@ -109,9 +113,14 @@ private :
|
|||||||
void ReadHandle(char* pUartRecvBuf,size_t bytesRead);
|
void ReadHandle(char* pUartRecvBuf,size_t bytesRead);
|
||||||
void WriteHandle(const char *strSend,const boost::system::error_code &ec,size_t bytesWrite);
|
void WriteHandle(const char *strSend,const boost::system::error_code &ec,size_t bytesWrite);
|
||||||
onReceiveUart m_callback;
|
onReceiveUart m_callback;
|
||||||
std::vector<RecvData> m_VecWaveData;
|
|
||||||
|
|
||||||
unsigned long m_TimeStamp;
|
unsigned long m_TimeStamp;
|
||||||
bool m_waveTrans;
|
bool m_waveTrans;
|
||||||
|
int m_waveCountX;
|
||||||
|
int m_waveCountY;
|
||||||
|
int m_waveCountZ;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user