コード例 #1
0
        void Server_ProcNotifyChannelInfo(IntPtr session, IntPtr ptPuId, IntPtr ptPuName, int iStatus, ref BVCU_PUOneChannelInfo channel, int iFinished)
        {
            LogHelper.LogHelper.RecordLog(100, "==========================================");
            string puId          = Marshal.PtrToStringAnsi(ptPuId, BVCU.BVCU_MAX_ID_LEN + 1).Split('\0')[0];
            string puName        = Marshal.PtrToStringAnsi(ptPuName, BVCU.BVCU_MAX_NAME_LEN + 1).Split('\0')[0];
            bool   bNeedClearGps = false;
            bool   bNeedClearTsp = false;

            //如果是设备下线,清除列表中信息,清除接收数据信息
            if (iStatus == BVCU.BVCU_ONLINE_STATUS_OFFLINE)
            {
                m_dialog.clearDialog(puId, channel.iChannelIndex);
                bNeedClearGps = m_dialog.clearGpsDialog(puId, channel.iChannelIndex);
                bNeedClearTsp = m_dialog.clearTspDialog(puId, channel.iChannelIndex);
                m_session.clearGpsDataList(puId, channel.iChannelIndex, bNeedClearGps | bNeedClearTsp);
                m_session.OnRemovePu(puId);
            }

            Channel chnl = new Channel();

            getChannel(chnl, channel, iStatus);
            m_session.OnGetPu(puName, puId, chnl);

            if (BVCU.TRUE(iFinished))
            {
                m_session.OnGetPuListFinished();
            }
            return;
        }
コード例 #2
0
        void Cmd_OnGetPuList(IntPtr session, IntPtr ptPuId, IntPtr ptPuName, int iStatus, ref BVCU_PUOneChannelInfo channel, int iFinished)
        {
            Console.WriteLine("获取设备列表回调执行");
            string puId   = Marshal.PtrToStringAnsi(ptPuId, BVCU.BVCU_MAX_ID_LEN + 1).Split('\0')[0];
            string puName = Marshal.PtrToStringAnsi(ptPuName, BVCU.BVCU_MAX_NAME_LEN + 1).Split('\0')[0];

            Byte[] bpuid   = new Byte[BVCU.BVCU_MAX_ID_LEN + 1];
            Byte[] bpuname = new Byte[BVCU.BVCU_MAX_NAME_LEN + 1];
            Marshal.Copy(ptPuId, bpuid, 0, BVCU.BVCU_MAX_ID_LEN + 1);
            Marshal.Copy(ptPuName, bpuname, 0, BVCU.BVCU_MAX_ID_LEN + 1);
            //设备名称
            string spuid = System.Text.Encoding.UTF8.GetString(bpuid).Split('\0')[0];
            //设备ID
            string spuname = System.Text.Encoding.UTF8.GetString(bpuname).Split('\0')[0];

            //如果获取设备列表结束
            if (BVCU.TRUE(iFinished))
            {
                m_session.OnGetPuListFinished();
            }
            //创建通道
            Channel chnl = new Channel();

            if (iStatus == BVCU.BVCU_ONLINE_STATUS_OFFLINE)
            {
                chnl.online = false;
            }
            else
            {
                chnl.online = true;
            }
            //填入通道信息
            getChannel(chnl, channel, iStatus);
            //修改设备列表,添加设备或添加通道
            m_session.OnGetPu(spuname, spuid, chnl);

            /*if (channel.szName.Equals("gps"))
             * {
             *  chnl = new Session.Channel();
             *  channel.szName = "TSP";
             *  channel.iPTZIndex = 15;
             *  channel.iMediaDir = 32;
             *  channel.iChannelIndex = 65792;
             *  if (iStatus == BVCU.BVCU_ONLINE_STATUS_OFFLINE)
             *  {
             *      chnl.online = false;
             *  }
             *  else
             *  {
             *      chnl.online = true;
             *  }
             *  getChannel(chnl, channel);
             *  m_session.OnGetPu(puName, puId, chnl);
             * }*/
        }