Exemplo n.º 1
0
    public bool GetCameraList()
    {
        ALLST_GENERIC stHeader = new ALLST_GENERIC((UInt16)CmdNum.CTOS_GETVIDEODATA_MSG, 0);

        byte[] msg;
        msg = StructToBytes(stHeader);
        return(Send(msg));
    }
Exemplo n.º 2
0
    public bool LogoffCMS()
    {
        ALLST_GENERIC stHeader = new ALLST_GENERIC((UInt16)CmdNum.CTOS_LOGINOUT_MSG, 0);

        byte[] msg;
        msg = StructToBytes(stHeader);
        return(Send(msg));
    }
Exemplo n.º 3
0
    public SocketMessage(byte[] fullMsg, int offset, int size)
    {
        // 获取消息头
        ALLST_GENERIC fHeader = SocketData.Parse <ALLST_GENERIC>(fullMsg, offset);

        realHeader = fHeader;
        realMsg    = new byte[fullMsg.Length - offset];
        Buffer.BlockCopy(fullMsg, offset, realMsg, 0, size);
    }
Exemplo n.º 4
0
    public bool CloseCamera(int cameraId, CMS_GUID guid, ReturnCallback CallbackFunction)
    {
        NetworkMsgAnalysis.GetInstance().CloseCameraCallback = CallbackFunction;
        ALLST_GENERIC stHeader = new ALLST_GENERIC((UInt16)CmdNum.CTOS_CLOSECAMERA_MSG, Marshal.SizeOf(typeof(int)) + Marshal.SizeOf(typeof(CMS_GUID)));

        byte[] msg      = new byte[m_iHeaderLen + stHeader.iMessageLen];
        byte[] b_header = StructToBytes(stHeader);
        byte[] b_id     = StructToBytes(cameraId);
        byte[] b_guid   = StructToBytes(guid);
        Buffer.BlockCopy(b_header, 0, msg, 0, m_iHeaderLen);
        Buffer.BlockCopy(b_guid, 0, msg, m_iHeaderLen, b_guid.Length);
        Buffer.BlockCopy(b_id, 0, msg, m_iHeaderLen + b_guid.Length, b_id.Length);
        return(Send(msg));
    }
Exemplo n.º 5
0
    public bool GotoPresetPosition(int cameraId, CMS_GUID guid, UInt16 index, ReturnCallback CallbackFunction)
    {
        NetworkMsgAnalysis.GetInstance().GotoPresetPosCallback = CallbackFunction;
        ALLST_GENERIC            stHeader = new ALLST_GENERIC((UInt16)CmdNum.CTOS_GOTOPREPOSITION_MSG, Marshal.SizeOf(typeof(CTOS_GTOPREPOSITION_INFO)));
        CTOS_GTOPREPOSITION_INFO info     = new CTOS_GTOPREPOSITION_INFO();

        info.cameraId   = cameraId;
        info.camareGuid = guid;
        info.index      = index;
        byte[] msg      = new byte[m_iHeaderLen + stHeader.iMessageLen];
        byte[] b_header = StructToBytes(stHeader);
        byte[] b_info   = StructToBytes(info);
        Buffer.BlockCopy(b_header, 0, msg, 0, m_iHeaderLen);
        Buffer.BlockCopy(b_info, 0, msg, m_iHeaderLen, b_info.Length);
        return(Send(msg));
    }
Exemplo n.º 6
0
    public bool loginToCMS(string name, string passwd, string ip, UInt16 port, UInt16 Protocol, ReturnCallback CallbackFunction)
    {
        NetworkMsgAnalysis.GetInstance().UserLoginCallback = CallbackFunction;
        CTOS_CLIENTLOGIN st = new CTOS_CLIENTLOGIN(name, passwd, ip, port, Protocol);

        ALLST_GENERIC stHeader = new ALLST_GENERIC((UInt16)CmdNum.CTOS_CLIENTLOGIN_MSG, (Int32)Marshal.SizeOf(st));

        byte[] all = new byte[m_iHeaderLen + stHeader.iMessageLen];

        byte[] data1 = StructToBytes(stHeader);
        byte[] data2 = StructToBytes(st);

        Buffer.BlockCopy(data1, 0, all, 0, m_iHeaderLen);
        Buffer.BlockCopy(data2, 0, all, m_iHeaderLen, (int)stHeader.iMessageLen);

        return(Send(all));
    }
Exemplo n.º 7
0
    public bool SetPTZControl(int cameraId, CMS_GUID guid, PTZOperation nCtrlType, UInt16 nSpeedX, UInt16 nSpeedY, UInt16 nSpeedZ, int nPreset, ReturnCallback CallbackFunction)
    {
        NetworkMsgAnalysis.GetInstance().SetPTZCtrlCallback = CallbackFunction;
        CTOS_PTZ_INFO PTZinfo = new CTOS_PTZ_INFO();

        PTZinfo.cameraId   = cameraId;
        PTZinfo.camareGuid = guid;
        PTZinfo.type       = (UInt16)nCtrlType;
        PTZinfo.speedX     = nSpeedX;
        PTZinfo.speedY     = nSpeedY;
        PTZinfo.speedZ     = nSpeedZ;
        PTZinfo.nPreset    = nPreset;
        ALLST_GENERIC stHeader = new ALLST_GENERIC((UInt16)CmdNum.CTOS_SETPTZCTRL_MSG, Marshal.SizeOf(typeof(CTOS_PTZ_INFO)));

        byte[] msg       = new byte[m_iHeaderLen + stHeader.iMessageLen];
        byte[] b_header  = StructToBytes(stHeader);
        byte[] b_PTZinfo = StructToBytes(PTZinfo);
        Buffer.BlockCopy(b_header, 0, msg, 0, m_iHeaderLen);
        Buffer.BlockCopy(b_PTZinfo, 0, msg, m_iHeaderLen, b_PTZinfo.Length);
        return(Send(msg));
    }