|
|
|
@ -27,6 +27,7 @@ CSemaphore GpioControl::m_semaphore;
|
|
|
|
|
std::vector<GpioControl::ITEM> GpioControl::m_items;
|
|
|
|
|
std::thread GpioControl::m_thread;
|
|
|
|
|
bool GpioControl::m_exitSignal = false;
|
|
|
|
|
bool GpioControl::m_cameraPowerStatus = false;
|
|
|
|
|
|
|
|
|
|
size_t GpioControl::turnOnImpl(const IOT_PARAM& param)
|
|
|
|
|
{
|
|
|
|
@ -48,6 +49,7 @@ size_t GpioControl::turnOnImpl(const IOT_PARAM& param)
|
|
|
|
|
it->references++;
|
|
|
|
|
it->closeTime = 0;
|
|
|
|
|
references = it->references;
|
|
|
|
|
SetCamerastatus(it->cmd, true);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -209,8 +211,7 @@ size_t GpioControl::TurnOffImmediately(int cmd)
|
|
|
|
|
if (it->cmd == cmd)
|
|
|
|
|
{
|
|
|
|
|
ref = it->references;
|
|
|
|
|
if(it->closeCmds < it->references)
|
|
|
|
|
it->closeCmds++;
|
|
|
|
|
it->closeCmds++;
|
|
|
|
|
it->closeTime = ts;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -238,8 +239,7 @@ size_t GpioControl::TurnOff(int cmd, uint32_t delayedCloseTime/* = 0*/)
|
|
|
|
|
if (it->cmd == cmd)
|
|
|
|
|
{
|
|
|
|
|
ref = it->references;
|
|
|
|
|
if(it->closeCmds < it->references)
|
|
|
|
|
it->closeCmds++;
|
|
|
|
|
it->closeCmds++;
|
|
|
|
|
if (ts > it->closeTime)
|
|
|
|
|
{
|
|
|
|
|
it->closeTime = ts;
|
|
|
|
@ -272,8 +272,7 @@ size_t GpioControl::TurnOff(const std::vector<int>& cmds, uint32_t delayedCloseT
|
|
|
|
|
{
|
|
|
|
|
if (it->cmd == *itCmd)
|
|
|
|
|
{
|
|
|
|
|
if(it->closeCmds < it->references)
|
|
|
|
|
it->closeCmds++;
|
|
|
|
|
it->closeCmds++;
|
|
|
|
|
if (ts > it->closeTime)
|
|
|
|
|
{
|
|
|
|
|
it->closeTime = ts;
|
|
|
|
@ -301,8 +300,8 @@ size_t GpioControl::TurnOff(const std::vector<std::pair<int, uint32_t> >& cmds)
|
|
|
|
|
{
|
|
|
|
|
if (it->cmd == itCmd->first)
|
|
|
|
|
{
|
|
|
|
|
if(it->closeCmds < it->references)
|
|
|
|
|
it->closeCmds++;
|
|
|
|
|
|
|
|
|
|
it->closeCmds++;
|
|
|
|
|
if (itCmd->second != 0)
|
|
|
|
|
{
|
|
|
|
|
ts2 = itCmd->second + ts;
|
|
|
|
@ -320,6 +319,22 @@ size_t GpioControl::TurnOff(const std::vector<std::pair<int, uint32_t> >& cmds)
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
bool GpioControl::SetCamerastatus(int cmd, bool status)
|
|
|
|
|
{
|
|
|
|
|
#ifdef USING_N938
|
|
|
|
|
if(cmd == CMD_SET_PIC1_POWER)
|
|
|
|
|
m_cameraPowerStatus = status;
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef USING_PLZ
|
|
|
|
|
if(cmd == CMD_SET_PTZ_PWR_ENABLE)
|
|
|
|
|
m_cameraPowerStatus = status;
|
|
|
|
|
#endif
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
bool GpioControl::GetCamerastatus()
|
|
|
|
|
{
|
|
|
|
|
return m_cameraPowerStatus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GpioControl::PowerControlThreadProc()
|
|
|
|
|
{
|
|
|
|
@ -330,6 +345,7 @@ void GpioControl::PowerControlThreadProc()
|
|
|
|
|
time_t delayTime = 0;
|
|
|
|
|
int fd = -1;
|
|
|
|
|
int res = -1;
|
|
|
|
|
m_cameraPowerStatus = 0;
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
@ -375,6 +391,7 @@ void GpioControl::PowerControlThreadProc()
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
ALOGI("PWR TH DO TurnOff cmd=%d", it->cmd);
|
|
|
|
|
#endif
|
|
|
|
|
SetCamerastatus(it->cmd, false);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|