Esempio n. 1
0
        public async Task <string> GetGlobalParamAsync(bool usetokencode, string userTokenOrCode, string key)
        {
            Dictionary <string, string> header = null;

            if (usetokencode)
            {
                header = GetTokenHeader(userTokenOrCode);
            }
            else
            {
                header = GetCodeHeader(userTokenOrCode);
            }

            var back = await AutoRetry.RunAsync <ResponseMessage <CmParam> >(() =>
            {
                DefaultParameter param = new DefaultParameter()
                {
                    tool      = "DEFAULT",
                    paramname = key,
                    system    = "INGEST"
                };
                return(PostAsync <ResponseMessage <CmParam> >(
                           string.Format("{0}/CMApi/api/basic/config/getsysparam", CmServerUrl),
                           param, header));
            }).ConfigureAwait(true);

            if (back != null)
            {
                return(back.Ext?.paramvalue);
            }
            return(string.Empty);
        }
Esempio n. 2
0
        public async Task <int> GetUserParamTemplateIDAsync(bool usetokencode, string userTokenOrCode)
        {
            Dictionary <string, string> header = null;

            if (usetokencode)
            {
                header = GetTokenHeader(userTokenOrCode);
            }
            else
            {
                header = GetCodeHeader(userTokenOrCode);
            }

            var back = await AutoRetry.RunAsync <ResponseMessage <CmParam> >(() =>
            {
                DefaultParameter param = new DefaultParameter()
                {
                    tool      = "DEFAULT",
                    paramname = "HIGH_RESOLUTION",
                    system    = "INGEST"
                };
                return(PostAsync <ResponseMessage <CmParam> >(
                           string.Format("{0}/CMApi/api/basic/config/getuserparam", CmServerUrl),
                           param, header));
            }).ConfigureAwait(true);

            if (back != null)
            {
                return(int.Parse(back.Ext?.paramvalue));
            }
            return(0);
        }
Esempio n. 3
0
        public async Task <bool> CompleteSynTasksAsync(int taskid, taskState tkstate, dispatchState dpstate, syncState systate)
        {
            var back = await AutoRetry.RunAsync <ResponseMessage>(() =>
            {
                CompleteSyncTask task = new CompleteSyncTask()
                {
                    DispatchState = (int)dpstate,
                    IsFinish      = false,
                    Perodic2Next  = false,
                    SynState      = (int)systate,
                    TaskID        = taskid,
                    TaskState     = (int)tkstate
                };

                return(PutAsync <ResponseMessage>(
                           //$"{IngestDbUrl}/{TASKAPI20}/completesync",
                           $"{IngestDbUrl}/{TASKAPI30}/sync/complete",
                           task, GetIngestHeader()));
            }).ConfigureAwait(true);

            if (back != null && back.IsSuccess())
            {
                return(true);
            }
            return(false);
        }
Esempio n. 4
0
        public async Task <CMUserInfo> GetUserInfoAsync(bool usetokencode, string userTokenOrCode, string userCode)
        {
            Dictionary <string, string> header = null;

            if (usetokencode)
            {
                header = GetTokenHeader(userTokenOrCode);
            }
            else
            {
                header = GetCodeHeader(userTokenOrCode);
            }


            var back = await AutoRetry.RunAsync <ResponseMessage <CMUserInfo> >(() =>
            {
                NameValueCollection v = new NameValueCollection();
                v.Add("usercode", userCode);
                return(GetAsync <ResponseMessage <CMUserInfo> >(
                           string.Format("{0}/CMApi/api/basic/account/getuserinfobyusercode", CmServerUrl),
                           v, header));
            }).ConfigureAwait(true);

            if (back != null)
            {
                return(back.Ext);
            }
            return(null);
        }
Esempio n. 5
0
        public async Task <List <DeviceInfo> > GetAllDeviceInfoAsync()
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <List <DeviceInfo> > >(() =>
            {
                return(GetAsync <ResponseMessage <List <DeviceInfo> > >(
                           $"{IngestDbUrl}/{DEVICEAPI30}/allocdevice", null, GetIngestHeader()));
            }).ConfigureAwait(true);

            if (back != null)
            {
                return(back.Ext);
            }
            return(null);
        }
