|
|
|
@ -35,6 +35,7 @@ size_t GpioControl::turnOnImpl(const IOT_PARAM& param)
|
|
|
|
|
std::vector<ITEM>::iterator it;
|
|
|
|
|
int res = 0;
|
|
|
|
|
int fd = -1;
|
|
|
|
|
time_t now = time(NULL);
|
|
|
|
|
|
|
|
|
|
fd = open(GPIO_NODE_MP, O_RDONLY);
|
|
|
|
|
if( fd > 0 )
|
|
|
|
@ -49,13 +50,16 @@ size_t GpioControl::turnOnImpl(const IOT_PARAM& param)
|
|
|
|
|
it->references++;
|
|
|
|
|
// it->closeTime = 0;
|
|
|
|
|
references = it->references;
|
|
|
|
|
if(it->openTime == 0)
|
|
|
|
|
it->openTime = now;
|
|
|
|
|
SetCamerastatus(it->cmd, true);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (it == m_items.end())
|
|
|
|
|
{
|
|
|
|
|
ITEM item = {param.cmd, references, 0, 0};
|
|
|
|
|
ITEM item = {param.cmd, references, 0, 0, 0};
|
|
|
|
|
item.openTime = now;
|
|
|
|
|
m_items.push_back(item);
|
|
|
|
|
SetCamerastatus(param.cmd, true);
|
|
|
|
|
}
|
|
|
|
@ -328,7 +332,10 @@ bool GpioControl::SetCamerastatus(int cmd, bool status)
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef USING_PLZ
|
|
|
|
|
if(cmd == CMD_SET_PTZ_PWR_ENABLE)
|
|
|
|
|
{
|
|
|
|
|
m_cameraPowerStatus = status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -337,6 +344,28 @@ bool GpioControl::GetCamerastatus()
|
|
|
|
|
return m_cameraPowerStatus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GpioControl::GetSelftestStatus(time_t wait_time)
|
|
|
|
|
{
|
|
|
|
|
int cmd;
|
|
|
|
|
#ifdef USING_N938
|
|
|
|
|
cmd = CMD_SET_PIC1_POWER;
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef USING_PLZ
|
|
|
|
|
cmd = CMD_SET_PTZ_PWR_ENABLE;
|
|
|
|
|
#endif
|
|
|
|
|
time_t now = time(NULL);
|
|
|
|
|
std::vector<ITEM>::iterator it;
|
|
|
|
|
for (it = m_items.begin(); it != m_items.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
if (it->cmd == cmd && (now - it->openTime >= wait_time))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GpioControl::PowerControlThreadProc()
|
|
|
|
|
{
|
|
|
|
|
time_t ts = 0;
|
|
|
|
@ -389,6 +418,7 @@ void GpioControl::PowerControlThreadProc()
|
|
|
|
|
// close it directly
|
|
|
|
|
setInt(it->cmd, 0);
|
|
|
|
|
it->closeTime = 0;
|
|
|
|
|
it->openTime = 0;
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
ALOGI("PWR THREAD DO TurnOff cmd=%d", it->cmd);
|
|
|
|
|
#endif
|
|
|
|
|