From 69536dc45dfb3def87b7c2098ee35c0be8754f15 Mon Sep 17 00:00:00 2001 From: Matthew Date: Thu, 21 Nov 2024 20:25:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=BD=91=E7=BB=9C=E6=91=84?= =?UTF-8?q?=E5=83=8F=E6=9C=BA=E7=9A=84=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/CMakeLists.txt | 5 +- app/src/main/cpp/MicroPhoto.cpp | 3 + app/src/main/cpp/PhoneDevice.cpp | 172 +++++++++++++++------- app/src/main/cpp/PhoneDevice.h | 2 +- app/src/main/cpp/netcamera/httpclient.cpp | 172 ++++++++++++++++++++++ app/src/main/cpp/netcamera/httpclient.h | 20 +++ app/src/main/cpp/netcamera/netcamera.h | 45 ++++++ 7 files changed, 364 insertions(+), 55 deletions(-) create mode 100644 app/src/main/cpp/netcamera/httpclient.cpp create mode 100644 app/src/main/cpp/netcamera/httpclient.h create mode 100644 app/src/main/cpp/netcamera/netcamera.h diff --git a/app/src/main/cpp/CMakeLists.txt b/app/src/main/cpp/CMakeLists.txt index 69efa786..4b030d41 100644 --- a/app/src/main/cpp/CMakeLists.txt +++ b/app/src/main/cpp/CMakeLists.txt @@ -39,6 +39,7 @@ add_definitions(-DUSING_NRSEC_VPN) # add_definitions(-DOUTPUT_CAMERA_DBG_INFO) add_definitions(-DALIGN_HB_TIMER_TO_PHOTO) add_definitions(-DENABLE_3V3_ALWAYS) +add_definitions(-DCURL_STATICLIB) add_definitions(-DUSING_HDRPLUS) add_definitions(-DUSING_EXEC_HDRP=1) @@ -386,6 +387,8 @@ add_library( # Sets the name of the library. ncnn/yolov5ncnn.cpp + netcamera/httpclient.cpp + #serial/WeatherComm.cpp # camera2/OpenCVFont.cpp @@ -464,7 +467,7 @@ target_link_libraries( # Specifies the target library. # included in the NDK. ${log-lib} - android camera2ndk mediandk z + android camera2ndk mediandk z curl ncnn ${OpenCV_LIBS} sqlite3 ${HDRPLUS_LIBS_EMBED} diff --git a/app/src/main/cpp/MicroPhoto.cpp b/app/src/main/cpp/MicroPhoto.cpp index e147d28d..74038974 100644 --- a/app/src/main/cpp/MicroPhoto.cpp +++ b/app/src/main/cpp/MicroPhoto.cpp @@ -44,6 +44,7 @@ bool DumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, #include #endif +#include static jmethodID mRegisterTimerMid = 0; static jmethodID mRegisterHeartbeatMid = 0; @@ -225,6 +226,8 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) env->DeleteLocalRef(clazz); #endif + curl_global_init(CURL_GLOBAL_ALL); + return result; } diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 60218023..f548d3f3 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -24,12 +24,15 @@ #include #include #include +#include #ifdef USING_HDRPLUS #include #include #endif +#include "netcamera/netcamera.h" + #include #include #include @@ -1405,8 +1408,6 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< mPath = path; mOsds = osds; - - #ifdef USING_N938 if (photoInfo.mediaType == 0) { // CameraPhotoCmd(time(NULL), channel, MOVE_PRESETNO, 0, type); @@ -1418,52 +1419,56 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< return true; #else - NdkCamera::CAMERA_PARAMS params; - memset(¶ms, 0, sizeof(params)); - - params.sceneMode = mPhotoInfo.sceneMode; - params.autoFocus = mPhotoInfo.autoFocus; - params.autoExposure = mPhotoInfo.autoExposure; - params.focusTimeout = mPhotoInfo.focusTimeout * 1000; - params.exposureTime = mPhotoInfo.exposureTime; - params.sensitivity = mPhotoInfo.sensitivity; - params.compensation = mPhotoInfo.compensation; - params.orientation = mPhotoInfo.orientation; - params.zoom = mPhotoInfo.zoom; - params.zoomRatio = mPhotoInfo.zoomRatio; - params.requestTemplate = mPhotoInfo.requestTemplate; - params.awbMode = mPhotoInfo.awbMode; - params.wait3ALocked = mPhotoInfo.wait3ALocked; - params.burstRawCapture = mPhotoInfo.usingRawFormat; - params.burstCaptures = mPhotoInfo.burstCaptures; - if (params.requestTemplate <= 0 || params.requestTemplate > 5) - { - params.requestTemplate = 2; - } - -#if 0 - if (photoInfo.ldrEnabled) - { - if (GpioControl::getLightAdc() > 1400) - { - params.autoExposure = 0; - params.exposureTime = 1200000000; - params.sensitivity = 1200; - } - } -#endif - bool res = false; - if (photoInfo.usbCamera) + if (photoInfo.cameraType == CAM_TYPE_USB || photoInfo.cameraType == CAM_TYPE_NET) { TurnOnOtg(NULL); } + if (photoInfo.cameraType == CAM_TYPE_NET) + { + GpioControl::set12VEnable(true); + } TurnOnCameraPower(NULL); res = true; - if (mPhotoInfo.mediaType == 0 && mPhotoInfo.usingSysCamera == 0) - { + if ((mPhotoInfo.mediaType == 0) && ((mPhotoInfo.cameraType == CAM_TYPE_MIPI) || (mPhotoInfo.cameraType == CAM_TYPE_USB))) + { + NdkCamera::CAMERA_PARAMS params; + memset(¶ms, 0, sizeof(params)); + + params.sceneMode = mPhotoInfo.sceneMode; + params.autoFocus = mPhotoInfo.autoFocus; + params.autoExposure = mPhotoInfo.autoExposure; + params.focusTimeout = mPhotoInfo.focusTimeout * 1000; + params.exposureTime = mPhotoInfo.exposureTime; + params.sensitivity = mPhotoInfo.sensitivity; + params.compensation = mPhotoInfo.compensation; + params.orientation = mPhotoInfo.orientation; + params.zoom = mPhotoInfo.zoom; + params.zoomRatio = mPhotoInfo.zoomRatio; + params.requestTemplate = mPhotoInfo.requestTemplate; + params.awbMode = mPhotoInfo.awbMode; + params.wait3ALocked = mPhotoInfo.wait3ALocked; + params.burstRawCapture = mPhotoInfo.usingRawFormat; + params.burstCaptures = mPhotoInfo.burstCaptures; + if (params.requestTemplate <= 0 || params.requestTemplate > 5) + { + params.requestTemplate = 2; + } + +#if 0 + if (photoInfo.ldrEnabled) + { + if (GpioControl::getLightAdc() > 1400) + { + params.autoExposure = 0; + params.exposureTime = 1200000000; + params.sensitivity = 1200; + } + } +#endif + mCamera = new CPhoneCamera(this, photoInfo.width, photoInfo.height, params); // mCamera = new CJpegCamera(this, photoInfo.width, photoInfo.height, mPath, params); if (mCamera->open(to_string(mPhotoInfo.cameraId)) == 0) @@ -1490,6 +1495,62 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< RestartApp(REBOOT_TYPE_APP, 60000, "FatalErrorOnCamera"); } } + } + else if ((mPhotoInfo.mediaType == 0) && (mPhotoInfo.cameraType == CAM_TYPE_NET)) + { + // Start Thread + CPhoneDevice* pThis = this; + + vector osds; + osds.swap(mOsds); + IDevice::PHOTO_INFO localPhotoInfo = mPhotoInfo; + + std::thread t([localPhotoInfo, path, pThis, osds]() mutable + { + NET_PHOTO_INFO netPhotoInfo = { 0 }; + strcpy(netPhotoInfo.ip, "192.168.19.107"); + strcpy(netPhotoInfo.url, "/cgi-bin/snapshot.cgi"); + strcpy(netPhotoInfo.outputPath, path.c_str()); + + std::vector img; + bool res = nc_hy::requestCapture(localPhotoInfo.channel, localPhotoInfo.preset, netPhotoInfo, img); + + if (res) + { + time_t takingTime = time(NULL); + if (localPhotoInfo.remedy != 0) + { + if ((takingTime - localPhotoInfo.scheduleTime) > 30) + { + takingTime = localPhotoInfo.scheduleTime + localPhotoInfo.channel * 2; + } + } + + localPhotoInfo.photoTime = takingTime; + // GpioControl::setOtgState(false); + GpioControl::set12VEnable(false); + + // Notify to take next photo + pThis->TakePhotoCb(1, localPhotoInfo, "", takingTime); + + cv::Mat rgb = cv::imdecode(cv::Mat(img), cv::IMREAD_COLOR); +#ifdef _DEBUG + cv::imwrite("/sdcard/com.xypower.mpapp/tmp/netimg2.jpg", rgb); +#endif + + res = pThis->PostProcessPhoto(localPhotoInfo, osds, path, "", rgb); + } + else + { + pThis->TakePhotoCb(0, localPhotoInfo, "", 0); + } + }); + + t.detach(); + } + else if (mPhotoInfo.mediaType == 0 && (mPhotoInfo.cameraType == CAM_TYPE_SERIAL)) + { + } else if (mPhotoInfo.usingSysCamera == 1) { @@ -1586,7 +1647,7 @@ bool CPhoneDevice::CloseCamera() return true; } -void CPhoneDevice::CloseCamera2(CPhoneDevice::CPhoneCamera* camera, unsigned int photoId, bool turnOffOtg) +void CPhoneDevice::CloseCamera2(CPhoneDevice::CPhoneCamera* camera, unsigned int photoId, unsigned char cameraType) { XYLOG(XYLOG_SEVERITY_DEBUG, "TP: Start CloseCamera PHOTOID=%u", photoId); // std::this_thread::sleep_for(std::chrono::milliseconds(16)); @@ -1597,11 +1658,16 @@ void CPhoneDevice::CloseCamera2(CPhoneDevice::CPhoneCamera* camera, unsigned int } XYLOG(XYLOG_SEVERITY_DEBUG, "TP: Will Turn Off Power PHOTOID=%u", photoId); - if (turnOffOtg) + if (cameraType == CAM_TYPE_NET) { - TurnOffOtg(NULL); + GpioControl::set12VEnable(false); } - TurnOffCameraPower(NULL); + + if (cameraType == CAM_TYPE_USB || cameraType == CAM_TYPE_NET) + { + GpioControl::setOtgState(false); + } + GpioControl::setCam3V3Enable(false); XYLOG(XYLOG_SEVERITY_DEBUG, "TP: End Turn Off Power PHOTOID=%u", photoId); XYLOG(XYLOG_SEVERITY_DEBUG, "TP: CloseCamera PHOTOID=%u", photoId); @@ -1682,7 +1748,7 @@ bool CPhoneDevice::onOneCapture(std::shared_ptr characteristics media_status_t mstatus; - std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, photoInfo.photoId, turnOffOtg); + std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, photoInfo.photoId, photoInfo.cameraType); m_threadClose.swap(closeThread); if (closeThread.joinable()) { @@ -1794,7 +1860,7 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr characteristi CPhoneCamera* pCamera = mCamera; mCamera = NULL; - std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, photoInfo.photoId, turnOffOtg); + std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, photoInfo.photoId, photoInfo.cameraType); m_threadClose.swap(closeThread); if (closeThread.joinable()) { @@ -2237,7 +2303,7 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr characteristi frames.clear(); - std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, photoInfo.photoId, turnOffOtg); + std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, photoInfo.photoId, mPhotoInfo.cameraType); m_threadClose.swap(closeThread); if (closeThread.joinable()) { @@ -2980,7 +3046,7 @@ bool CPhoneDevice::OnCaptureReady(bool photoOrVideo, bool result, cv::Mat& mat, mCamera = NULL; bool turnOffOtg = (mPhotoInfo.usbCamera != 0); - std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, mPhotoInfo.photoId, turnOffOtg); + std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, mPhotoInfo.photoId, mPhotoInfo.cameraType); m_threadClose.swap(closeThread); if (closeThread.joinable()) { @@ -3008,7 +3074,7 @@ bool CPhoneDevice::OnVideoReady(bool photoOrVideo, bool result, const char* path TakePhotoCb(result ? 3 : 0, mPhotoInfo, fullPath, time(NULL), objs); bool turnOffOtg = (mPhotoInfo.usbCamera != 0); - std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, mPhotoInfo.photoId, turnOffOtg); + std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, mPhotoInfo.photoId, mPhotoInfo.cameraType); m_threadClose.swap(closeThread); } else @@ -3025,7 +3091,7 @@ bool CPhoneDevice::OnVideoReady(bool photoOrVideo, bool result, const char* path TakePhotoCb(result ? 3 : 0, mPhotoInfo, fullPath, time(NULL), objs); bool turnOffOtg = (mPhotoInfo.usbCamera != 0); - std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, mPhotoInfo.photoId, turnOffOtg); + std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, mPhotoInfo.photoId, mPhotoInfo.cameraType); m_threadClose.swap(closeThread); } @@ -3047,7 +3113,7 @@ void CPhoneDevice::onError(const std::string& msg) TakePhotoCb(0, mPhotoInfo, mPath, 0); bool turnOffOtg = (mPhotoInfo.usbCamera != 0); - std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, mPhotoInfo.photoId, turnOffOtg); + std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, mPhotoInfo.photoId, mPhotoInfo.cameraType); // closeThread.detach(); m_threadClose.swap(closeThread); } @@ -3066,7 +3132,7 @@ void CPhoneDevice::onDisconnected(ACameraDevice* device) TakePhotoCb(0, mPhotoInfo, mPath, 0); bool turnOffOtg = (mPhotoInfo.usbCamera != 0); - std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, mPhotoInfo.photoId, turnOffOtg); + std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, mPhotoInfo.photoId, mPhotoInfo.cameraType); // closeThread.detach(); m_threadClose.swap(closeThread); } @@ -3251,6 +3317,7 @@ bool CPhoneDevice::OpenSensors(int sensortype) GpioControl::set12VEnable(true); GpioControl::setCam3V3Enable(true); GpioControl::setRS485Enable(true); + GpioControl::setInt(CMD_SET_SPI_POWER, 1); // GpioControl::setInt(CMD_SET_485_EN_STATE, 1); // 打开RS485电源 #ifndef USING_N938 #ifndef USING_PLZ @@ -3263,7 +3330,6 @@ bool CPhoneDevice::OpenSensors(int sensortype) GpioControl::setInt(CMD_SPI2SERIAL_POWER_EN, 1); GpioControl::setInt(CMD_RS485_3V3_EN, 1); #endif - GpioControl::setInt(CMD_SET_SPI_POWER, 1); } if(sensortype == CAMERA_SENSOR_OPEN) { diff --git a/app/src/main/cpp/PhoneDevice.h b/app/src/main/cpp/PhoneDevice.h index c07c807b..7163d622 100644 --- a/app/src/main/cpp/PhoneDevice.h +++ b/app/src/main/cpp/PhoneDevice.h @@ -296,7 +296,7 @@ protected: void onError(const std::string& msg); void onDisconnected(ACameraDevice* device); - void CloseCamera2(CPhoneCamera* camera, unsigned int photoId, bool turnOffOtg); + void CloseCamera2(CPhoneCamera* camera, unsigned int photoId, unsigned char cameraType); static void handleSignal(int sig, siginfo_t *si, void *uc); bool RegisterHandlerForSignal(int sig); diff --git a/app/src/main/cpp/netcamera/httpclient.cpp b/app/src/main/cpp/netcamera/httpclient.cpp new file mode 100644 index 00000000..30410b1b --- /dev/null +++ b/app/src/main/cpp/netcamera/httpclient.cpp @@ -0,0 +1,172 @@ +#include "httpclient.h" +#include "netcamera.h" + +static size_t OnWriteData(void* buffer, size_t size, size_t nmemb, void* lpVoid) +{ + std::vector* data = (std::vector*)lpVoid; + if( NULL == data || NULL == buffer ) + { + return -1; + } + uint8_t* begin = (uint8_t *)buffer; + uint8_t* end = begin + size * nmemb; + data->insert(data->end(), begin, end); + return nmemb; +} + + +int DoGetRequest(const char* url, const char* userName, const char* password, const char* interface, std::vector& data) +{ + CURLcode nRet; + std::string auth; + + CURL *curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET"); + curl_easy_setopt(curl, CURLOPT_URL, url); + if (userName != NULL && password != NULL && strlen(userName) > 0) + { + auth = userName; + auth += ":"; + auth += password; + curl_easy_setopt(curl, CURLOPT_USERPWD, auth.c_str()); + // DIGEST Auth + curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); + } + + // 设置回调函数 + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, OnWriteData); + // 设置回调函数的参数,获取反馈信息 + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &data); + // 接收数据时超时设置,如果5秒内数据未接收完,直接退出 +#ifndef NDEBUG + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10); +#else + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 60); +#endif + // 设置重定向次数,防止重定向次数太多 + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 4); + // 连接超时,这个数值如果设置太短可能导致数据请求不到就断开了 + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10); + + if (interface != NULL && strlen(interface) > 0) + { + curl_easy_setopt(curl, CURLOPT_INTERFACE , interface); + } + nRet = curl_easy_perform(curl); + if (CURLE_OK != nRet) + { + printf("GET err=%d", nRet); + } + curl_easy_cleanup(curl); + + return (0 == nRet) ? 0 : 1; +} + +int DoPutRequest(const char* url, const char* userName, const char* password, const char* interface, const char* contents, std::vector& data) +{ + std::string auth; + + CURL *curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT"); + curl_easy_setopt(curl, CURLOPT_URL, url); + if (userName != NULL && password != NULL && strlen(userName) > 0) + { + auth = userName; + auth += ":"; + auth += password; + curl_easy_setopt(curl, CURLOPT_USERPWD, auth.c_str()); + // DIGEST Auth + curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); + } + // 设置回调函数 + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, OnWriteData); + // 设置回调函数的参数,获取反馈信息 + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &data); + // 接收数据时超时设置,如果5秒内数据未接收完,直接退出 + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 60); + // 设置重定向次数,防止重定向次数太多 + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 4); + // 连接超时,这个数值如果设置太短可能导致数据请求不到就断开了 + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10); + + if (interface != NULL && strlen(interface) > 0) + { + curl_easy_setopt(curl, CURLOPT_INTERFACE , interface); + } + CURLcode nRet = curl_easy_perform(curl); + if (CURLE_OK != nRet) + { + printf("GET err=%d", nRet); + } + curl_easy_cleanup(curl); + + return (0 == nRet) ? 0 : 1; +} + +namespace nc_hy +{ + bool requestCapture(uint8_t channel, uint8_t preset, const NET_PHOTO_INFO& photoInfo) + { + bool res = false; + std::vector data; + const char* userName = NULL; + const char* password = NULL; + if (photoInfo.authType != 0) + { + userName = photoInfo.userName; + password = photoInfo.password; + } + const char* interface = photoInfo.interface; + + std::string url = "http://"; + url += photoInfo.ip; + url += photoInfo.url; + + int nRet = DoGetRequest(url.c_str(), userName, password, interface, data); + if (0 == nRet) + { + if (!data.empty()) + { + FILE *fp = fopen(photoInfo.outputPath, "wb"); + if (fp != NULL) + { + fwrite(&data[0], data.size(), 1, fp); + fclose(fp); + res = true; + } + } + } + + return res; + } + + bool requestCapture(uint8_t channel, uint8_t preset, const NET_PHOTO_INFO& photoInfo, std::vector& img) + { + bool res = false; + const char* userName = NULL; + const char* password = NULL; + if (photoInfo.authType != 0) + { + userName = photoInfo.userName; + password = photoInfo.password; + } + + std::string url = "http://"; + url += photoInfo.ip; + url += photoInfo.url; + + int nRet = DoGetRequest(url.c_str(), userName, password, photoInfo.interface, img); +#ifdef _DEBUG + if (0 == nRet) + { + FILE *fp = fopen("/sdcard/com.xypower.mpapp/tmp/netimg.jpg", "wb"); + if (fp != NULL) + { + fwrite(&img[0], img.size(), 1, fp); + fclose(fp); + } + } +#endif + return (0 == nRet); + } +} diff --git a/app/src/main/cpp/netcamera/httpclient.h b/app/src/main/cpp/netcamera/httpclient.h new file mode 100644 index 00000000..d09d4dbf --- /dev/null +++ b/app/src/main/cpp/netcamera/httpclient.h @@ -0,0 +1,20 @@ +#include +#include + +#include + +#include +#include +#include +#include +#include + +#ifndef __HTTP_CLIENT__ +#define __HTTP_CLIENT__ + + +bool setIPAddress(const char *if_name, const char *ip_addr, const char *net_mask, const char *gateway_addr); +int DoGetRequest(const char* url, const char* userName, const char* password, const char* interface, std::vector& data); +int DoPutRequest(const char* url, const char* userName, const char* password, const char* interface, const char* contents, std::vector& data); + +#endif // __HTTP_CLIENT__ \ No newline at end of file diff --git a/app/src/main/cpp/netcamera/netcamera.h b/app/src/main/cpp/netcamera/netcamera.h new file mode 100644 index 00000000..c15812c6 --- /dev/null +++ b/app/src/main/cpp/netcamera/netcamera.h @@ -0,0 +1,45 @@ +#include +#include + +#ifndef __NET_CAMERA__ +#define __NET_CAMERA__ + + +struct NET_PHOTO_INFO +{ + char ip[24]; + char userName[8]; + char password[16]; + char interface[16]; + char url[128]; + char outputPath[128]; + unsigned char authType; // 0, 1 + unsigned char reserved[7]; // for memory alignment +}; + + /* +struct NET_PHOTO_INFO +{ + std::string ip; + std::string userName; + std::string password; + std::string interface; + std::string url; + std::string outputPath; + unsigned char authType; // 0, 1 + unsigned char reserved[7]; // for memory alignment +}; +*/ + +namespace nc_hy +{ + bool requestCapture(uint8_t channel, uint8_t preset, const NET_PHOTO_INFO& photoInfo); + bool requestCapture(uint8_t channel, uint8_t preset, const NET_PHOTO_INFO& photoInfo, std::vector& img); +} + +namespace nc_hk +{ + bool requestCapture(uint8_t channel); +} + +#endif // __NET_CAMERA__ \ No newline at end of file