Esempio n. 6
0
        public async Task <TaskContent> ReScheduleTaskChannelAsync(int oldtaskid)
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <TaskContent> >(() =>
            {
                return(PutAsync <ResponseMessage <TaskContent> >(
                           $"{IngestDbUrl}/{TASKAPI30}/reschedule/channel/{oldtaskid}", null,
                           GetIngestHeader()));
            }).ConfigureAwait(true);

            if (back != null && back.IsSuccess())
            {
                return(back.Ext);
            }
            return(null);
        }
Esempio n. 7
0
        public async Task <TaskFullInfo> GetTaskFullInfoAsync(int taskid)
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <TaskFullInfo> >(() =>
            {
                return(GetAsync <ResponseMessage <TaskFullInfo> >(
                           $"{IngestDbUrl}/{TASKAPI30}/{taskid}",
                           null, GetIngestHeader()));
            }).ConfigureAwait(true);

            if (back != null)
            {
                return(back.Ext);
            }
            return(null);
        }
Esempio n. 8
0
        public async Task <int> AddReScheduleTaskAsync(int oldtaskid)
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <TaskContent> >(() =>
            {
                return(PostAsync <ResponseMessage <TaskContent> >(
                           $"{IngestDbUrl}/{TASKAPI30}/schedule/{oldtaskid}", null,
                           GetIngestHeader()));
            }).ConfigureAwait(true);

            if (back != null && back.IsSuccess())
            {
                return(back.Ext.TaskId);
            }
            return(0);
        }
Esempio n. 9
0
        public async Task <int> DeleteTaskAsync(int taskid)
        {
            var back = await AutoRetry.RunAsync <ResponseMessage>(() =>
            {
                return(DeleteAsync <ResponseMessage>(
                           //$"{IngestDbUrl}/{TASKAPI20}/delete/{taskid}",
                           $"{IngestDbUrl}/{TASKAPI30}/{taskid}",
                           GetIngestHeader()));
            }).ConfigureAwait(true);

            if (back != null && back.IsSuccess())
            {
                return(taskid);
            }
            return(0);
        }
Esempio n. 10
0
        public async Task <TaskSource> GetTaskSourceByTaskIdAsync(int taskid)
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <TaskSource> >(() =>
            {
                return(GetAsync <ResponseMessage <TaskSource> >(
                           //$"{IngestDbUrl}/{TASKAPI20}/tasksource/{taskid}"
                           $"{IngestDbUrl}/{TASKAPI30}/{taskid}/tasksource"
                           , null, GetIngestHeader()));
            }).ConfigureAwait(true);

            if (back != null)
            {
                return(back.Ext);
            }
            return(TaskSource.emUnknowTask);
        }
Esempio n. 11
0
        public async Task <List <TaskContent> > GetNeedSyncTaskListAsync()
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <List <TaskContent> > >(() => {
                return(GetAsync <ResponseMessage <List <TaskContent> > >(
                           //$"{IngestDbUrl}/{TASKAPI20}/needsync"
                           $"{IngestDbUrl}/{TASKAPI30}/sync/ready"
                           , null, GetIngestHeader()
                           ));
            }).ConfigureAwait(true);

            if (back != null)
            {
                return(back.Ext);
            }
            return(null);
        }
Esempio n. 12
0
        public async Task <TaskContent> CreatePeriodcTaskAsync(int taskid)
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <TaskContent> >(() =>
            {
                return(PostAsync <ResponseMessage <TaskContent> >(
                           //$"{IngestDbUrl}/{TASKAPI20}/periodic/createtask/{taskid}"
                           $"{IngestDbUrl}/{TASKAPI30}/periodic/{taskid}"
                           , null, GetIngestHeader()));
            }).ConfigureAwait(true);

            if (back != null && back.IsSuccess())
            {
                return(back.Ext);
            }
            return(null);
        }
Esempio n. 13
0
        public async Task <bool> UpdateMSVChannelStateAsync(int id, MSV_Mode mode, Device_State state)
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <bool> >(() =>
            {
                return(PostAsync <ResponseMessage <bool> >(
                           //$"{IngestDbUrl}/{DEVICEAPI20}/channelstate/{id}",
                           $"{IngestDbUrl}/{DEVICEAPI30}/channel/{id}/state",
                           new { DevState = state, MSVMode = mode }, GetIngestHeader()));
            }).ConfigureAwait(true);

            if (back != null)
            {
                return(back.Ext);
            }
            return(false);
        }
