Esempio n. 1
0
        /// <summary>
        /// 分页获取监控点资源
        /// </summary>
        /// <returns></returns>
        public static List <Dictionary <string, object> > GetCameraList()
        {
            try
            {
                List <Dictionary <string, object> > cameraList = new List <Dictionary <string, object> >();
                List <string> cameraNameList = new List <string>();

                Dictionary <string, object> paramMaps = new Dictionary <string, object>();
                paramMaps.Add("pageNo", 1);
                paramMaps.Add("pageSize", 100);

                string uri  = "/artemis/api/resource/v1/camera/advance/cameraList";
                string body = JsonHelper.SerializeObject(paramMaps);

                byte[] resultByte = HttpUtillib.HttpPost(uri, body, 20);
                string resultStr  = Encoding.UTF8.GetString(resultByte);

                Result result = JsonHelper.DeserializeJsonToObject <Result>(resultStr);
                if (result.Code.Equals("0"))
                {
                    ResultData resultData = JsonHelper.DeserializeJsonToObject <ResultData>(result.Data.ToString());
                    return(JsonHelper.DeserializeJsonToObject <List <Dictionary <string, object> > >(resultData.List.ToString()));
                }
            }
            catch { }

            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// 开始预览
        /// </summary>
        /// <returns></returns>
        public bool StartPreview(string cameraCode, IntPtr intptr)
        {
            this.CameraCode = cameraCode;

            try
            {
                int iStreamType = 0; //码流模式,0:主码流  1:子码流
                Dictionary <string, object> paramMaps = new Dictionary <string, object>();
                paramMaps.Add("cameraIndexCode", this.CameraCode);
                paramMaps.Add("streamType", iStreamType);
                paramMaps.Add("protocol", "rtsp");
                paramMaps.Add("transmode", 1);
                paramMaps.Add("expand", "streamform=ps");

                string uri  = "/artemis/api/video/v1/cameras/previewURLs";
                string body = JsonHelper.SerializeObject(paramMaps);

                byte[] resultByte = HttpUtillib.HttpPost(uri, body, 20);
                string resultStr  = Encoding.UTF8.GetString(resultByte);

                Result result = JsonHelper.DeserializeJsonToObject <Result>(resultStr);
                if (result.Code.Equals("0"))
                {
                    Dictionary <string, object> cameraPreviewResult = JsonHelper.DeserializeJsonToObject <Dictionary <string, object> >(result.Data.ToString());
                    m_strURL = cameraPreviewResult["url"].ToString();

                    VIDEO_PLAY_REQ vpr = new VIDEO_PLAY_REQ();
                    vpr.iHardWareDecode = 0;
                    vpr.fnStream        = _pfnStreamCallback;
                    vpr.fnMsg           = _pfnMsgCallback;
                    vpr.fnDecodedStream = _pfnDecodeDataCallback;
                    m_lPlayHandle       = ISCSDK.Video_StartPreview(m_strURL, intptr, ref vpr);

                    return(m_lPlayHandle != -1);
                }
            }
            catch { }

            return(false);
        }
Esempio n. 3
0
        /// <summary>
        /// 获取抓拍图片Url
        /// </summary>
        /// <returns></returns>
        private bool GetCapturePictureUrl()
        {
            Dictionary <string, object> paramMaps = new Dictionary <string, object>();

            paramMaps.Add("cameraIndexCode", this.CameraCode);

            string uri  = "/artemis/api/video/v1/manualCapture";
            string body = JsonHelper.SerializeObject(paramMaps);

            byte[] resultByte = HttpUtillib.HttpPost(uri, body, 20);
            string resultStr  = Encoding.UTF8.GetString(resultByte);

            Result result = JsonHelper.DeserializeJsonToObject <Result>(resultStr);

            if (result.Code.Equals("0"))
            {
                Dictionary <string, object> cameraPreviewResult = JsonHelper.DeserializeJsonToObject <Dictionary <string, object> >(result.Data.ToString());

                m_picURL = cameraPreviewResult["picUrl"].ToString();

                return(true);
            }
            return(false);
        }