Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
|
b56a56bb06 | 3 months ago |
|
27e4b7400e | 3 months ago |
|
4c1fd1b93f | 3 months ago |
@ -0,0 +1,96 @@
|
||||
//
|
||||
// Created by Matthew on 2025/3/5.
|
||||
//
|
||||
|
||||
#ifndef MICROPHOTO_PTZCONTROLLER_H
|
||||
#define MICROPHOTO_PTZCONTROLLER_H
|
||||
|
||||
#include <Buffer.h>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
#include <SemaphoreEx.h>
|
||||
#include <Client/Device.h>
|
||||
|
||||
enum PROC_PTZ_STATE
|
||||
{
|
||||
PTZS_POWER_OFF = 0,
|
||||
PTZS_IDLE = 1,
|
||||
PTZS_SELF_TESTING = 2,
|
||||
PTZS_MOVING = 3,
|
||||
PTZS_TAKING_PHOTO = 4,
|
||||
};
|
||||
|
||||
#define CAMERA_SELF_TEST_TIME 60 /* Camera self-test time (excluding PTZ self-test)*/
|
||||
#define MOVE_PRESET_WAIT_TIME 20 /* Waiting for the maximum time for the PTZ to move to the preset position*/
|
||||
|
||||
class PtzPhotoParams
|
||||
{
|
||||
public:
|
||||
PtzPhotoParams(const IDevice::PHOTO_INFO& photoInfo, const std::string& path, const std::vector<IDevice::OSD_INFO>& osds) :
|
||||
mPhotoInfo(photoInfo), mPath(path), mOsds(osds)
|
||||
{
|
||||
}
|
||||
|
||||
~PtzPhotoParams()
|
||||
{
|
||||
}
|
||||
|
||||
IDevice::PHOTO_INFO mPhotoInfo;
|
||||
std::string mPath;
|
||||
std::vector<IDevice::OSD_INFO> mOsds;
|
||||
};
|
||||
|
||||
struct SERIAL_CMD
|
||||
{
|
||||
uint8_t channel;
|
||||
uint8_t preset;
|
||||
time_t ts;
|
||||
int cmdidx;
|
||||
uint32_t delayTime;
|
||||
uint8_t bImageSize;
|
||||
char serfile[128];
|
||||
uint32_t baud;
|
||||
int addr;
|
||||
std::shared_ptr<PtzPhotoParams> photoParams;
|
||||
};
|
||||
|
||||
|
||||
class CPhoneDevice;
|
||||
class PtzController
|
||||
{
|
||||
public:
|
||||
PtzController(CPhoneDevice* pPhoneDevice);
|
||||
|
||||
void Startup();
|
||||
// ();
|
||||
void AddCommand(uint8_t channel, int cmdidx, uint8_t bImageSize, uint8_t preset, const char *serfile, uint32_t baud, int addr);
|
||||
void AddPhotoCommand(IDevice::PHOTO_INFO& photoInfo, const std::string& path, const std::vector<IDevice::OSD_INFO>& osds);
|
||||
|
||||
void ExitAndWait();
|
||||
|
||||
protected:
|
||||
static void PtzThreadProc(PtzController* pThis);
|
||||
|
||||
void PtzProc();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
protected:
|
||||
std::mutex m_locker;
|
||||
std::vector<SERIAL_CMD> m_cmds;
|
||||
|
||||
CSemaphore m_sem;
|
||||
bool m_exit;
|
||||
|
||||
std::thread m_thread;
|
||||
|
||||
CPhoneDevice* m_pPhoneDevice;
|
||||
};
|
||||
|
||||
|
||||
#endif //MICROPHOTO_PTZCONTROLLER_H
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue