master
commit
ca75090f3e
|
@ -0,0 +1,247 @@
|
|||
#include "base64.h"
|
||||
|
||||
char alphabet_map[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
char reverse_map[] =
|
||||
{
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255, 255, 255, 63,
|
||||
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, 255, 255, 255, 255,
|
||||
255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 255, 255, 255, 255, 255,
|
||||
255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 255, 255, 255, 255, 255
|
||||
};
|
||||
const unsigned char encode_dict[64] = {
|
||||
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
|
||||
'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
|
||||
'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
|
||||
'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/'
|
||||
};
|
||||
|
||||
//GB2312到UTF-8的转换
|
||||
char* G2U(const char* gb2312)
|
||||
{
|
||||
int len = MultiByteToWideChar(CP_ACP, 0, gb2312, -1, NULL, 0);
|
||||
wchar_t* wstr = new wchar_t[len + 1];
|
||||
memset(wstr, 0, len + 1);
|
||||
MultiByteToWideChar(CP_ACP, 0, gb2312, -1, wstr, len);
|
||||
len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
|
||||
char* str = new char[len + 1];
|
||||
memset(str, 0, len + 1);
|
||||
WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, len, NULL, NULL);
|
||||
if (wstr) delete[] wstr;
|
||||
return str;
|
||||
}
|
||||
//UTF-8到GB2312的转换
|
||||
char* U2G(const char* utf8)
|
||||
{
|
||||
int len = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0);
|
||||
wchar_t* wstr = new wchar_t[len + 1];
|
||||
memset(wstr, 0, len + 1);
|
||||
MultiByteToWideChar(CP_UTF8, 0, utf8, -1, wstr, len);
|
||||
len = WideCharToMultiByte(CP_ACP, 0, wstr, -1, NULL, 0, NULL, NULL);
|
||||
char* str = new char[len + 1];
|
||||
memset(str, 0, len + 1);
|
||||
WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, len, NULL, NULL);
|
||||
if (wstr) delete[] wstr;
|
||||
return str;
|
||||
}
|
||||
|
||||
uint32 base64_encode_gbk(char* input, uint8* encode)
|
||||
{
|
||||
//1、包含中文的字符串 字符编码(windows默认是gbk)转换成unicode
|
||||
|
||||
//2、字符编码方式是utf-8的二进制
|
||||
uint8* text = (uint8*)G2U(input);
|
||||
uint32 text_len = (uint32)strlen((char*)text);
|
||||
|
||||
uint32 i, j;
|
||||
for (i = 0, j = 0; i + 3 <= text_len; i += 3)
|
||||
{
|
||||
encode[j++] = alphabet_map[text[i] >> 2]; //取出第一个字符的前6位并找出对应的结果字符
|
||||
encode[j++] = alphabet_map[((text[i] << 4) & 0x30) | (text[i + 1] >> 4)]; //将第一个字符的后2位与第二个字符的前4位进行组合并找到对应的结果字符
|
||||
encode[j++] = alphabet_map[((text[i + 1] << 2) & 0x3c) | (text[i + 2] >> 6)]; //将第二个字符的后4位与第三个字符的前2位组合并找出对应的结果字符
|
||||
encode[j++] = alphabet_map[text[i + 2] & 0x3f]; //取出第三个字符的后6位并找出结果字符
|
||||
}
|
||||
|
||||
if (i < text_len)
|
||||
{
|
||||
uint32 tail = text_len - i;
|
||||
if (tail == 1)
|
||||
{
|
||||
encode[j++] = alphabet_map[text[i] >> 2];
|
||||
encode[j++] = alphabet_map[(text[i] << 4) & 0x30];
|
||||
encode[j++] = '=';
|
||||
encode[j++] = '=';
|
||||
}
|
||||
else //tail==2
|
||||
{
|
||||
encode[j++] = alphabet_map[text[i] >> 2];
|
||||
encode[j++] = alphabet_map[((text[i] << 4) & 0x30) | (text[i + 1] >> 4)];
|
||||
encode[j++] = alphabet_map[(text[i + 1] << 2) & 0x3c];
|
||||
encode[j++] = '=';
|
||||
}
|
||||
}
|
||||
encode[j] = 0;
|
||||
return j;
|
||||
}
|
||||
|
||||
int base64_decode_gbk(const uint8* code, uint32 code_len, char* str)
|
||||
{
|
||||
uint8 plain[1024];
|
||||
//assert((code_len & 0x03) == 0); //如果它的条件返回错误,则终止程序执行。4的倍数。
|
||||
|
||||
uint32 i, j = 0;
|
||||
uint8 quad[4];
|
||||
for (i = 0; i < code_len; i += 4)
|
||||
{
|
||||
for (uint32 k = 0; k < 4; k++)
|
||||
{
|
||||
quad[k] = reverse_map[code[i + k]];//分组,每组四个分别依次转换为base64表内的十进制数
|
||||
}
|
||||
|
||||
//assert(quad[0] < 64 && quad[1] < 64);
|
||||
|
||||
plain[j++] = (quad[0] << 2) | (quad[1] >> 4); //取出第一个字符对应base64表的十进制数的前6位与第二个字符对应base64表的十进制数的前2位进行组合
|
||||
|
||||
if (quad[2] >= 64)
|
||||
break;
|
||||
else if (quad[3] >= 64)
|
||||
{
|
||||
plain[j++] = (quad[1] << 4) | (quad[2] >> 2); //取出第二个字符对应base64表的十进制数的后4位与第三个字符对应base64表的十进制数的前4位进行组合
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
plain[j++] = (quad[1] << 4) | (quad[2] >> 2);
|
||||
plain[j++] = (quad[2] << 6) | quad[3];//取出第三个字符对应base64表的十进制数的后2位与第4个字符进行组合
|
||||
}
|
||||
}
|
||||
plain[j] = 0;
|
||||
//char str[1024] = "";
|
||||
strcpy_s(str, 1024, (char*)plain);
|
||||
strcpy_s(str, sizeof(plain), U2G(str));
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
uint32 base64_encode(const uint8* text, uint32 text_len, uint8* encode)
|
||||
{
|
||||
uint32 i, j;
|
||||
for (i = 0, j = 0; i + 3 <= text_len; i += 3)
|
||||
{
|
||||
encode[j++] = alphabet_map[text[i] >> 2]; //取出第一个字符的前6位并找出对应的结果字符
|
||||
encode[j++] = alphabet_map[((text[i] << 4) & 0x30) | (text[i + 1] >> 4)]; //将第一个字符的后2位与第二个字符的前4位进行组合并找到对应的结果字符
|
||||
encode[j++] = alphabet_map[((text[i + 1] << 2) & 0x3c) | (text[i + 2] >> 6)]; //将第二个字符的后4位与第三个字符的前2位组合并找出对应的结果字符
|
||||
encode[j++] = alphabet_map[text[i + 2] & 0x3f]; //取出第三个字符的后6位并找出结果字符
|
||||
}
|
||||
|
||||
if (i < text_len)
|
||||
{
|
||||
uint32 tail = text_len - i;
|
||||
if (tail == 1)
|
||||
{
|
||||
encode[j++] = alphabet_map[text[i] >> 2];
|
||||
encode[j++] = alphabet_map[(text[i] << 4) & 0x30];
|
||||
encode[j++] = '=';
|
||||
encode[j++] = '=';
|
||||
}
|
||||
else //tail==2
|
||||
{
|
||||
encode[j++] = alphabet_map[text[i] >> 2];
|
||||
encode[j++] = alphabet_map[((text[i] << 4) & 0x30) | (text[i + 1] >> 4)];
|
||||
encode[j++] = alphabet_map[(text[i + 1] << 2) & 0x3c];
|
||||
encode[j++] = '=';
|
||||
}
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
uint32 base64_decode(const uint8* code, uint32 code_len, uint8* plain)
|
||||
{
|
||||
//assert((code_len & 0x03) == 0); //如果它的条件返回错误,则终止程序执行。4的倍数。
|
||||
|
||||
uint32 i, j = 0;
|
||||
uint8 quad[4];
|
||||
for (i = 0; i < code_len; i += 4)
|
||||
{
|
||||
for (uint32 k = 0; k < 4; k++)
|
||||
{
|
||||
quad[k] = reverse_map[code[i + k]];//分组,每组四个分别依次转换为base64表内的十进制数
|
||||
}
|
||||
|
||||
//assert(quad[0] < 64 && quad[1] < 64);
|
||||
|
||||
plain[j++] = (quad[0] << 2) | (quad[1] >> 4); //取出第一个字符对应base64表的十进制数的前6位与第二个字符对应base64表的十进制数的前2位进行组合
|
||||
|
||||
if (quad[2] >= 64)
|
||||
break;
|
||||
else if (quad[3] >= 64)
|
||||
{
|
||||
plain[j++] = (quad[1] << 4) | (quad[2] >> 2); //取出第二个字符对应base64表的十进制数的后4位与第三个字符对应base64表的十进制数的前4位进行组合
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
plain[j++] = (quad[1] << 4) | (quad[2] >> 2);
|
||||
plain[j++] = (quad[2] << 6) | quad[3];//取出第三个字符对应base64表的十进制数的后2位与第4个字符进行组合
|
||||
}
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
void base64Encode(const unsigned char *data, unsigned long long data_len, unsigned char *result) {
|
||||
const unsigned char *q = data + data_len - data_len % 3;
|
||||
|
||||
// 对前最大3的倍数个字节进行处理
|
||||
while (data != q) {
|
||||
*result++ = encode_dict[*data >> 2];
|
||||
*result++ = encode_dict[((*data << 4) | (*++data >> 4)) & 0x3fu];
|
||||
*result++ = encode_dict[((*data << 2) | (*++data >> 6)) & 0x3fu];
|
||||
*result++ = encode_dict[*data++ & 0x3fu];
|
||||
}
|
||||
switch (data_len % 3) {
|
||||
case 1:
|
||||
*result++ = encode_dict[*data >> 2];
|
||||
*result++ = encode_dict[*data << 4 & 0x3fu];
|
||||
*result++ = (unsigned char)'=';
|
||||
*result = (unsigned char)'=';
|
||||
break;
|
||||
case 2:
|
||||
*result++ = encode_dict[*data >> 2];
|
||||
*result++ = encode_dict[((*data << 4) | (*++data >> 4)) & 0x3fu];
|
||||
*result++ = encode_dict[*data << 2 & 0x3fu];;
|
||||
*result = (unsigned char)'=';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
////GB2312到UTF-8的转换
|
||||
//char* G2U(const char* gb2312)
|
||||
//{
|
||||
// int len = MultiByteToWideChar(CP_ACP, 0, gb2312, -1, NULL, 0);
|
||||
// wchar_t* wstr = new wchar_t[len + 1];
|
||||
// memset(wstr, 0, len + 1);
|
||||
// MultiByteToWideChar(CP_ACP, 0, gb2312, -1, wstr, len);
|
||||
// len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
|
||||
// char* str = new char[len + 1];
|
||||
// memset(str, 0, len + 1);
|
||||
// WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, len, NULL, NULL);
|
||||
// if (wstr) delete[] wstr;
|
||||
// return str;
|
||||
//}
|
||||
////UTF-8到GB2312的转换
|
||||
//char* U2G(const char* utf8)
|
||||
//{
|
||||
// int len = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0);
|
||||
// wchar_t* wstr = new wchar_t[len + 1];
|
||||
// memset(wstr, 0, len + 1);
|
||||
// MultiByteToWideChar(CP_UTF8, 0, utf8, -1, wstr, len);
|
||||
// len = WideCharToMultiByte(CP_ACP, 0, wstr, -1, NULL, 0, NULL, NULL);
|
||||
// char* str = new char[len + 1];
|
||||
// memset(str, 0, len + 1);
|
||||
// WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, len, NULL, NULL);
|
||||
// if (wstr) delete[] wstr;
|
||||
// return str;
|
||||
//}
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef BASE64_H
|
||||
#define BASE64_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include <iostream>
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned int uint32;
|
||||
|
||||
// GB2312到UTF-8的转换
|
||||
char* G2U(const char* gb2312);
|
||||
|
||||
// UTF-8到GB2312的转换
|
||||
char* U2G(const char* utf8);
|
||||
|
||||
// Base64编码
|
||||
uint32 base64_encode_gbk(char* input, uint8* encode);
|
||||
|
||||
// Base64解码
|
||||
int base64_decode_gbk(const uint8* code, uint32 code_len, char* str);
|
||||
|
||||
uint32 base64_decode(const uint8* code, uint32 code_len, uint8* plain);
|
||||
|
||||
uint32 base64_encode(const uint8* text, uint32 text_len, uint8* encode);
|
||||
|
||||
void base64Encode(const unsigned char *data, unsigned long long data_len, unsigned char *result);
|
||||
#endif // BASE64_H
|
|
@ -0,0 +1,58 @@
|
|||
#include "CrcUtil.h"
|
||||
|
||||
|
||||
uint16 usMBCRC16(uint8 * pucFrame, uint8 usLen)
|
||||
{
|
||||
uint8 ucCRCHi = 0xFF;
|
||||
uint8 ucCRCLo = 0xFF;
|
||||
int iIndex;
|
||||
while (usLen--)
|
||||
{
|
||||
iIndex = ucCRCLo ^ *(pucFrame++);
|
||||
ucCRCLo = (uint8)(ucCRCHi ^ aucCRCHi[iIndex]);
|
||||
ucCRCHi = aucCRCLo[iIndex];
|
||||
}
|
||||
return (uint16)(ucCRCHi << 8 | ucCRCLo);
|
||||
}
|
||||
|
||||
|
||||
uint16 CRC16(uint8 *ptr, uint8 len)
|
||||
{
|
||||
uint8 i;
|
||||
uint16 crc = 0;
|
||||
while (len-- != 0)
|
||||
{
|
||||
for (i = 0x80; i != 0; i /= 2)
|
||||
{
|
||||
if ((crc & 0x8000) != 0)
|
||||
{
|
||||
crc *= 2; crc ^= 0x8005;
|
||||
}
|
||||
else
|
||||
crc *= 2;
|
||||
if ((*ptr&i) != 0)
|
||||
crc ^= 0x8005;
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
return(crc);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CRC16źĆË㺯Ęý
|
||||
*/
|
||||
uint16 MB_CRC16(uint8 Buff[], int count)
|
||||
{
|
||||
uint8 CRCHi = 0xFF;
|
||||
uint8 CRCLo = 0xFF;
|
||||
int index;
|
||||
int i = 0;
|
||||
while ((count--) > 0)
|
||||
{
|
||||
index = CRCLo ^ Buff[i++];
|
||||
CRCLo = (uint8)(CRCHi ^ _CRCHi[index]);
|
||||
CRCHi = _CRCLo[index];
|
||||
}
|
||||
return (uint16)(CRCHi << 8 | CRCLo);
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
#pragma once
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
|
||||
static const uint8 aucCRCHi[] = {
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40
|
||||
};
|
||||
static const uint8 aucCRCLo[] = {
|
||||
0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, 0x07, 0xC7,
|
||||
0x05, 0xC5, 0xC4, 0x04, 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E,
|
||||
0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9,
|
||||
0x1B, 0xDB, 0xDA, 0x1A, 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC,
|
||||
0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3,
|
||||
0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32,
|
||||
0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4, 0x3C, 0xFC, 0xFD, 0x3D,
|
||||
0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A, 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38,
|
||||
0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA, 0xEE, 0x2E, 0x2F, 0xEF,
|
||||
0x2D, 0xED, 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26,
|
||||
0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, 0x61, 0xA1,
|
||||
0x63, 0xA3, 0xA2, 0x62, 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4,
|
||||
0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB,
|
||||
0x69, 0xA9, 0xA8, 0x68, 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA,
|
||||
0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5,
|
||||
0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0,
|
||||
0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97,
|
||||
0x55, 0x95, 0x94, 0x54, 0x9C, 0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E,
|
||||
0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98, 0x88, 0x48, 0x49, 0x89,
|
||||
0x4B, 0x8B, 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C,
|
||||
0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83,
|
||||
0x41, 0x81, 0x80, 0x40
|
||||
};
|
||||
|
||||
/*CRC 计算表1*/
|
||||
static uint8 _CRCHi[] = {
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40
|
||||
};
|
||||
/*CRC 计算表2*/
|
||||
static uint8 _CRCLo[] = {
|
||||
0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, 0x07, 0xC7,
|
||||
0x05, 0xC5, 0xC4, 0x04, 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E,
|
||||
0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9,
|
||||
0x1B, 0xDB, 0xDA, 0x1A, 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC,
|
||||
0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3,
|
||||
0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32,
|
||||
0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4, 0x3C, 0xFC, 0xFD, 0x3D,
|
||||
0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A, 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38,
|
||||
0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA, 0xEE, 0x2E, 0x2F, 0xEF,
|
||||
0x2D, 0xED, 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26,
|
||||
0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, 0x61, 0xA1,
|
||||
0x63, 0xA3, 0xA2, 0x62, 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4,
|
||||
0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB,
|
||||
0x69, 0xA9, 0xA8, 0x68, 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA,
|
||||
0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5,
|
||||
0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0,
|
||||
0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97,
|
||||
0x55, 0x95, 0x94, 0x54, 0x9C, 0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E,
|
||||
0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98, 0x88, 0x48, 0x49, 0x89,
|
||||
0x4B, 0x8B, 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C,
|
||||
0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83,
|
||||
0x41, 0x81, 0x80, 0x40
|
||||
};
|
||||
|
||||
uint16 usMBCRC16(uint8 * pucFrame, uint8 usLen);
|
||||
uint16 CRC16(uint8 *ptr, uint8 len);
|
||||
uint16 MB_CRC16(uint8 Buff[], int count);
|
|
@ -0,0 +1,11 @@
|
|||
#include "FaceAuthResult.h"
|
||||
|
||||
|
||||
CFaceAuthResult::CFaceAuthResult()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CFaceAuthResult::~CFaceAuthResult()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class CFaceAuthResult
|
||||
{
|
||||
public:
|
||||
CFaceAuthResult();
|
||||
~CFaceAuthResult();
|
||||
|
||||
int code;
|
||||
string msg;
|
||||
string face;
|
||||
string ignore;
|
||||
};
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
#include "LogFile.h"
|
||||
|
||||
|
||||
|
||||
CLogFile::CLogFile()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CLogFile::~CLogFile()
|
||||
{
|
||||
}
|
||||
|
||||
void CLogFile::WriteStrToFile(string strBody) {
|
||||
HANDLE hWrite;
|
||||
DWORD dwWriteSize;
|
||||
char *str = "d:\\log.txt";
|
||||
int lenA = lstrlenA(str);
|
||||
int lenW;
|
||||
BSTR fileName;
|
||||
|
||||
time_t rawtime;
|
||||
struct tm * timeinfo;
|
||||
time(&rawtime);
|
||||
timeinfo = localtime(&rawtime);
|
||||
printf("The current date/time is: %s", asctime(timeinfo));
|
||||
char szGetBuffer[512];
|
||||
sprintf_s(szGetBuffer, " %s\r\n", asctime(timeinfo));
|
||||
strBody += szGetBuffer;
|
||||
|
||||
lenW = ::MultiByteToWideChar(CP_UTF8, 0, str, lenA, 0, 0);
|
||||
if (lenW > 0)
|
||||
{
|
||||
// Check whether conversion was successful
|
||||
fileName = ::SysAllocStringLen(0, lenW);
|
||||
::MultiByteToWideChar(CP_UTF8, 0, str, lenA, fileName, lenW);
|
||||
}
|
||||
else
|
||||
{
|
||||
// handle the error
|
||||
}
|
||||
|
||||
hWrite = CreateFile(str, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hWrite == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("open error");
|
||||
}
|
||||
SetFilePointer(hWrite, 0, 0, FILE_END);//??
|
||||
if (!WriteFile(hWrite, strBody.c_str(), strBody.length(), &dwWriteSize, NULL))
|
||||
{
|
||||
printf("error while writeing");
|
||||
}
|
||||
|
||||
CloseHandle(hWrite);
|
||||
// when done, free the BSTR
|
||||
::SysFreeString(fileName);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
#include <Windows.h>
|
||||
#include <string>
|
||||
#include <time.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class CLogFile
|
||||
{
|
||||
public:
|
||||
CLogFile();
|
||||
~CLogFile();
|
||||
|
||||
static void WriteStrToFile(string strBody);
|
||||
};
|
||||
|
|
@ -0,0 +1,597 @@
|
|||
#include "NetSocket.h"
|
||||
#include "include\json\json.h"
|
||||
|
||||
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
|
||||
|
||||
CNetSocket::CNetSocket()
|
||||
{
|
||||
WSADATA wsaData;
|
||||
int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
|
||||
if (iResult != NO_ERROR)
|
||||
printf("WSAStartup() Error");
|
||||
//cout << "Error at WSAStartup()" << endl;
|
||||
}
|
||||
|
||||
|
||||
CNetSocket::~CNetSocket()
|
||||
{
|
||||
WSACleanup();
|
||||
}
|
||||
|
||||
|
||||
int CNetSocket::PostForm(char * RemoteHostIP, int RemoteHostPort, char * lpURL, string formData, CFaceAuthResult &ret)
|
||||
{
|
||||
//log.WriteStrToFile("开始网络");
|
||||
int SocketId, Result, optval = 1;
|
||||
struct sockaddr_in sServerAddr;
|
||||
string strBody;
|
||||
ret.code = -1;
|
||||
|
||||
sServerAddr.sin_family = AF_INET;
|
||||
sServerAddr.sin_addr.s_addr = inet_addr(RemoteHostIP);
|
||||
//sServerAddr->sin_addr.s_addr = INADDR_ANY;
|
||||
sServerAddr.sin_port = htons(RemoteHostPort);
|
||||
|
||||
if ((SocketId = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int timeout = 10000; // 超时时间为10秒(单位是毫秒)
|
||||
|
||||
// 设置发送超时
|
||||
if (setsockopt(SocketId, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, sizeof(timeout)) < 0) {
|
||||
// 错误处理
|
||||
strBody = "set send time out failed\n";
|
||||
//log.WriteStrToFile(strBody);
|
||||
printf("%s\n",strBody.c_str());
|
||||
shutdown(SocketId, 2);
|
||||
::closesocket(SocketId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 设置接收超时
|
||||
if (setsockopt(SocketId, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(timeout)) < 0) {
|
||||
// 错误处理
|
||||
strBody = "set receive time out failed\n";
|
||||
//log.WriteStrToFile(strBody);
|
||||
printf("%s\n", strBody.c_str());
|
||||
shutdown(SocketId, 2);
|
||||
::closesocket(SocketId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
optval = 1;
|
||||
setsockopt(SocketId, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(char *)&optval, sizeof(int));
|
||||
strBody = "connect network";
|
||||
//log.WriteStrToFile(strBody);
|
||||
Result = connect(SocketId, (struct sockaddr*)&sServerAddr, sizeof(struct sockaddr_in));
|
||||
if (Result != 0)
|
||||
{
|
||||
strBody = "connect failed";
|
||||
printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
shutdown(SocketId, 2);
|
||||
::closesocket(SocketId);
|
||||
return -1;
|
||||
}
|
||||
strBody = "connect success";
|
||||
//log.WriteStrToFile(strBody);
|
||||
|
||||
//
|
||||
// Format the HTTP request
|
||||
//
|
||||
// request buffer
|
||||
char *szGetBuffer = new char[MAX_CMD_SIZE * MAX_CMD_SIZE];
|
||||
|
||||
sprintf_s(szGetBuffer, MAX_CMD_SIZE * MAX_CMD_SIZE, "POST %s?file=%s HTTP/1.0\r\nHost:%s:%d\r\nContent-Type:application/x-www-form-urlencoded;charset=UTF-8;\r\n\r\n",
|
||||
lpURL, formData.c_str(), RemoteHostIP, RemoteHostPort);
|
||||
|
||||
strBody = "request api";
|
||||
//log.WriteStrToFile(strBody);
|
||||
|
||||
//发送Post请求
|
||||
Result = send(SocketId, szGetBuffer, strlen(szGetBuffer), 0);
|
||||
if (Result == -1)
|
||||
{
|
||||
strBody = "request api failed";
|
||||
printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
shutdown(SocketId, 2);
|
||||
::closesocket(SocketId);
|
||||
delete[]szGetBuffer;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
strBody = "request api success";
|
||||
//log.WriteStrToFile(strBody);
|
||||
|
||||
//userlog("function send success, the send string is \n %s \n return Value is %d",szGetBuffer,Result);
|
||||
|
||||
/*
|
||||
* 接受Post请求的返回结果
|
||||
*/
|
||||
// recv http header
|
||||
string header;
|
||||
int headerLength = RecvHttpHeader(SocketId, header);
|
||||
strBody = "";
|
||||
|
||||
if (headerLength > 0)
|
||||
{
|
||||
int contentLength = FindContentLength(header);
|
||||
|
||||
RecvHttpBody(SocketId, strBody, contentLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
//userlog("the return string is not http protptype");
|
||||
}
|
||||
printf("%s\n", strBody.c_str());
|
||||
|
||||
::closesocket(SocketId);
|
||||
delete[]szGetBuffer;
|
||||
ret.code = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CNetSocket::FindContentLength(string header)
|
||||
{
|
||||
std::transform(header.begin(), header.end(), header.begin(), (int(*)(int)) tolower);
|
||||
|
||||
string::size_type pos = header.find("content-length", 0);
|
||||
if (pos != string::npos)
|
||||
{
|
||||
string::size_type posEnd = header.find("\r\n", pos);
|
||||
string contentString = header.substr(pos, posEnd - pos);
|
||||
//userlog(contentString.c_str());
|
||||
pos = contentString.find(":", 0);
|
||||
|
||||
string strLength = contentString.substr(pos + 1);
|
||||
|
||||
return (int)std::strtol(strLength.c_str(), NULL, 10);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CNetSocket::recvPacketSize(SOCKET s)
|
||||
{
|
||||
char header[8] = { 0 };
|
||||
int len = 0;
|
||||
//确保收到8个字节
|
||||
|
||||
len = recv(s, header, 8, 0);
|
||||
if (SOCKET_ERROR == len)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if ('V' == header[0] && 'Z' == header[1])
|
||||
{
|
||||
int toRecvLen = 0;
|
||||
memcpy(&toRecvLen, &header[4], 4);
|
||||
return header[2] == 1 ? 0 : htonl(toRecvLen);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int CNetSocket::RecvData(SOCKET s, string& data)
|
||||
{
|
||||
int nRet = 0;
|
||||
int toRecvLen = recvPacketSize(s);
|
||||
char *pBuf = NULL;
|
||||
char buf[1] = { 0 };
|
||||
int nRecv = 0;
|
||||
int nCurRecv = 0;
|
||||
int i = 0;
|
||||
|
||||
if (toRecvLen > 0)
|
||||
{
|
||||
pBuf = new char[toRecvLen + 1];
|
||||
ZeroMemory(pBuf, toRecvLen + 1);
|
||||
|
||||
nCurRecv = recv(s, pBuf, toRecvLen, 0);
|
||||
nRecv += nCurRecv;
|
||||
data.append(pBuf, nCurRecv);
|
||||
//printf("toRecvLen=%d,nRecv=%d\r\n", toRecvLen, nRecv);
|
||||
while (nRecv < toRecvLen) {
|
||||
ZeroMemory(pBuf, toRecvLen + 1);
|
||||
nCurRecv = recv(s, pBuf, toRecvLen, 0);
|
||||
nRecv += nCurRecv;
|
||||
data.append(pBuf, nCurRecv);
|
||||
}
|
||||
|
||||
delete[]pBuf;
|
||||
}
|
||||
else
|
||||
{
|
||||
//socket error
|
||||
nRet = -1;
|
||||
}
|
||||
|
||||
return nRet;
|
||||
|
||||
}
|
||||
|
||||
size_t CNetSocket::RecvHttpHeader(int socket, string& header)
|
||||
{
|
||||
header.clear();
|
||||
char chRecvBuf[1];
|
||||
char endBytes[] = { 13, 10, 13, 10 };
|
||||
int posCompare = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
int b = recv(socket, chRecvBuf, 1, 0);
|
||||
if (b <= 0)
|
||||
break;
|
||||
|
||||
header.append(chRecvBuf, 1);
|
||||
|
||||
if (endBytes[posCompare] == chRecvBuf[0])
|
||||
{
|
||||
posCompare++;
|
||||
if (posCompare == sizeof(endBytes))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
posCompare = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return header.length();
|
||||
}
|
||||
|
||||
int CNetSocket::RecvHttpHeaderLength(int socket, string& length)
|
||||
{
|
||||
length.clear();
|
||||
char chRecvBuf[1];
|
||||
char endBytes[] = { 13, 10 };
|
||||
int posCompare = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
int b = recv(socket, chRecvBuf, 1, 0);
|
||||
if (b <= 0)
|
||||
break;
|
||||
|
||||
length.append(chRecvBuf, 1);
|
||||
|
||||
if (endBytes[posCompare] == chRecvBuf[0])
|
||||
{
|
||||
posCompare++;
|
||||
if (posCompare == sizeof(endBytes))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
posCompare = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return length.length();
|
||||
}
|
||||
|
||||
|
||||
int CNetSocket::RecvHttpBody(int socket, string& body, int contentLen)
|
||||
{
|
||||
body.clear();
|
||||
char *chRecvBuf = new char[contentLen + 1];
|
||||
|
||||
ZeroMemory(chRecvBuf, contentLen + 1);
|
||||
|
||||
int b = recv(socket, chRecvBuf, contentLen + 1, 0);
|
||||
|
||||
body.append(chRecvBuf, contentLen);
|
||||
|
||||
delete[]chRecvBuf;
|
||||
|
||||
return body.length();
|
||||
}
|
||||
|
||||
int CNetSocket::PostJson(char * RemoteHostIP, int RemoteHostPort, char * lpURL, string jsonData, string &strBody)
|
||||
{
|
||||
int SocketId, Result, optval = 1;
|
||||
struct sockaddr_in sServerAddr;
|
||||
|
||||
setlocale(LC_ALL, "Chinese-simplified");
|
||||
|
||||
strBody = "initialize";
|
||||
//printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
sServerAddr.sin_family = AF_INET;
|
||||
sServerAddr.sin_addr.s_addr = inet_addr(RemoteHostIP);
|
||||
//sServerAddr->sin_addr.s_addr = INADDR_ANY;
|
||||
sServerAddr.sin_port = htons(RemoteHostPort);
|
||||
|
||||
if ((SocketId = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
//设置KeepAlive
|
||||
optval = 1;
|
||||
setsockopt(SocketId, SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(int));
|
||||
//设置发送超时时间为5秒
|
||||
int sendTimeout = 10000;
|
||||
if (setsockopt(SocketId, SOL_SOCKET, SO_SNDTIMEO, (char *)&sendTimeout, sizeof(int)) < 0) {
|
||||
// 错误处理,例如打印错误信息
|
||||
perror("setsockopt SO_SNDTIMEO");
|
||||
}
|
||||
//设置接收超时时间为5秒
|
||||
int recvTimeout = 10000;
|
||||
if (setsockopt(SocketId, SOL_SOCKET, SO_RCVTIMEO, (char *)&recvTimeout, sizeof(int)) < 0) {
|
||||
// 错误处理,例如打印错误信息
|
||||
perror("setsockopt SO_SNDTIMEO");
|
||||
}
|
||||
|
||||
strBody = "connect";
|
||||
//printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
Result = connect(SocketId, (struct sockaddr*)&sServerAddr, sizeof(struct sockaddr_in));
|
||||
DWORD err = GetLastError();
|
||||
if (Result != 0)
|
||||
{
|
||||
strBody = "connect error";
|
||||
printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
::closesocket(SocketId);
|
||||
return -1;
|
||||
}
|
||||
strBody = "connect success";
|
||||
//printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
|
||||
char *szGetBuffer = new char[1024 * 1024];
|
||||
ZeroMemory(szGetBuffer, 1024 * 1024);
|
||||
//jsonData = "{\"name\": \"1\"}";
|
||||
sprintf_s(szGetBuffer, 1024 * 1024, "POST %s HTTP/1.1\r\nHost:%s:%d\r\nContent-Type:application/json\r\nContent-Length:%d\r\n\r\n%s",
|
||||
lpURL, RemoteHostIP, RemoteHostPort, jsonData.length(), jsonData.c_str());
|
||||
//printf("%s\n", szGetBuffer);
|
||||
|
||||
//WriteStrToFile(szGetBuffer);
|
||||
|
||||
strBody = "request interface";
|
||||
//printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
|
||||
//发送Post请求
|
||||
Result = send(SocketId, szGetBuffer, strlen(szGetBuffer), 0);
|
||||
if (Result == -1)
|
||||
{
|
||||
strBody = "request interface error";
|
||||
printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
::closesocket(SocketId);
|
||||
delete[]szGetBuffer;
|
||||
return -1;
|
||||
}
|
||||
|
||||
strBody = "request interface success";
|
||||
//printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
|
||||
//userlog("function send success, the send string is \n %s \n return Value is %d",szGetBuffer,Result);
|
||||
|
||||
/*
|
||||
* 接受Post请求的返回结果
|
||||
*/
|
||||
// recv http header
|
||||
string header;
|
||||
int headerLength = RecvHttpHeader(SocketId, header);
|
||||
string length;
|
||||
//int tempLength = RecvHttpHeaderLength(SocketId, length);
|
||||
strBody = "";
|
||||
|
||||
if (headerLength > 0)
|
||||
{
|
||||
int contentLength = FindContentLength(header);
|
||||
|
||||
RecvHttpBody(SocketId, strBody, contentLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
//userlog("the return string is not http protptype");
|
||||
}
|
||||
|
||||
::closesocket(SocketId);
|
||||
delete[]szGetBuffer;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CNetSocket::sendCmd(char * RemoteHostIP, int RemoteHostPort, char cmd[], string &data)
|
||||
{
|
||||
SOCKET SocketId;
|
||||
int Result, optval = 1;
|
||||
struct sockaddr_in sServerAddr;
|
||||
string strBody;
|
||||
|
||||
//printf("cmd is %s\n", cmd);
|
||||
|
||||
//strBody = "初始化";
|
||||
//printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
sServerAddr.sin_family = AF_INET;
|
||||
sServerAddr.sin_addr.s_addr = inet_addr(RemoteHostIP);
|
||||
//sServerAddr->sin_addr.s_addr = INADDR_ANY;
|
||||
sServerAddr.sin_port = htons(RemoteHostPort);
|
||||
|
||||
if ((SocketId = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
|
||||
{
|
||||
strBody = "init socket failed";
|
||||
printf("%s\n", strBody.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
optval = 1;
|
||||
setsockopt(SocketId, SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(int));
|
||||
//strBody = "连接网络";
|
||||
//printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
Result = connect(SocketId, (struct sockaddr*)&sServerAddr, sizeof(struct sockaddr_in));
|
||||
DWORD err = GetLastError();
|
||||
if (Result != 0)
|
||||
{
|
||||
strBody = "connect failed";
|
||||
printf("%s\n",strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
::closesocket(SocketId);
|
||||
return -1;
|
||||
}
|
||||
strBody = "connect success";
|
||||
//printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
|
||||
int len = strlen(cmd) + 1;
|
||||
char buff[8] = { 0 };
|
||||
buff[0] = 'V';
|
||||
buff[1] = 'Z';
|
||||
int nlen = htonl(len);
|
||||
memcpy(&buff[4], &nlen, 4);
|
||||
|
||||
Result = send(SocketId, buff, 8, 0);
|
||||
if (Result == 8)
|
||||
{
|
||||
Result = send(SocketId, cmd, len, 0);
|
||||
if (Result == -1)
|
||||
{
|
||||
strBody = "request host failed";
|
||||
printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
::closesocket(SocketId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
RecvData(SocketId, data);
|
||||
//printf("recv:");
|
||||
//printf("%s\n", data.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
::closesocket(SocketId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
::closesocket(SocketId);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CNetSocket::sendCmds(char * RemoteHostIP, int RemoteHostPort, char cmdInit[],char cmdGetStatus[], string &data)
|
||||
{
|
||||
SOCKET SocketId;
|
||||
int Result, optval = 1;
|
||||
struct sockaddr_in sServerAddr;
|
||||
string strBody;
|
||||
|
||||
//strBody = "初始化";
|
||||
//printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
sServerAddr.sin_family = AF_INET;
|
||||
sServerAddr.sin_addr.s_addr = inet_addr(RemoteHostIP);
|
||||
//sServerAddr->sin_addr.s_addr = INADDR_ANY;
|
||||
sServerAddr.sin_port = htons(RemoteHostPort);
|
||||
|
||||
if ((SocketId = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
|
||||
{
|
||||
printf("%s\n", strBody.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
optval = 1;
|
||||
setsockopt(SocketId, SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(int));
|
||||
//strBody = "连接网络";
|
||||
//printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
Result = connect(SocketId, (struct sockaddr*)&sServerAddr, sizeof(struct sockaddr_in));
|
||||
DWORD err = GetLastError();
|
||||
if (Result != 0)
|
||||
{
|
||||
strBody = "连接失败";
|
||||
printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
::closesocket(SocketId);
|
||||
return -1;
|
||||
}
|
||||
strBody = "连接成功";
|
||||
printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
|
||||
int nlen;
|
||||
int len;
|
||||
char buff[8] = { 0 };
|
||||
|
||||
len = strlen(cmdInit) + 1;
|
||||
buff[0] = 'V';
|
||||
buff[1] = 'Z';
|
||||
nlen = htonl(len);
|
||||
memcpy(&buff[4], &nlen, 4);
|
||||
|
||||
Result = send(SocketId, buff, 8, 0);
|
||||
if (Result == 8)
|
||||
{
|
||||
Result = send(SocketId, cmdInit, len, 0);
|
||||
if (Result == -1)
|
||||
{
|
||||
strBody = "请求接口失败";
|
||||
printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
::closesocket(SocketId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
RecvData(SocketId, data);
|
||||
printf("recv:");
|
||||
printf("%s\n", data.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
::closesocket(SocketId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
data = "";
|
||||
|
||||
len = strlen(cmdGetStatus) + 1;
|
||||
buff[0] = 'V';
|
||||
buff[1] = 'Z';
|
||||
nlen = htonl(len);
|
||||
memcpy(&buff[4], &nlen, 4);
|
||||
|
||||
Result = send(SocketId, buff, 8, 0);
|
||||
if (Result == 8)
|
||||
{
|
||||
Result = send(SocketId, cmdGetStatus, len, 0);
|
||||
if (Result == -1)
|
||||
{
|
||||
strBody = "请求接口失败";
|
||||
printf("%s\n", strBody.c_str());
|
||||
//log.WriteStrToFile(strBody);
|
||||
::closesocket(SocketId);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
RecvData(SocketId, data);
|
||||
printf("recv:");
|
||||
printf("%s\n", data.c_str());
|
||||
data = "";
|
||||
RecvData(SocketId, data);
|
||||
printf("recv:");
|
||||
printf("%s\n", data.c_str());
|
||||
|
||||
::closesocket(SocketId);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <time.h>
|
||||
#include "FaceAuthResult.h"
|
||||
|
||||
#define MAX_CMD_SIZE 1024
|
||||
|
||||
class CNetSocket
|
||||
{
|
||||
public:
|
||||
CNetSocket();
|
||||
~CNetSocket();
|
||||
|
||||
int PostForm(char * RemoteHostIP, int RemoteHostPort, char * lpURL, string formData, CFaceAuthResult &ret);
|
||||
int FindContentLength(string header);
|
||||
size_t RecvHttpHeader(int socket, string& header);
|
||||
int RecvHttpHeaderLength(int socket, string& length);
|
||||
int RecvHttpBody(int socket, string& body, int contentLen);
|
||||
int PostJson(char * RemoteHostIP, int RemoteHostPort, char * lpURL, string jsonData, string &strBody);
|
||||
int sendCmd(char * RemoteHostIP, int RemoteHostPort, char cmd[], string& header);
|
||||
int sendCmds(char * RemoteHostIP, int RemoteHostPort, char cmdInit[], char cmdGetStatus[],string &data);
|
||||
int RecvData(SOCKET socket, string& header);
|
||||
int recvPacketSize(SOCKET s);
|
||||
};
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
========================================================================
|
||||
控制台应用程序:transferServiceExe 项目概述
|
||||
========================================================================
|
||||
|
||||
应用程序向导已为您创建了此 transferServiceExe 应用程序。
|
||||
|
||||
本文件概要介绍组成 transferServiceExe 应用程序的每个文件的内容。
|
||||
|
||||
|
||||
transferServiceExe.vcxproj
|
||||
这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
|
||||
|
||||
transferServiceExe.vcxproj.filters
|
||||
这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
|
||||
|
||||
transferServiceExe.cpp
|
||||
这是主应用程序源文件。
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
其他标准文件:
|
||||
|
||||
StdAfx.h, StdAfx.cpp
|
||||
这些文件用于生成名为 transferServiceExe.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
其他注释:
|
||||
|
||||
应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,138 @@
|
|||
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||
// Distributed under MIT license, or public domain if desired and
|
||||
// recognized in your jurisdiction.
|
||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||
|
||||
#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
||||
#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
||||
|
||||
#if !defined(JSON_IS_AMALGAMATION)
|
||||
#include <json/config.h>
|
||||
#endif
|
||||
|
||||
// Also support old flag NO_LOCALE_SUPPORT
|
||||
#ifdef NO_LOCALE_SUPPORT
|
||||
#define JSONCPP_NO_LOCALE_SUPPORT
|
||||
#endif
|
||||
|
||||
#ifndef JSONCPP_NO_LOCALE_SUPPORT
|
||||
#include <clocale>
|
||||
#endif
|
||||
|
||||
/* This header provides common string manipulation support, such as UTF-8,
|
||||
* portable conversion from/to string...
|
||||
*
|
||||
* It is an internal header that must not be exposed.
|
||||
*/
|
||||
|
||||
namespace Json {
|
||||
static inline char getDecimalPoint() {
|
||||
#ifdef JSONCPP_NO_LOCALE_SUPPORT
|
||||
return '\0';
|
||||
#else
|
||||
struct lconv* lc = localeconv();
|
||||
return lc ? *(lc->decimal_point) : '\0';
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Converts a unicode code-point to UTF-8.
|
||||
static inline String codePointToUTF8(unsigned int cp) {
|
||||
String result;
|
||||
|
||||
// based on description from http://en.wikipedia.org/wiki/UTF-8
|
||||
|
||||
if (cp <= 0x7f) {
|
||||
result.resize(1);
|
||||
result[0] = static_cast<char>(cp);
|
||||
} else if (cp <= 0x7FF) {
|
||||
result.resize(2);
|
||||
result[1] = static_cast<char>(0x80 | (0x3f & cp));
|
||||
result[0] = static_cast<char>(0xC0 | (0x1f & (cp >> 6)));
|
||||
} else if (cp <= 0xFFFF) {
|
||||
result.resize(3);
|
||||
result[2] = static_cast<char>(0x80 | (0x3f & cp));
|
||||
result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 6)));
|
||||
result[0] = static_cast<char>(0xE0 | (0xf & (cp >> 12)));
|
||||
} else if (cp <= 0x10FFFF) {
|
||||
result.resize(4);
|
||||
result[3] = static_cast<char>(0x80 | (0x3f & cp));
|
||||
result[2] = static_cast<char>(0x80 | (0x3f & (cp >> 6)));
|
||||
result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 12)));
|
||||
result[0] = static_cast<char>(0xF0 | (0x7 & (cp >> 18)));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
enum {
|
||||
/// Constant that specify the size of the buffer that must be passed to
|
||||
/// uintToString.
|
||||
uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1
|
||||
};
|
||||
|
||||
// Defines a char buffer for use with uintToString().
|
||||
using UIntToStringBuffer = char[uintToStringBufferSize];
|
||||
|
||||
/** Converts an unsigned integer to string.
|
||||
* @param value Unsigned integer to convert to string
|
||||
* @param current Input/Output string buffer.
|
||||
* Must have at least uintToStringBufferSize chars free.
|
||||
*/
|
||||
static inline void uintToString(LargestUInt value, char*& current) {
|
||||
*--current = 0;
|
||||
do {
|
||||
*--current = static_cast<char>(value % 10U + static_cast<unsigned>('0'));
|
||||
value /= 10;
|
||||
} while (value != 0);
|
||||
}
|
||||
|
||||
/** Change ',' to '.' everywhere in buffer.
|
||||
*
|
||||
* We had a sophisticated way, but it did not work in WinCE.
|
||||
* @see https://github.com/open-source-parsers/jsoncpp/pull/9
|
||||
*/
|
||||
template <typename Iter> Iter fixNumericLocale(Iter begin, Iter end) {
|
||||
for (; begin != end; ++begin) {
|
||||
if (*begin == ',') {
|
||||
*begin = '.';
|
||||
}
|
||||
}
|
||||
return begin;
|
||||
}
|
||||
|
||||
template <typename Iter> void fixNumericLocaleInput(Iter begin, Iter end) {
|
||||
char decimalPoint = getDecimalPoint();
|
||||
if (decimalPoint == '\0' || decimalPoint == '.') {
|
||||
return;
|
||||
}
|
||||
for (; begin != end; ++begin) {
|
||||
if (*begin == '.') {
|
||||
*begin = decimalPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return iterator that would be the new end of the range [begin,end), if we
|
||||
* were to delete zeros in the end of string, but not the last zero before '.'.
|
||||
*/
|
||||
template <typename Iter>
|
||||
Iter fixZerosInTheEnd(Iter begin, Iter end, unsigned int precision) {
|
||||
for (; begin != end; --end) {
|
||||
if (*(end - 1) != '0') {
|
||||
return end;
|
||||
}
|
||||
// Don't delete the last zero before the decimal point.
|
||||
if (begin != (end - 1) && begin != (end - 2) && *(end - 2) == '.') {
|
||||
if (precision) {
|
||||
return end;
|
||||
}
|
||||
return end - 2;
|
||||
}
|
||||
}
|
||||
return end;
|
||||
}
|
||||
|
||||
} // namespace Json
|
||||
|
||||
#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,156 @@
|
|||
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||
// Distributed under MIT license, or public domain if desired and
|
||||
// recognized in your jurisdiction.
|
||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||
|
||||
// included by json_value.cpp
|
||||
|
||||
namespace Json {
|
||||
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// class ValueIteratorBase
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
|
||||
ValueIteratorBase::ValueIteratorBase() : current_() {}
|
||||
|
||||
ValueIteratorBase::ValueIteratorBase(
|
||||
const Value::ObjectValues::iterator& current)
|
||||
: current_(current), isNull_(false) {}
|
||||
|
||||
Value& ValueIteratorBase::deref() { return current_->second; }
|
||||
const Value& ValueIteratorBase::deref() const { return current_->second; }
|
||||
|
||||
void ValueIteratorBase::increment() { ++current_; }
|
||||
|
||||
void ValueIteratorBase::decrement() { --current_; }
|
||||
|
||||
ValueIteratorBase::difference_type
|
||||
ValueIteratorBase::computeDistance(const SelfType& other) const {
|
||||
// Iterator for null value are initialized using the default
|
||||
// constructor, which initialize current_ to the default
|
||||
// std::map::iterator. As begin() and end() are two instance
|
||||
// of the default std::map::iterator, they can not be compared.
|
||||
// To allow this, we handle this comparison specifically.
|
||||
if (isNull_ && other.isNull_) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Usage of std::distance is not portable (does not compile with Sun Studio 12
|
||||
// RogueWave STL,
|
||||
// which is the one used by default).
|
||||
// Using a portable hand-made version for non random iterator instead:
|
||||
// return difference_type( std::distance( current_, other.current_ ) );
|
||||
difference_type myDistance = 0;
|
||||
for (Value::ObjectValues::iterator it = current_; it != other.current_;
|
||||
++it) {
|
||||
++myDistance;
|
||||
}
|
||||
return myDistance;
|
||||
}
|
||||
|
||||
bool ValueIteratorBase::isEqual(const SelfType& other) const {
|
||||
if (isNull_) {
|
||||
return other.isNull_;
|
||||
}
|
||||
return current_ == other.current_;
|
||||
}
|
||||
|
||||
void ValueIteratorBase::copy(const SelfType& other) {
|
||||
current_ = other.current_;
|
||||
isNull_ = other.isNull_;
|
||||
}
|
||||
|
||||
Value ValueIteratorBase::key() const {
|
||||
const Value::CZString czstring = (*current_).first;
|
||||
if (czstring.data()) {
|
||||
if (czstring.isStaticString())
|
||||
return Value(StaticString(czstring.data()));
|
||||
return Value(czstring.data(), czstring.data() + czstring.length());
|
||||
}
|
||||
return Value(czstring.index());
|
||||
}
|
||||
|
||||
UInt ValueIteratorBase::index() const {
|
||||
const Value::CZString czstring = (*current_).first;
|
||||
if (!czstring.data())
|
||||
return czstring.index();
|
||||
return Value::UInt(-1);
|
||||
}
|
||||
|
||||
String ValueIteratorBase::name() const {
|
||||
char const* keey;
|
||||
char const* end;
|
||||
keey = memberName(&end);
|
||||
if (!keey)
|
||||
return String();
|
||||
return String(keey, end);
|
||||
}
|
||||
|
||||
char const* ValueIteratorBase::memberName() const {
|
||||
const char* cname = (*current_).first.data();
|
||||
return cname ? cname : "";
|
||||
}
|
||||
|
||||
char const* ValueIteratorBase::memberName(char const** end) const {
|
||||
const char* cname = (*current_).first.data();
|
||||
if (!cname) {
|
||||
*end = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
*end = cname + (*current_).first.length();
|
||||
return cname;
|
||||
}
|
||||
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// class ValueConstIterator
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
|
||||
ValueConstIterator::ValueConstIterator() = default;
|
||||
|
||||
ValueConstIterator::ValueConstIterator(
|
||||
const Value::ObjectValues::iterator& current)
|
||||
: ValueIteratorBase(current) {}
|
||||
|
||||
ValueConstIterator::ValueConstIterator(ValueIterator const& other)
|
||||
: ValueIteratorBase(other) {}
|
||||
|
||||
ValueConstIterator& ValueConstIterator::
|
||||
operator=(const ValueIteratorBase& other) {
|
||||
copy(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// class ValueIterator
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
|
||||
ValueIterator::ValueIterator() = default;
|
||||
|
||||
ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current)
|
||||
: ValueIteratorBase(current) {}
|
||||
|
||||
ValueIterator::ValueIterator(const ValueConstIterator& other)
|
||||
: ValueIteratorBase(other) {
|
||||
throwRuntimeError("ConstIterator to Iterator should never be allowed.");
|
||||
}
|
||||
|
||||
ValueIterator::ValueIterator(const ValueIterator& other) = default;
|
||||
|
||||
ValueIterator& ValueIterator::operator=(const SelfType& other) {
|
||||
copy(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
} // namespace Json
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,8 @@
|
|||
// stdafx.cpp : 只包括标准包含文件的源文件
|
||||
// transferServiceExe.pch 将作为预编译头
|
||||
// stdafx.obj 将包含预编译类型信息
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: 在 STDAFX.H 中
|
||||
// 引用任何所需的附加头文件,而不是在此文件中引用
|
|
@ -0,0 +1,15 @@
|
|||
// stdafx.h : 标准系统包含文件的包含文件,
|
||||
// 或是经常使用但不常更改的
|
||||
// 特定于项目的包含文件
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
|
||||
// TODO: 在此处引用程序需要的其他头文件
|
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
|
||||
|
||||
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
|
||||
// WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
|
||||
|
||||
#include <SDKDDKVer.h>
|
|
@ -0,0 +1,683 @@
|
|||
// transferServiceExe.cpp : 定义控制台应用程序的入口点。
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "transferServiceExe.h"
|
||||
#include "include\json\json.h"
|
||||
|
||||
int _tmain(int argc, CHAR* argv[])
|
||||
{
|
||||
printf("start transferServiceExe\n");
|
||||
|
||||
for (int i = 0; i < argc; i++){
|
||||
printf("%s ", argv[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (strcmp(argv[1], "readWeight") == 0){
|
||||
readWeight(argv[2], atoi(argv[3]), atoi(argv[4]), atoi(argv[5]), atoi(argv[6]));
|
||||
}
|
||||
else if (strcmp(argv[1], "manualTrigger") == 0) {
|
||||
manualTrigger(argv[2], atoi(argv[3]));
|
||||
}
|
||||
else if (strcmp(argv[1], "captureImageV2") == 0) {
|
||||
captureImageV2(argv[2], argv[3], atoi(argv[4]), argv[5], argv[6]);
|
||||
}
|
||||
else if (strcmp(argv[1], "displayInfoV2") == 0) {
|
||||
displayInfoV2(argv[2], atoi(argv[3]), argv[4], argv[5], argv[6], atoi(argv[7]));
|
||||
}
|
||||
else if (strcmp(argv[1], "openDoorV1") == 0){
|
||||
openDoorV1(argv[2], atoi(argv[3]), atoi(argv[4]));
|
||||
}
|
||||
else if (strcmp(argv[1], "playVoiceV3") == 0) {
|
||||
playVoiceV3(argv[2], argv[3], atoi(argv[4]),atoi(argv[5]));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
double readWeight(char * pPort, unsigned long BaudRate, unsigned char ByteSize, unsigned char Parity, unsigned char StopBits) {
|
||||
HANDLE hCom;
|
||||
BOOL bRet = FALSE;
|
||||
double dRet = 0.0;
|
||||
|
||||
hCom = CreateFile(pPort,
|
||||
GENERIC_READ,
|
||||
0,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
0,
|
||||
NULL);
|
||||
if (hCom == (HANDLE)-1)
|
||||
{
|
||||
printf("failure %s\n", pPort);
|
||||
return dRet;
|
||||
}
|
||||
|
||||
printf("open %s\n", pPort);
|
||||
|
||||
struct _DCB m_dcb;
|
||||
|
||||
GetCommState(hCom, &m_dcb);
|
||||
|
||||
m_dcb.BaudRate = BaudRate;
|
||||
m_dcb.ByteSize = ByteSize;
|
||||
m_dcb.Parity = Parity;
|
||||
m_dcb.StopBits = ONESTOPBIT;
|
||||
bRet = SetCommState(hCom, &m_dcb);
|
||||
|
||||
COMMTIMEOUTS comTimeOut;
|
||||
|
||||
comTimeOut.ReadIntervalTimeout = 10;
|
||||
comTimeOut.ReadTotalTimeoutMultiplier = 10;
|
||||
comTimeOut.ReadTotalTimeoutConstant = 8;
|
||||
comTimeOut.WriteTotalTimeoutMultiplier = 0;
|
||||
comTimeOut.WriteTotalTimeoutConstant = 0;
|
||||
SetCommTimeouts(hCom, &comTimeOut);
|
||||
|
||||
char str[12] = { '\0' };
|
||||
unsigned long wCount;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int t = 0;
|
||||
int weight = 0;
|
||||
int w1 = 0;
|
||||
int w2 = 0;
|
||||
int w3 = 0;
|
||||
int w4 = 0;
|
||||
int w5 = 0;
|
||||
int w6 = 0;
|
||||
int w7 = 0;
|
||||
int decimalSize = 0;
|
||||
int lastWeitht = 0;
|
||||
|
||||
bRet = false;
|
||||
|
||||
Sleep(16);
|
||||
// i don't know why, without Sleep(16), PurgeComm function below
|
||||
// can't work. maybe it's a timing problem. and "16" is the minimum
|
||||
// value that make it works.
|
||||
|
||||
// discards all characters in the input buffer
|
||||
if (!PurgeComm(hCom, PURGE_RXCLEAR))
|
||||
{
|
||||
printf("clear serial buffer error");
|
||||
}
|
||||
int k = 0;
|
||||
bool bFlag = false;
|
||||
|
||||
while (true){
|
||||
if (j >= 100){
|
||||
break;
|
||||
}
|
||||
memset(str, 0, 12);
|
||||
bRet = ReadFile(hCom, str, 12, &wCount, NULL);
|
||||
|
||||
if (wCount == 12){
|
||||
if (bFlag == false) {
|
||||
bFlag = true;
|
||||
j = 0;
|
||||
}
|
||||
//printf("i=%d,j=%d,port=%s\n", i, j, pPort);
|
||||
//for (int k = 0; k < 12; k++){
|
||||
// printf("%02X", str[k]);
|
||||
//}
|
||||
//printf("\n");
|
||||
w1 = (str[2] - '0') * 100000;
|
||||
w2 = (str[3] - '0') * 10000;
|
||||
w3 = (str[4] - '0') * 1000;
|
||||
w4 = (str[5] - '0') * 100;
|
||||
w5 = (str[6] - '0') * 10;
|
||||
w6 = (str[7] - '0');
|
||||
w7 = (str[8] - '0');
|
||||
|
||||
decimalSize = 1;
|
||||
for (int l = 0; l < w7; l++){
|
||||
decimalSize *= 10;
|
||||
}
|
||||
|
||||
weight = w1 + w2 + w3 + w4 + w5 + w6;
|
||||
printf("weight=%d,lastWeitht=%d,i=%d,j=%d,port=%s\n", weight, lastWeitht, i,j,pPort);
|
||||
if (weight != lastWeitht){
|
||||
i = 0;
|
||||
if (weight > 0)
|
||||
{
|
||||
lastWeitht = weight;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (weight > 0)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
if (i >= 20){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (weight == 0){
|
||||
if (t >= 50){
|
||||
break;
|
||||
}
|
||||
t++;
|
||||
}
|
||||
|
||||
if (decimalSize != 0){
|
||||
dRet = lastWeitht / decimalSize;
|
||||
}
|
||||
else{
|
||||
dRet = lastWeitht;
|
||||
}
|
||||
}
|
||||
SYSTEMTIME st;
|
||||
|
||||
GetLocalTime(&st);
|
||||
|
||||
printf("%d-%d-%d %d:%d:%d:%d,port=%s\n", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, pPort);
|
||||
Sleep(200);
|
||||
fflush(stdout);
|
||||
j++;
|
||||
}
|
||||
|
||||
printf("weight:%lf\n", dRet);
|
||||
|
||||
CloseHandle(hCom);
|
||||
|
||||
return dRet;
|
||||
}
|
||||
|
||||
//void initIntegrated(char * ip) {
|
||||
//#ifdef _QI_LI
|
||||
// printf("openDoorV4 start\n");
|
||||
//
|
||||
// E_ReturnCode eCode = DC_NO_ERROR;
|
||||
// Net_Init();
|
||||
//
|
||||
// DCHANDLE handle = Net_AddCamera(ip);
|
||||
//
|
||||
// if (handle == -1) {
|
||||
// printf("init camera error\n");
|
||||
//
|
||||
// return;
|
||||
// }
|
||||
// eCode = Net_ConnCamera(handle, 30000, 5);
|
||||
// int nConn = 0;
|
||||
// if (eCode != DC_NO_ERROR) {
|
||||
// printf("connect camera error,error code %d\n", eCode);
|
||||
// while (nConn < 3) {
|
||||
//
|
||||
// }
|
||||
// Net_DelCamera(handle);
|
||||
// Net_UNinit();
|
||||
//
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// T_ControlGate ControlGate;
|
||||
// memset(&ControlGate, 0, sizeof(ControlGate));
|
||||
// ControlGate.ucState = 1;
|
||||
//
|
||||
// eCode = Net_GateSetup(handle, &ControlGate);
|
||||
// if (eCode != DC_NO_ERROR) {
|
||||
// for (int i = 0; i < 3; i++) {
|
||||
//
|
||||
// }
|
||||
// printf("open door error,error code %d\n", eCode);
|
||||
// }
|
||||
//
|
||||
// Net_DisConnCamera(handle);
|
||||
// Net_DelCamera(handle);
|
||||
//
|
||||
// Net_UNinit();
|
||||
//
|
||||
// printf("openDoorV4 end\n");
|
||||
//#endif
|
||||
//}
|
||||
|
||||
//海康摄像机
|
||||
bool captureImageV2(char *ip, char *fileName, unsigned short pPort, char *userName, char *password) {
|
||||
#ifdef _HK_CAMERA
|
||||
NET_DVR_Init(); //Init SDK
|
||||
//NET_DVR_SetLogToFile(3, "d:\\capture", 0);
|
||||
DWORD err = GetLastError();
|
||||
|
||||
NET_DVR_DEVICEINFO_V30 DeviceInfoTmp;
|
||||
memset(&DeviceInfoTmp, 0, sizeof(NET_DVR_DEVICEINFO_V30));
|
||||
|
||||
LONG lLoginID = NET_DVR_Login_V30(ip, pPort, userName, password, &DeviceInfoTmp);
|
||||
printf("%s,%d,%s,%s\n", ip, pPort, userName, password);
|
||||
|
||||
if (lLoginID == -1)
|
||||
{
|
||||
err = GetLastError();
|
||||
printf("NET_DVR_Login_V30 error %d,%s\n", err, ip);
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
printf("%s\n", ip);
|
||||
}
|
||||
NET_DVR_CLIENTINFO ClientInfo;
|
||||
ClientInfo.hPlayWnd = NULL;
|
||||
ClientInfo.lChannel = 1;
|
||||
ClientInfo.lLinkMode = 0;
|
||||
ClientInfo.sMultiCastIP = NULL;
|
||||
//TRACE("Channel number:%d\n", ClientInfo.lChannel);
|
||||
long m_lPlayHandle = NET_DVR_RealPlay_V30(lLoginID, &ClientInfo, NULL, NULL, TRUE);
|
||||
if (-1 == m_lPlayHandle)
|
||||
{
|
||||
DWORD err = NET_DVR_GetLastError();
|
||||
//CString m_csErr;
|
||||
//MessageBox(m_csErr);
|
||||
printf("NET_DVR_RealPlay_V30 error %d\n", err);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
NET_DVR_JPEGPARA JpgPara = { 0 };
|
||||
JpgPara.wPicSize = 0xff;
|
||||
JpgPara.wPicQuality = 0;
|
||||
|
||||
LONG iCurChan = 1;
|
||||
|
||||
if (!NET_DVR_CaptureJPEGPicture(lLoginID, iCurChan, &JpgPara, fileName))
|
||||
{
|
||||
DWORD err = NET_DVR_GetLastError();
|
||||
printf("NET_DVR_CaptureJPEGPicture error %d,%s\n", err, ip);
|
||||
return false;
|
||||
}
|
||||
|
||||
NET_DVR_StopRealPlay(lLoginID);
|
||||
NET_DVR_Logout_V30(lLoginID);
|
||||
NET_DVR_Cleanup();
|
||||
printf("captureImage:success");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
//先科网络音柱
|
||||
void playVoiceV3(char * ip, char *json, int port,int maxVol) {
|
||||
CNetSocket socket;
|
||||
string strBody;
|
||||
|
||||
char *buffer = new char [MAX_CMD_SIZE];
|
||||
int size = strlen(json);
|
||||
|
||||
size = base64_decode_gbk((uint8*)json, size, buffer);
|
||||
buffer[size] = 0;
|
||||
printf("%s\n", buffer);
|
||||
|
||||
char *ipVoiceBoxParam = new char[MAX_CMD_SIZE];
|
||||
|
||||
//弘盛发专用
|
||||
//sprintf(ipVoiceBoxParam,"{\"loop\":{\"gap\":2,\"times\":2},\"prompt\":false,\"queue\":false,\"rcn\":\"0\",\"rdn\":\"0\",\"reg\":0,\"speed\":50,\"sync\":false,\"text\":\"%s\",\"vcn\":\"xiaoyan\",\"volume\":100}", json);
|
||||
sprintf(ipVoiceBoxParam, "{\"loop\":{\"gap\":2,\"times\":2},\"prompt\":false,\"queue\":false,\"rcn\":\"0\",\"rdn\":\"0\",\"reg\":0,\"speed\":50,\"sync\":false,\"text\":\"%s\",\"vcn\":\"xiaoyan\",\"volume\":%d}", buffer, maxVol);
|
||||
|
||||
//printf("json=%s\n", json);
|
||||
//string decodeJson = json;
|
||||
string decodeJson((char *)ipVoiceBoxParam);
|
||||
|
||||
//printf("%s", decodeJson.c_str());
|
||||
socket.PostJson(ip, port, "/v1/speech", decodeJson, strBody);
|
||||
printf("voice dev return %s\n", strBody.c_str());
|
||||
delete[] ipVoiceBoxParam;
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
void manualTrigger(char * ip, int port){
|
||||
CNetSocket socket;
|
||||
string retData;
|
||||
char cmd[] = "{\n" \
|
||||
"\"cmd\":\"trigger\"\n" \
|
||||
"}";
|
||||
|
||||
socket.sendCmd(ip, port, cmd, retData);
|
||||
printf("manual trigger dev return %s\n", retData.c_str());
|
||||
}
|
||||
|
||||
//多奥通设备
|
||||
void resetDevTimeV2(char * ip, int port,int rs485Port){
|
||||
CNetSocket socket;
|
||||
string retData;
|
||||
char *cmd = new char[MAX_CMD_SIZE];
|
||||
char *szTime = new char[MAX_CMD_SIZE];
|
||||
SYSTEMTIME st;
|
||||
|
||||
//set display time
|
||||
createDateTimeData(cmd, rs485Port);
|
||||
socket.sendCmd(ip, port, cmd, retData);
|
||||
|
||||
GetLocalTime(&st);
|
||||
|
||||
sprintf(szTime, "%d-%d-%d %d:%d:%d", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
|
||||
//set All-in-one machine time
|
||||
ZeroMemory(cmd, MAX_CMD_SIZE);
|
||||
sprintf(cmd, "{\n" \
|
||||
"\"cmd\" : \"set_time\",\n" \
|
||||
"\"id\" : \"132156\",\n" \
|
||||
"\"timestring\" : \"%s\"\n" \
|
||||
"}", szTime);
|
||||
|
||||
retData = "";
|
||||
socket.sendCmd(ip, port, cmd, retData);
|
||||
|
||||
sprintf(cmd, "{\n" \
|
||||
"\"cmd\": \"get_device_timestamp\",\n" \
|
||||
"\"id\" : \"999999\"\n" \
|
||||
"}");
|
||||
retData = "";
|
||||
socket.sendCmd(ip, port, cmd, retData);
|
||||
|
||||
delete[] szTime;
|
||||
delete[] cmd;
|
||||
}
|
||||
|
||||
//多奥通设备
|
||||
void openDoorV1(char * ip, int port,int ioPort){
|
||||
CNetSocket socket;
|
||||
string retData;
|
||||
char *cmd = new char[MAX_CMD_SIZE];
|
||||
sprintf(cmd, "{" \
|
||||
"\"cmd\" : \"ioctl_resp\"," \
|
||||
"\"id\" : \"1111\"," \
|
||||
"\"io\" : %d," \
|
||||
"\"value\" : 2," \
|
||||
"\"delay\" : 1500" \
|
||||
"}",ioPort);
|
||||
socket.sendCmd(ip, port, cmd, retData);
|
||||
printf("dev return %s\n", retData.c_str());
|
||||
delete[] cmd;
|
||||
}
|
||||
|
||||
//多奥通设备
|
||||
void displayInfoV2(char * ip, int port, char * szCarPlate, char * szWeight, char * szAmount, int rs485Port) {
|
||||
CNetSocket socket;
|
||||
string retData;
|
||||
int nCarPlate = 0;
|
||||
int nWeight = 0;
|
||||
int nAmount = 0;
|
||||
char *cmd = new char[MAX_CMD_SIZE];
|
||||
|
||||
printf("displayInfo start\n");
|
||||
if (szCarPlate != NULL) {
|
||||
nCarPlate = strlen(szCarPlate);
|
||||
//printf("nCarPlate is %d\n", nCarPlate);
|
||||
}
|
||||
|
||||
if (szWeight != NULL) {
|
||||
nWeight = strlen(szWeight);
|
||||
//printf("nWeight is %d\n", nWeight);
|
||||
}
|
||||
|
||||
if (szAmount != NULL) {
|
||||
nAmount = strlen(szAmount);
|
||||
//printf("nAmount is %d\n", nAmount);
|
||||
}
|
||||
|
||||
//printf("create displayInfo info\n");
|
||||
//
|
||||
char buff[256] = { 0 };
|
||||
if (nCarPlate > 0) {
|
||||
createDisplayData(szCarPlate, nCarPlate, 1, cmd, rs485Port);
|
||||
//printf("cmd is %s\n", cmd);
|
||||
socket.sendCmd(ip, port, cmd, retData);
|
||||
}
|
||||
|
||||
//
|
||||
if (nWeight > 0) {
|
||||
createDisplayData(szWeight, nWeight, 2, cmd, rs485Port);
|
||||
//printf("cmd is %s\n", cmd);
|
||||
socket.sendCmd(ip, port, cmd, retData);
|
||||
}
|
||||
|
||||
//
|
||||
if (nAmount > 0) {
|
||||
createDisplayData(szAmount, nAmount, 3, cmd, rs485Port);
|
||||
//printf("cmd is %s\n", cmd);
|
||||
socket.sendCmd(ip, port, cmd, retData);
|
||||
}
|
||||
printf("display dev return %s\n", retData.c_str());
|
||||
|
||||
delete[]cmd;
|
||||
}
|
||||
|
||||
void createDisplayData(char * text, int textLen, int line,char * cmd, int rs485Port){
|
||||
char* packet = NULL;
|
||||
try {
|
||||
byte header[] = { 0xA5, 0x01, 0x01, 0x3D, 0x3D, 0, 0, 0x3A };
|
||||
byte data[] = { 0x00, 0x01, 0x00, 0x30, 0x40, 0x40, 0x0F, 0x64, 0x03, 0x0A, 0x01, 0x02, 0x02, 0x00 };
|
||||
int headerLen = sizeof(header);
|
||||
int dataLen = sizeof(data);
|
||||
|
||||
memset(cmd, MAX_BUF_SIZE, 0);
|
||||
uint8_t* packet = new uint8_t[headerLen + dataLen + textLen + 2];
|
||||
data[0] = (byte)line;
|
||||
switch (line){
|
||||
case 1:
|
||||
data[2] = 0x00;
|
||||
data[3] = 0x30;
|
||||
data[4] = 0x40;
|
||||
data[5] = 0x40;
|
||||
break;
|
||||
case 2:
|
||||
data[2] = 0x00;
|
||||
data[3] = 0x20;
|
||||
data[4] = 0x40;
|
||||
data[5] = 0x30;
|
||||
break;
|
||||
case 3:
|
||||
data[2] = 0x00;
|
||||
data[3] = 0x10;
|
||||
data[4] = 0x40;
|
||||
data[5] = 0x20;
|
||||
break;
|
||||
}
|
||||
|
||||
header[5] = (byte)(dataLen + 2 + textLen);
|
||||
header[6] = (byte)(dataLen + 2 + textLen);
|
||||
|
||||
data[1] = (byte)line;
|
||||
|
||||
byte len = 4;
|
||||
|
||||
for (int i = 0; i < headerLen; i++) {
|
||||
packet[i] = header[i];
|
||||
}
|
||||
|
||||
for (int i = 0; i < dataLen; i++) {
|
||||
packet[headerLen + i] = data[i];
|
||||
}
|
||||
|
||||
packet[headerLen + dataLen] = (byte)textLen;
|
||||
|
||||
for (int i = 0; i < textLen; i++) {
|
||||
packet[headerLen + dataLen + i + 1] = text[i];
|
||||
}
|
||||
|
||||
packet[headerLen + dataLen + textLen + 1] = (byte)0xC1;
|
||||
|
||||
string strBase64 = "";
|
||||
uint8 buffer[1024] = {0};
|
||||
base64Encode(packet, headerLen + dataLen + textLen + 2,buffer);
|
||||
|
||||
memset(cmd, 0, MAX_CMD_SIZE);
|
||||
sprintf(cmd, "{\n" \
|
||||
"\"cmd\":\"ttransmission\",\n" \
|
||||
"\"id\":\"100001\",\n" \
|
||||
"\"subcmd\":\"send\",\n" \
|
||||
"\"datalen\":%d,\n" \
|
||||
"\"data\":\"%s\",\n" \
|
||||
"\"comm\":\"rs485-%d\"\n" \
|
||||
"}", (headerLen + dataLen + textLen + 2), buffer, rs485Port);
|
||||
|
||||
if (packet != NULL){
|
||||
delete[]packet;
|
||||
}
|
||||
}
|
||||
catch(...){
|
||||
if (packet != NULL){
|
||||
delete[]packet;
|
||||
}
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
void createVoiceData(char * text, int textLen, char * cmd,int rs485Port) {
|
||||
printf("text is %s\n", text);
|
||||
printf("textLen is %d\n", textLen);
|
||||
|
||||
char* packet = NULL;
|
||||
try {
|
||||
byte header[] = { 0xA5, 0x01, 0x01, 0x3D, 0x3D, 0, 0, 0x30 ,0x01 };
|
||||
int headerLen = sizeof(header);
|
||||
|
||||
memset(cmd, MAX_BUF_SIZE, 0);
|
||||
uint8_t* packet = new uint8_t[headerLen + textLen + 2];
|
||||
byte len = 4;
|
||||
|
||||
header[5] = (byte)(4 + textLen);
|
||||
header[6] = (byte)(4 + textLen);
|
||||
|
||||
for (int i = 0; i < headerLen; i++) {
|
||||
packet[i] = header[i];
|
||||
}
|
||||
|
||||
packet[headerLen] = (byte)textLen;
|
||||
|
||||
for (int i = 0; i < textLen; i++) {
|
||||
packet[headerLen + i + 1] = text[i];
|
||||
}
|
||||
|
||||
packet[headerLen + textLen + 1] = (byte)0xC1;
|
||||
|
||||
for (int i = 0; i < headerLen + textLen + 2;i++) {
|
||||
printf("%02X", packet[i]);
|
||||
}
|
||||
printf("\n");
|
||||
string strBase64 = "";
|
||||
uint8 buffer[1024] = { 0 };
|
||||
int size = base64_encode(packet, headerLen + textLen + 2, buffer);
|
||||
|
||||
memset(cmd, 0, MAX_CMD_SIZE);
|
||||
sprintf(cmd, "{\n" \
|
||||
"\"cmd\":\"ttransmission\",\n" \
|
||||
"\"id\":\"100001\",\n" \
|
||||
"\"subcmd\":\"send\",\n" \
|
||||
"\"datalen\":%d,\n" \
|
||||
"\"data\":\"%s\",\n" \
|
||||
"\"comm\":\"rs485-%d\"\n" \
|
||||
"}", (headerLen + textLen + 2), buffer, rs485Port);
|
||||
|
||||
if (packet != NULL) {
|
||||
delete[]packet;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
if (packet != NULL) {
|
||||
delete[]packet;
|
||||
}
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
void createDateTimeData(char * cmd,int rs485Port) {
|
||||
try {
|
||||
byte header[] = { 0xA5, 0x01, 0x01, 0x3D, 0x3D, 0, 0, 0x05 };
|
||||
byte data[] = { 0x00, 0x01, 0x00, 0x30, 0x40, 0x40, 0x0F, 0x64 };
|
||||
int headerLen = sizeof(header);
|
||||
int dataLen = sizeof(data);
|
||||
uint8_t* packet = new uint8_t[headerLen + dataLen + 1];
|
||||
|
||||
time_t t = time(NULL);
|
||||
struct tm *local_time = localtime(&t);
|
||||
|
||||
int nYear = local_time->tm_year + 1900;
|
||||
uint8_t * bYear = new uint8_t[2];
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
bYear[2 - i - 1] = (byte)((nYear >> 8 * i) & 0xff);
|
||||
}
|
||||
|
||||
int nMonth = local_time->tm_mon + 1;
|
||||
byte bMonth = (byte)nMonth;
|
||||
|
||||
int nDay = local_time->tm_mday;
|
||||
byte bDay = (byte)nDay;
|
||||
|
||||
int nHour = local_time->tm_hour;
|
||||
byte bHour = (byte)nHour;
|
||||
|
||||
int nMinute = local_time->tm_min;
|
||||
byte bMinute = (byte)nMinute;
|
||||
|
||||
int nSecond = local_time->tm_sec;
|
||||
byte bSecond = (byte)nSecond;
|
||||
|
||||
byte bWeek = local_time->tm_wday;
|
||||
|
||||
data[0] = bYear[1];
|
||||
data[1] = bYear[0];
|
||||
data[2] = bMonth;
|
||||
data[3] = bDay;
|
||||
data[4] = bHour;
|
||||
data[5] = bMinute;
|
||||
data[6] = bSecond;
|
||||
data[7] = bWeek;
|
||||
|
||||
header[5] = (byte)(dataLen + 2);
|
||||
header[6] = (byte)(dataLen + 2);
|
||||
|
||||
for (int i = 0; i < headerLen; i++) {
|
||||
packet[i] = header[i];
|
||||
}
|
||||
|
||||
for (int i = 0; i < dataLen; i++) {
|
||||
packet[headerLen + i] = data[i];
|
||||
}
|
||||
|
||||
packet[headerLen + dataLen] = (byte)0xC1;
|
||||
|
||||
uint8 *buffer = new uint8[MAX_CMD_SIZE];
|
||||
int size = base64_encode(packet, headerLen + dataLen + 1, buffer);
|
||||
|
||||
for (int i = 0; i < headerLen + dataLen; i++) {
|
||||
printf("%02X", packet[i]);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
sprintf(cmd, "{\n" \
|
||||
"\"cmd\":\"ttransmission\",\n" \
|
||||
"\"id\":\"100001\",\n" \
|
||||
"\"subcmd\":\"send\",\n" \
|
||||
"\"datalen\":%d,\n" \
|
||||
"\"data\":\"%s\",\n" \
|
||||
"\"comm\":\"rs485-%d\"\n" \
|
||||
"}", (headerLen + dataLen + 2), buffer, rs485Port);
|
||||
delete[]buffer;
|
||||
delete[]bYear;
|
||||
delete[]packet;
|
||||
}
|
||||
catch (...) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void saveBase64ToFile(char * fileName,string retData) {
|
||||
FILE *fp = fopen(fileName, "wb");
|
||||
if (fp == NULL) {
|
||||
printf("Error! Could not open file\n");
|
||||
return;
|
||||
}
|
||||
uint8 *buffer = new uint8[10 * MAX_CMD_SIZE * MAX_CMD_SIZE];
|
||||
int size = strlen(retData.c_str());
|
||||
printf("size is %d\n", size);
|
||||
int newsize = base64_decode((uint8*)retData.c_str(), size, buffer);
|
||||
|
||||
printf("size is %d\n", newsize);
|
||||
fwrite(buffer, newsize, 1, fp);
|
||||
|
||||
// 关闭文件
|
||||
fclose(fp);
|
||||
delete[]buffer;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
#include <winsock.h>
|
||||
#include <time.h>
|
||||
#include "string.h"
|
||||
#include "windows.h"
|
||||
#include "Base64.h"
|
||||
#include "NetSocket.h"
|
||||
#include "CrcUtil.h"
|
||||
|
||||
#define _HK_CAMERA
|
||||
|
||||
#ifdef _HK_CAMERA
|
||||
#include "HCNetSDK.h"
|
||||
|
||||
#pragma comment(lib, "./lib/HCNetSDK/x64/HCNetSDK.lib")
|
||||
#endif
|
||||
|
||||
#define MAX_BUF_SIZE 2048
|
||||
#define MAX_CMD_SIZE 1024
|
||||
|
||||
//char szDhImagePath[MAX_CMD_SIZE] = { 0 };
|
||||
HANDLE hEvent = 0;
|
||||
|
||||
struct TEXT_CONTEXT
|
||||
{
|
||||
unsigned char LID; //显示行号
|
||||
unsigned int TextColor;//文本颜色
|
||||
char * Text;//显示文本
|
||||
};
|
||||
|
||||
double readWeight(char * pPort, unsigned long BaudRate, unsigned char ByteSize, unsigned char Parity, unsigned char StopBits);
|
||||
|
||||
void manualTrigger(char * ip, int port);
|
||||
void createDateTimeData(char * cmd, int rs485Port);
|
||||
|
||||
void createDisplayData(char * text, int textLen, int line, char * cmd, int rs485Port);
|
||||
|
||||
void createVoiceData(char * text, int textLen, char * cmd, int rs485Port);
|
||||
|
||||
void saveBase64ToFile(char * fileName, string retData);
|
||||
|
||||
void displayInfoV2(char * ip, int port, char * szCarPlate, char * szWeight, char * szAmount, int rs485Port);
|
||||
|
||||
void openDoorV1(char * ip, int port, int ioPort);
|
||||
|
||||
void closeDoorV4(char * ip);
|
||||
|
||||
void playVoiceV3(char * ip, char *json, int port, int maxVol);
|
||||
|
||||
bool captureImageV2(char *ip, char *fileName, unsigned short pPort, char *userName, char *password);
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transferServiceExe", "transferServiceExe.vcxproj", "{53341EF3-3941-4560-97CD-CE734ABCD2A2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{53341EF3-3941-4560-97CD-CE734ABCD2A2}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{53341EF3-3941-4560-97CD-CE734ABCD2A2}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{53341EF3-3941-4560-97CD-CE734ABCD2A2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{53341EF3-3941-4560-97CD-CE734ABCD2A2}.Debug|x64.Build.0 = Debug|x64
|
||||
{53341EF3-3941-4560-97CD-CE734ABCD2A2}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{53341EF3-3941-4560-97CD-CE734ABCD2A2}.Release|Win32.Build.0 = Release|Win32
|
||||
{53341EF3-3941-4560-97CD-CE734ABCD2A2}.Release|x64.ActiveCfg = Release|x64
|
||||
{53341EF3-3941-4560-97CD-CE734ABCD2A2}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,179 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{53341EF3-3941-4560-97CD-CE734ABCD2A2}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>transferServiceExe</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>./include/;./include/VzClientSDK;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>./lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>./include/;./include/VzClientSDK;./include/HCNetSdk;./include/VehicleDevSDK;./include/DHSdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Base64.h" />
|
||||
<ClInclude Include="CrcUtil.h" />
|
||||
<ClInclude Include="FaceAuthResult.h" />
|
||||
<ClInclude Include="json_tool.h" />
|
||||
<ClInclude Include="LogFile.h" />
|
||||
<ClInclude Include="NetSocket.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="transferServiceExe.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Base64.cpp" />
|
||||
<ClCompile Include="CrcUtil.cpp" />
|
||||
<ClCompile Include="FaceAuthResult.cpp" />
|
||||
<ClCompile Include="json_reader.cpp" />
|
||||
<ClCompile Include="json_value.cpp" />
|
||||
<ClCompile Include="json_writer.cpp" />
|
||||
<ClCompile Include="LogFile.cpp" />
|
||||
<ClCompile Include="NetSocket.cpp" />
|
||||
<ClCompile Include="stdafx.cpp" />
|
||||
<ClCompile Include="transferServiceExe.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="json_valueiterator.inl" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="transferServiceExe.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FaceAuthResult.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="NetSocket.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Base64.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="json_tool.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="LogFile.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CrcUtil.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="transferServiceExe.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FaceAuthResult.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="NetSocket.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Base64.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="json_reader.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="json_value.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="json_writer.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LogFile.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CrcUtil.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="json_valueiterator.inl">
|
||||
<Filter>头文件</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue