コード例 #1
0
 public static NetworkMsgAnalysis GetInstance()
 {
     if (instance == null)
     {
         instance = new NetworkMsgAnalysis();
     }
     return(instance);
 }
コード例 #2
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));
    }
コード例 #3
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));
    }
コード例 #4
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));
    }
コード例 #5
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));
    }
コード例 #6
0
 private void HandleMessages(SocketMessage sm)
 {
     NetworkMsgAnalysis.GetInstance().Analysis(sm);
 }
コード例 #7
0
 public void GetPassengerFlow(DelPassengerFlow callback)
 {
     NetworkMsgAnalysis.GetInstance().PassengerFlowCallback = callback;
 }