Esempio n. 14
0
        public async Task <List <ProgrammeInfo> > GetAllProgrammeAsync()
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <List <ProgrammeInfo> > >(() =>
            {
                return(GetAsync <ResponseMessage <List <ProgrammeInfo> > >(
                           //$"{IngestDbUrl}/{DEVICEAPI20}/programme/all"
                           $"{IngestDbUrl}/{DEVICEAPI30}/signal/group"
                           , null, GetIngestHeader()));
            }).ConfigureAwait(true);

            if (back != null)
            {
                return(back.Ext);
            }
            return(null);
        }
Esempio n. 15
0
        public async Task <List <MsvChannelState> > GetAllChannelStateAsync()
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <List <MsvChannelState> > >(() =>
            {
                return(GetAsync <ResponseMessage <List <MsvChannelState> > >(
                           //$"{IngestDbUrl}/{DEVICEAPI20}/channelstate/all"
                           $"{IngestDbUrl}/{DEVICEAPI30}/channel/state"
                           , null, GetIngestHeader()));
            }).ConfigureAwait(true);

            if (back != null)
            {
                return(back.Ext);
            }
            return(null);
        }
Esempio n. 16
0
        public async Task <List <UserLoginInfo> > GetAllUserLoginInfosAsync()
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <List <UserLoginInfo> > >(() =>
            {
                return(GetAsync <ResponseMessage <List <UserLoginInfo> > >(
                           //$"{IngestDbUrl}/{USERAPI20}/userlogininfo/all"
                           $"{IngestDbUrl}/{USERAPI30}/logininfo"
                           , null, GetIngestHeader()
                           ));
            }).ConfigureAwait(true);

            if (back != null)
            {
                return(back.Ext);
            }
            return(null);
        }
Esempio n. 17
0
        public async Task <TaskContent> GetChannelCapturingTaskInfoAsync(int channelid)
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <TaskContent> >(() => {
                NameValueCollection v = new NameValueCollection();
                v.Add("newest", "1");

                return(GetAsync <ResponseMessage <TaskContent> >(
                           $"{IngestDbUrl}/{TASKAPI30}/capturing/{channelid}", v, GetIngestHeader()
                           ));
            }).ConfigureAwait(true);

            if (back != null)
            {
                return(back.Ext);
            }
            return(null);
        }
Esempio n. 18
0
        public async Task <int> SetTaskStateAsync(int taskid, taskState tkstate)
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <int> >(() =>
            {
                NameValueCollection v = new NameValueCollection();
                v.Add("state", ((int)tkstate).ToString());

                return(PutAsync <ResponseMessage <int> >(
                           //$"{IngestDbUrl}/{TASKAPI20}/state/{taskid}"
                           $"{IngestDbUrl}/{TASKAPI30}/{taskid}/state"
                           , null, GetIngestHeader(), v));
            }).ConfigureAwait(true);

            if (back != null && back.IsSuccess())
            {
                return(taskid);
            }
            return(0);
        }
Esempio n. 19
0
        public async Task <bool> SwitchMatrixSignalChannelAsync(int signalid, int channelid)
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <bool> >(() =>
            {
                var query = new NameValueCollection();
                query.Add("signal", signalid.ToString());
                query.Add("channel", channelid.ToString());
                return(GetAsync <ResponseMessage <bool> >(
                           //$"{IngestDbUrl}/{MATRIXAPI20}/switchsignalchannel/",
                           $"{IngestDbUrl}/{MATRIXAPI30}/switch/signalchannel",
                           query,
                           GetIngestHeader()));
            }).ConfigureAwait(true);

            if (back != null && back.IsSuccess())
            {
                return(back.Ext);
            }
            return(false);
        }
Esempio n. 20
0
        public async Task <bool> SwitchMatrixAsync(int inport, int outport)
        {
            var back = await AutoRetry.RunAsync <ResponseMessage <bool> >(() =>
            {
                var query = new NameValueCollection();
                query.Add("inport", inport.ToString());
                query.Add("outport", outport.ToString());
                return(GetAsync <ResponseMessage <bool> >(
                           //$"{IngestDbUrl}/{MATRIXAPI20}/switch/",
                           $"{IngestDbUrl}/{MATRIXAPI30}/switch/",
                           query,
                           GetIngestHeader()));
            }).ConfigureAwait(true);

            if (back != null && back.IsSuccess())
            {
                return(back.Ext);
            }
            return(false);
        }