| | |
| | | #include "ev_proto.h"
|
| | | #include "face_daemon_proto.h"
|
| | |
|
| | | #define STFACE_SERVER_IP "192.168.1.146"
|
| | | #define STFACE_SERVER_IP "52.79.232.163"
|
| | | #define STFACE_SERVER_PORT "15432"
|
| | | #define STFACE_RECV_BUFFER_SIZE 1024
|
| | | #define STFACE_DEBUG_NETWORK_SYNC false
|
| | |
|
| | | std::string g_dbgLog;
|
| | |
|
| | | struct SocketClientContext
|
| | | {
|
| | |
| | | static void* daemon_thd(void* arg)
|
| | | {
|
| | | SocketClientContext* ctx = (SocketClientContext*)arg;
|
| | |
|
| | | //g_dbgLog = "";
|
| | |
|
| | | int clientfd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
| | | if (clientfd < 0)
|
| | |
| | | int recvSize = recv(clientfd, ctx->buffer, STFACE_RECV_BUFFER_SIZE, 0);
|
| | |
|
| | | ctx->buffer[recvSize] = '\0';
|
| | | g_dbgLog = (char*)ctx->buffer;
|
| | | LOG_NOTICE << "face detect result: " << ctx->buffer << LOG_ENDL;
|
| | |
|
| | | close(clientfd);
|
| | |
| | | evpHeader->cmd = FaceDaemonCommand::FDC_SENSETIMEFACEDETECT_SAVE;
|
| | | evpHeader->size = sizeof(EVPHeader) + sizeof(FDP_Image) + imgidx.size;
|
| | |
|
| | | fdpImage->db_id = 123;
|
| | | fdpImage->db_id = 1001;
|
| | | fdpImage->mb_type = imgidx.type;
|
| | | fdpImage->width = imgidx.width;
|
| | | fdpImage->height = imgidx.height;
|
| | | fdpImage->size = 0;//#todo
|
| | |
|
| | | memcpy(fdpImage->buff, buffImg, imgidx.size);
|
| | | ctx->buffSize = evpHeader->size;
|
| | |
|
| | | evpHeader->hton();
|
| | | fdpImage->hton();
|
| | |
|
| | | ctx->sendBuff(nullptr, 0);
|
| | | // delete ctx itself
|
| | | }
|