Exemplo n.º 1
0
        private async Task StartFullSendScheldue(object controllerConnection)
        {
            ControllerPropities controllerPropities = GetControllerPropities();
            var controller = controllerConnection;

            NameValueCollection props = new NameValueCollection {
                { "quartz.serializer.type", "binary" }
            };
            StdSchedulerFactory factory   = new StdSchedulerFactory(props);
            IScheduler          scheduler = await factory.GetScheduler();

            await scheduler.Start();

            JobDataMap keyValuePairs = new JobDataMap();

            keyValuePairs.Add("controllerConnection", controller);


            IJobDetail job = JobBuilder.Create <FullSendScheldue>()
                             .UsingJobData(keyValuePairs)
                             .Build();


            ITrigger trigger = TriggerBuilder.Create()
                               .StartNow()
                               .WithSimpleSchedule(x => x
                                                   .WithIntervalInSeconds(controllerPropities.fludInterval)
                                                   .RepeatForever())
                               .Build();

            await scheduler.ScheduleJob(job, trigger);
        }
Exemplo n.º 2
0
        public static void CreateEmptyControllerPropities(string path)
        {
            ControllerPropities controllerPropities = new ControllerPropities()
            {
                token = "controller-token-here", deviceTvCount = 3, deviceProjectorCount = 2, fludInterval = 10, checkInterval = 0, errorRate = 5, projectorHourRate = 360, reconectTimeOut = 40
            };
            string json = JsonConvert.SerializeObject(controllerPropities);

            Save(json, path);
            //Console.WriteLine(json);
        }
Exemplo n.º 3
0
        public static void TokenAuth(ControllerConnection controllerConnection, bool reconect)
        {
            if (reconect)
            {
                Propities propities = new Propities();
                Thread.Sleep((propities.GetControllerPropities().reconectTimeOut / 2) * 1000);
            }

            Console.WriteLine(DateTime.Now.ToShortTimeString() + " (INFO): SENDING TOKEN");
            Propities           controller          = new Propities();
            ControllerPropities controllerPropities = controller.GetControllerPropities();

            controllerConnection.Send(controllerPropities.token);
        }
Exemplo n.º 4
0
        public static void CreateEmptyProjectorPropities(string path, ControllerPropities controllerPropities)
        {
            uint i = controllerPropities.deviceProjectorCount;
            List <ProjectorDevicePropities> list = new List <ProjectorDevicePropities>();

            do
            {
                list.Add(new ProjectorDevicePropities()
                {
                    deviceId = "device-id-here", status = true, errorCode = GlobalPropities.ErrorCode.None, errorMessage = "ok", input = ProjectorDevicePropities.Input.DVI1, power = ProjectorDevicePropities.Power.True, lamphours = 50, lampStatus = ProjectorDevicePropities.LampStatus.On
                });
                i--;
            }while (i != 0);
            string json = JsonConvert.SerializeObject(list);

            Save(json, path);
            //Console.WriteLine(json);
        }
Exemplo n.º 5
0
        public static void CreateEmptyTVDevicePropities(string path, ControllerPropities controllerPropities)
        {
            uint i = controllerPropities.deviceTvCount;
            List <TVDevicePropities> tvList = new List <TVDevicePropities>();

            do
            {
                tvList.Add(new TVDevicePropities()
                {
                    deviceId = "device-id-here", status = true, errorCode = GlobalPropities.ErrorCode.None, errorMessage = "ok", input = TVDevicePropities.Input.DVI1, power = TVDevicePropities.Power.True, _volume = 50, volumeMute = false
                });
                i--;
            }while (i != 0);
            string json = JsonConvert.SerializeObject(tvList);

            Save(json, path);
            //Console.WriteLine(json);
        }