#include "menuSub1.h"
using namespace std;
static sqHisiLink::CHisiLinkInterface* m_hisilinkS1Hnl = nullptr;
CMenuSub1::CMenuSub1()
{}
CMenuSub1::~CMenuSub1()
{}
void CMenuSub1::create()
{
std::string version = sqHisiLink::CHisiLinkInterface::queryVersion();
m_hisilinkS1Hnl = sqHisiLink::CHisiLinkInterface::getInstance();
sqHisiLink::HISILINKATTR_T attr;
attr.display.way = sqHisiLink::DISPLAY_WAY::H264SRC_HDMI;
attr.display.config = sqHisiLink::DISPLAY_CONFIG::V1080P30;
osdB1 = m_hisilinkS1Hnl->createOsd();
osdB2 = m_hisilinkS1Hnl->createOsd();
osdB3 = m_hisilinkS1Hnl->createOsd();
osdB4 = m_hisilinkS1Hnl->createOsd();
osdB5 = m_hisilinkS1Hnl->createOsd();
osdB6 = m_hisilinkS1Hnl->createOsd();
osdB7 = m_hisilinkS1Hnl->createOsd();
osdB8 = m_hisilinkS1Hnl->createOsd();
osdB9 = m_hisilinkS1Hnl->createOsd();
osdB10 = m_hisilinkS1Hnl->createOsd();
osdB11 = m_hisilinkS1Hnl->createOsd();
}
void CMenuSub1::close()
{
m_hisilinkS1Hnl->destoryOsd(osdB1);
m_hisilinkS1Hnl->destoryOsd(osdB2);
m_hisilinkS1Hnl->destoryOsd(osdB3);
m_hisilinkS1Hnl->destoryOsd(osdB4);
m_hisilinkS1Hnl->destoryOsd(osdB5);
m_hisilinkS1Hnl->destoryOsd(osdB6);
m_hisilinkS1Hnl->destoryOsd(osdB7);
m_hisilinkS1Hnl->destoryOsd(osdB8);
m_hisilinkS1Hnl->destoryOsd(osdB9);
m_hisilinkS1Hnl->destoryOsd(osdB10);
m_hisilinkS1Hnl->destoryOsd(osdB11);
}
void CMenuSub1::up_sub(char* buf1,char* buf2,char* buf3,char* buf4,char* buf5,char* buf6,char* buf7,char* buf8,char* buf9,char* buf10,char* buf11)
{
// if(redyellow == 2)
// {
// if(m_curidx > 1)
// m_curidx--;
// else if(m_curidx == 1)
// m_curidx = 11;
// osdshow_sub(1,m_curidx,redyellow,buf1,buf2,buf3,buf4,buf5,buf6,buf7,buf8,buf9,buf10,buf11);
// }
// else if(redyellow == 3)
// {
// printf("Modify data \n");
// }
printf("up_sub1 \n");
}
void CMenuSub1::down_sub(char* buf1,char* buf2,char* buf3,char* buf4,char* buf5,char* buf6,char* buf7,char* buf8,char* buf9,char* buf10,char* buf11)
{
if(redyellow == 2)
{
if(m_curidx < 11)
m_curidx++;
else if(m_curidx == 11)
m_curidx = 1;
osdshow_sub(1,m_curidx,redyellow,buf1,buf2,buf3,buf4,buf5,buf6,buf7,buf8,buf9,buf10,buf11);
}
else if(redyellow == 3)
{
printf("Modify data \n");
}
}
void CMenuSub1::left_sub()
{}
void CMenuSub1::right_sub()
{}
void CMenuSub1::enter_sub(char* buf1,char* buf2,char* buf3,char* buf4,char* buf5,char* buf6,char* buf7,char* buf8,char* buf9,char* buf10,char* buf11)
{
if(times == 1) //yellow
{
redyellow = 2;
osdshow_sub(1,m_curidx,redyellow,buf1,buf2,buf3,buf4,buf5,buf6,buf7,buf8,buf9,buf10,buf11);
times++;
}
else if(times == 2) //red
{
redyellow = 3;
osdshow_sub(1,m_curidx,redyellow,buf1,buf2,buf3,buf4,buf5,buf6,buf7,buf8,buf9,buf10,buf11);
times++;
}
else if(times == 3) //close osd
{
osdshow_sub(0,m_curidx,redyellow,buf1,buf2,buf3,buf4,buf5,buf6,buf7,buf8,buf9,buf10,buf11);
times = 1;
close();
}
}
void CMenuSub1::osdshow_sub(bool show,int m_curIdx,int colorChn,char* buf1,char* buf2,char* buf3,char* buf4,char* buf5,char* buf6,char* buf7,char* buf8,char* buf9,char* buf10,char* buf11)
{
if(redyellow == 2)
{
if(m_curIdx == 1)
m_color = {2,1,1,1,1,1,1,1,1,1,1};
else if(m_curIdx == 2)
m_color = {1,2,1,1,1,1,1,1,1,1,1};
else if(m_curIdx == 3)
m_color = {1,1,2,1,1,1,1,1,1,1,1};
else if(m_curIdx == 4)
m_color = {1,1,1,2,1,1,1,1,1,1,1};
else if(m_curIdx == 5)
m_color = {1,1,1,1,2,1,1,1,1,1,1};
else if(m_curIdx == 6)
m_color = {1,1,1,1,1,2,1,1,1,1,1};
else if(m_curIdx == 7)
m_color = {1,1,1,1,1,1,2,1,1,1,1};
else if(m_curIdx == 8)
m_color = {1,1,1,1,1,1,1,2,1,1,1};
else if(m_curIdx == 9)
m_color = {1,1,1,1,1,1,1,1,2,1,1};
else if(m_curIdx == 10)
m_color = {1,1,1,1,1,1,1,1,1,2,1};
else if(m_curIdx == 11)
m_color = {1,1,1,1,1,1,1,1,1,1,2};
}
else if(redyellow == 3)
{
if(m_curIdx == 1)
m_color = {3,1,1,1,1,1,1,1,1,1,1};
else if(m_curIdx == 2)
m_color = {1,3,1,1,1,1,1,1,1,1,1};
else if(m_curIdx == 3)
m_color = {1,1,3,1,1,1,1,1,1,1,1};
else if(m_curIdx == 4)
m_color = {1,1,1,3,1,1,1,1,1,1,1};
else if(m_curIdx == 5)
m_color = {1,1,1,1,3,1,1,1,1,1,1};
else if(m_curIdx == 6)
m_color = {1,1,1,1,1,3,1,1,1,1,1};
else if(m_curIdx == 7)
m_color = {1,1,1,1,1,1,3,1,1,1,1};
else if(m_curIdx == 8)
m_color = {1,1,1,1,1,1,1,3,1,1,1};
else if(m_curIdx == 9)
m_color = {1,1,1,1,1,1,1,1,3,1,1};
else if(m_curIdx == 10)
m_color = {1,1,1,1,1,1,1,1,1,3,1};
else if(m_curIdx == 11)
m_color = {1,1,1,1,1,1,1,1,1,1,3};
}
firstIdxMenu(buf1,show,m_color.c1);
secondIdxMenu(buf2,show,m_color.c2);
thirdIdxMenu(buf3,show,m_color.c3);
fourthIdxMenu(buf4,show,m_color.c4);
fifthIdxMenu(buf5,show,m_color.c5);
sixthIdxMenu(buf6,show,m_color.c6);
seventhIdxMenu(buf7,show,m_color.c7);
eightthIdxMenu(buf8,show,m_color.c8);
ninthIdxMenu(buf9,show,m_color.c9);
tenthIdxMenu(buf10,show,m_color.c10);
eleventhIdxMenu(buf11,show,m_color.c11);
}
void CMenuSub1::colorHnl(int osd,char buf[256],bool show,int x,int y,int colorChn)
{
if(colorChn == 1) //whilte
{
m_hisilinkBHnl->pushString(osd,buf,show,x,y,255,255,255);
}
else if(colorChn == 2) //yellow
{
m_hisilinkBHnl->pushString(osd,buf,show,x,y,255,255,0);
}
else if(colorChn == 3) //red
{
m_hisilinkBHnl->pushString(osd,buf,show,x,y,255,0,0);
}
}
void CMenuSub1::firstIdxMenu(char* cbuf,bool show,int colorChn)
{
char timestr[256];
int cc = atoi(cbuf);
if(cc == 0)
snprintf(timestr,256,"工作状态:休眠",cbuf);
else if(cc == 1)
snprintf(timestr,256,"工作状态:工作",cbuf);
colorHnl(osdB1,timestr,show,50,50,colorChn);
}
void CMenuSub1::secondIdxMenu(char* cbuf,bool show,int colorChn)
{
char timestr[256];
int cc = atoi(cbuf);
if(cc == 0)
snprintf(timestr,256,"移动侦测开关:关",cbuf);
else if(cc == 1)
snprintf(timestr,256,"移动侦测开关:开",cbuf);
colorHnl(osdB2,timestr,show,50,100,colorChn);
}
void CMenuSub1::thirdIdxMenu(char* cbuf,bool show,int colorChn)
{
char timestr[256];
int cc = atoi(cbuf);
if(cc == 0)
snprintf(timestr,256,"移动侦测通道: MIPI",cbuf);
else if(cc == 1)
snprintf(timestr,256,"移动侦测通道: SDI",cbuf);
colorHnl(osdB3,timestr,show,50,150,colorChn);
}
void CMenuSub1::fourthIdxMenu(char* cbuf,bool show,int colorChn)
{
char timestr[256];
int cc = atoi(cbuf);
if(cc == 0)
snprintf(timestr,256,"录像通道: MIPI",cbuf);
else if(cc == 1)
snprintf(timestr,256,"录像通道: SDI",cbuf);
colorHnl(osdB4,timestr,show,50,200,colorChn);
}
void CMenuSub1::fifthIdxMenu(char* cbuf,bool show,int colorChn)
{
char timestr[256];
int cc = atoi(cbuf);
if(cc == 0)
snprintf(timestr,256,"传输通道: MIPI",cbuf);
else if(cc == 1)
snprintf(timestr,256,"传输通道: SDI",cbuf);
colorHnl(osdB5,timestr,show,50,250,colorChn);
}
void CMenuSub1::sixthIdxMenu(char* cbuf,bool show,int colorChn)
{
char timestr[256];
int cc = atoi(cbuf);
if(cc == 0)
snprintf(timestr,256,"信道: 908M",cbuf);
else if(cc == 1)
snprintf(timestr,256,"信道: 912M",cbuf);
else if(cc == 2)
snprintf(timestr,256,"信道: 916M",cbuf);
else if(cc == 3)
snprintf(timestr,256,"信道: 920M",cbuf);
else if(cc == 4)
snprintf(timestr,256,"信道: 自动",cbuf);
colorHnl(osdB6,timestr,show,50,300,colorChn);
}
void CMenuSub1::seventhIdxMenu(char* cbuf,bool show,int colorChn)
{
char timestr[256];
int tt = atoi(cbuf);
snprintf(timestr,256,"传输功率: %d dbm",tt);
colorHnl(osdB7,timestr,show,50,350,colorChn);
}
void CMenuSub1::eightthIdxMenu(char* cbuf,bool show,int colorChn)
{
char timestr[2