예제 #1
0
        private DeviceTypes[] IdentifyDeviceTypes()
        {
            var deviceTypes = new DeviceTypes[NumberOfDevices];

            for (var device = 0; device < NumberOfDevices; device++)
            {
                switch (_blynclightController.GetDeviceType(device))
                {
                case 0x01:
                    deviceTypes[device] = DeviceTypes.BlyncUsb10;
                    break;

                case 0x02:
                    deviceTypes[device] = DeviceTypes.BlyncUsb20;
                    break;

                case 0x03:
                    deviceTypes[device] = DeviceTypes.BlyncUsb30;
                    break;

                case 0x04:
                    deviceTypes[device] = DeviceTypes.BlyncUsb30S;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            return(deviceTypes);
        }
        public async Task publish(int siteId, int DeviceType, int DeviceIndex, string message)
        {
            string topicName = $"hubbub/{siteId}/{DeviceTypes.DeviceName(DeviceType)}{DeviceIndex}/AI";

            byte[] payload_buffer = System.Text.Encoding.UTF8.GetBytes(message);
            MqttApplicationMessage mqttMessage = new MqttApplicationMessageBuilder()
                                                 .WithQualityOfServiceLevel((MQTTnet.Protocol.MqttQualityOfServiceLevel)mqttPublishQos)
                                                 .WithPayload(payload_buffer)
                                                 .WithRetainFlag(mqttIsRetained)
                                                 .WithTopic(topicName)
                                                 .Build();


            try
            {
                var result = await mqttClient.PublishAsync(mqttMessage, token);

                logger.Debug("Message published. Message ID=" + result.PacketIdentifier);
                logger.Debug("Message: " + message);
            }
            catch (Exception e)
            {
                logger.Error(e);
            }
        }
예제 #3
0
 internal WiaDevice(WIA.IDevice device)
 {
     this.DeviceID     = device.DeviceID;
     this.Name         = (string)device.Properties.GetProperty(7);
     this.Manufacturer = (string)device.Properties.GetProperty(3);
     this.Type         = (DeviceTypes)((int)device.Properties.GetProperty(5));
 }
예제 #4
0
        private void OnChangeDeviceType(DeviceTypes deviceType)
        {
            if (ConnectionInfo.CurrentServer != null)
            {
                PacketInfo packetInfo = new PacketInfo();
                packetInfo.PacketType = PacketTypes.DeviceMode;
                packetInfo.DeviceType = deviceType;
                packetInfo.AccessCode = ConnectionInfo.CurrentServer.AccessCode;

                byte[] packet = packetInfo.CachedPacket;
                SocketAsyncEventArgs socketArg = new SocketAsyncEventArgs();
                socketArg.SetBuffer(packet, 0, packet.Length);
                ConnectionInfo.TcpSocket.NoDelay = true;
                ConnectionInfo.TcpSocket.SendAsync(socketArg);

                //데이터 사용량 누적
                if (socketArg.BytesTransferred > 0)
                {
                    AppLoader.CellularDataUtil.SumUsageCellularData(socketArg.BytesTransferred);
                }
            }

            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("DeviceType"));
            }
        }
예제 #5
0
        public MITesScalablePlotter(System.Windows.Forms.Panel aPanel, DeviceTypes aDeviceType, int maxPlots, MITesDecoder aMITesDecoder, Size aSize)
        {
            this.plotAreaSize  = aSize;
            this.aMITesDecoder = aMITesDecoder;
            //this.aTab = aTab;
            this.aPanel   = aPanel;
            this.maxPlots = maxPlots;
            this.columns  = new int[this.maxPlots];
            for (int i = 0; i < this.maxPlots; i++)
            {
                this.columns[i] = 0;
            }
            devType = aDeviceType;
            CheckDeviceType(devType);

            for (int i = 0; i < someIDMappings.Length; i++)
            {
                someIDMappings[i] = MITesData.NONE;
            }

            // Allocate arrays and setup for scaling
            SetupScaleFactor(plotAreaSize, maxPlots);

            InitPlotVals();

            SetPenColors();
            SetAxisOffset();

            ResetIsSeenID();
        }
예제 #6
0
        //앱바의 마우스/터치스크린 버튼 클릭시 해당 모드로 전환처리를 한다.
        void modeAppbarIconBtn_Click(object sender, EventArgs e)
        {
            DeviceTypes deviceType = GetPointingDeviceType(sender as ApplicationBarIconButton);

            PointingControlManager.Instance.DeviceType = deviceType;
            ApplicationBar.IsVisible = false;
        }
예제 #7
0
        protected string DeviceTypeToDataType(DeviceTypes deviceType)
        {
            switch (deviceType)
            {
            case DeviceTypes.atmosphericPressureSensor:
            {
                return("Pres");
            }

            case DeviceTypes.brightnessSensor:
            {
                return("Brig");
            }

            case DeviceTypes.co2Sensor:
            {
                return("Co20");
            }

            case DeviceTypes.humiditySensor:
            {
                return("Humi");
            }

            case DeviceTypes.temperatureSensor:
            {
                return("Temp");
            }

            default:
            {
                return(null);
            }
            }
        }
예제 #8
0
 static void Init()
 {
     if (_type == DeviceTypes.Unknown)
     {
         var deviceInfo = new EasClientDeviceInformation();
         _productName = deviceInfo.SystemProductName;
         if (deviceInfo.SystemProductName.IndexOf("MinnowBoard", StringComparison.OrdinalIgnoreCase) >= 0)
         {
             _type = DeviceTypes.MBM;
         }
         else if (deviceInfo.SystemProductName.IndexOf("Raspberry", StringComparison.OrdinalIgnoreCase) >= 0)
         {
             if (deviceInfo.SystemProductName.IndexOf("Pi 3", StringComparison.OrdinalIgnoreCase) >= 0)
             {
                 _type = DeviceTypes.RPI3;
             }
             else
             {
                 _type = DeviceTypes.RPI2;
             }
         }
         else if (deviceInfo.SystemProductName == "SBC")
         {
             _type = DeviceTypes.DB410;
         }
         else
         {
             _type = DeviceTypes.GenericBoard;
         }
     }
 }
 public MqttDeviceInfoDto(string deviceId, string deviceName, int deviceGroup, DeviceTypes deviceType)
 {
     DeviceType  = deviceType;
     DeviceGroup = deviceGroup;
     DeviceName  = deviceName;
     DeviceId    = deviceId;
 }
예제 #10
0
        /// <summary>
        /// Activates the SteamVRCameraRig and deactivates the OVRCameraRig.
        /// </summary>
        void ActivateSteamVRCameraRig()
        {
            // if the DesktopCameraRig [PuppetJump] is in the scene
            if (GameObject.Find("DesktopCameraRig [PuppetJump]"))
            {
                // deactivate it
                GameObject.Find("DesktopCameraRig [PuppetJump]").SetActive(false);
            }

            // if the OVRCameraRig [PuppetJump] is in the scene
            if (GameObject.Find("OVRCameraRig [PuppetJump]"))
            {
                // deactivate it
                GameObject.Find("OVRCameraRig [PuppetJump]").SetActive(false);
            }

            // if the SteamVRCameraRig [PuppetJump] is in the scene
            if (GameObject.Find("SteamVRCameraRig [PuppetJump]"))
            {
                // activate it
                cameraRig = GameObject.Find("SteamVRCameraRig [PuppetJump]").GetComponent <CameraRig>();
                cameraRig.gameObject.SetActive(true);
            }
            // if the SteamVRCameraRig [PuppetJump] is not in the scene
            else
            {
                // throw error
                Debug.LogError("Please place the SteamVRCameraRig [PuppetJump] prefab in your scene.");
            }

            deviceType = PuppetJumpManager.DeviceTypes.SteamVR;
        }
 public DeviceOptions(string name, string address, DeviceTypes type, bool isOpenOnLoad)
     : base(name)
 {
     Address      = address;
     Type         = type;
     IsOpenOnLoad = isOpenOnLoad;
 }
예제 #12
0
파일: House.cs 프로젝트: Heavik/SmartHouse
        public IList<Device> GetDevices(DeviceTypes deviceTypes)
        {
            var deviceList = from device in devices
                where device.Value.GetType().Name == deviceTypes.GetDescription()
                select device.Value;

            return deviceList.ToList();
        }
 public RequestContext(Guid requestId, DeviceTypes fromDevice, string fromIpAddress, string osVersion, SystemType system)
 {
     RequestId = requestId;
     FromDeviceType = fromDevice;
     FromIpAddress = fromIpAddress;
     OsVersion = osVersion;
     System = system;
 }
예제 #14
0
 public T FindEmulator <T>(DeviceTypes deviceType, string emulator) where T : IEmulator
 {
     return(emulators
            .Where(e => e.Name == emulator)
            .Where(e => e.SupportedDeviceTypes.Contains(deviceType))
            .OfType <T>()
            .First());
 }
예제 #15
0
    public static CardboardProfile GetKnownProfile(ScreenSizes screenSize, DeviceTypes deviceType)
    {
        Screen screen;

        switch (screenSize)
        {
        case ScreenSizes.Nexus6:
            screen = Nexus6;
            break;

        case ScreenSizes.GalaxyS6:
            screen = GalaxyS6;
            break;

        case ScreenSizes.GalaxyNote4:
            screen = GalaxyNote4;
            break;

        case ScreenSizes.LGG3:
            screen = LGG3;
            break;

        case ScreenSizes.iPhone4:
            screen = iPhone4;
            break;

        case ScreenSizes.iPhone5:
            screen = iPhone5;
            break;

        case ScreenSizes.iPhone6:
            screen = iPhone6;
            break;

        case ScreenSizes.iPhone6p:
            screen = iPhone6p;
            break;

        default:
            screen = Nexus5;
            break;
        }
        Device device;

        switch (deviceType)
        {
        case DeviceTypes.CardboardMay2015:
            device = CardboardMay2015;
            break;

        default:
            device = CardboardJun2014;
            break;
        }
        return(new CardboardProfile {
            screen = screen, device = device
        });
    }
예제 #16
0
 public ShutterContactDiff(String Name, Int32 Room_ID, String Room_Name)
 {
     _DeviceType = DeviceTypes.ShutterContact;
     _DeviceName = Name;
     _RoomID     = Room_ID;
     _RoomName   = Room_Name;
     lowBattery  = BatteryStatus.unchanged;
     state       = ShutterContactModes.unchanged;
 }
예제 #17
0
        public async Task Start(string url, DeviceTypes deviceType, string emulator)
        {
            websocket = new ClientWebSocket();
            cancellationTokenSource = new CancellationTokenSource();
            string fullUrl = $"{url}{deviceType.ToString()}/{emulator}";
            await websocket.ConnectAsync(new Uri(fullUrl), cancellationTokenSource.Token);

            ThreadCreator.Create("Device emulator", HandleWebsocket).Start();
        }
예제 #18
0
 private void CheckDeviceType(DeviceTypes aDeviceType)
 {
     if ((aDeviceType != DeviceTypes.PC) &&
         (aDeviceType != DeviceTypes.IPAQ) &&
         (aDeviceType != DeviceTypes.MPX220))
     {
         Error("Unknown device type" + aDeviceType);
     }
 }
예제 #19
0
        public FIPPanel(IntPtr devicePtr, FIPHandler fipHandler) : base(SaitekPanelsEnum.FIP, null)
        {
            _devicePtr  = devicePtr;
            _fipHandler = fipHandler;
            var guidType = Guid.Empty;
            var num      = (int)DirectOutputClass.GetDeviceType(_devicePtr, ref guidType);

            _deviceType = string.Compare(guidType.ToString(), "3E083CD8-6A37-4A58-80A8-3D6A2C07513E", true, CultureInfo.InvariantCulture) == 0 ? DeviceTypes.Fip : DeviceTypes.X52Pro;
        }
예제 #20
0
 public ShutterContactDiff(String Name, Int32 Room_ID, String Room_Name)
 {
     _DeviceType = DeviceTypes.ShutterContact;
     _DeviceName = Name;
     _RoomID = Room_ID;
     _RoomName = Room_Name;
     lowBattery = BatteryStatus.unchanged;
     state = ShutterContactModes.unchanged;
 }
예제 #21
0
 public HeatingThermostatDiff(String Name, Int32 Room_ID, String Room_Name)
 {
     _DeviceType = DeviceTypes.HeatingThermostat;
     _DeviceName = Name;
     _RoomID     = Room_ID;
     _RoomName   = Room_Name;
     lowBattery  = BatteryStatus.unchanged;
     temperature = Double.NaN;
     mode        = ThermostatModes.unchanged;
 }
예제 #22
0
 public HeatingThermostatDiff(String Name, Int32 Room_ID, String Room_Name)
 {
     _DeviceType = DeviceTypes.HeatingThermostat;
     _DeviceName = Name;
     _RoomID = Room_ID;
     _RoomName = Room_Name;
     lowBattery = BatteryStatus.unchanged;
     temperature = Double.NaN;
     mode = ThermostatModes.unchanged;
 }
예제 #23
0
        public static void Initialize(DeviceTypes deviceType)
        {
            MainFrame = deviceType == DeviceTypes.IPhone5 ? MainFrameIPhone5 : MainFrameIPhone;

            TheLeftSideOfMainFrame  = new RectangleF(new PointF(-MainFrame.Width, 0), MainFrame.Size);
            TheRightSideOfMainFrame = new RectangleF(new PointF(MainFrame.Width, 0), MainFrame.Size);

            TheTopOfMainFrame    = new RectangleF(new PointF(0f, -MainFrame.Height), MainFrame.Size);
            TheBottomOfMainFrame = new RectangleF(new PointF(0f, MainFrame.Height), MainFrame.Size);
        }
예제 #24
0
        public static void Initialize(DeviceTypes deviceType)
        {
            MainFrame = deviceType == DeviceTypes.IPhone5 ? MainFrameIPhone5 : MainFrameIPhone;

            TheLeftSideOfMainFrame	= new RectangleF(new PointF(-MainFrame.Width, 0),	MainFrame.Size);
            TheRightSideOfMainFrame	= new RectangleF(new PointF(MainFrame.Width, 0),	MainFrame.Size);

            TheTopOfMainFrame = new RectangleF(new PointF(0f, -MainFrame.Height), MainFrame.Size);
            TheBottomOfMainFrame = new RectangleF(new PointF(0f, MainFrame.Height), MainFrame.Size);
        }
예제 #25
0
        /// <summary>
        /// 解析执法记录仪类型
        /// </summary>
        /// <param name="value"></param>
        public void AnalyzeDeviceTypes(string value)
        {
            App.Current.Dispatcher.Invoke(new Action(() =>
            {
                DeviceTypes deviceTypes = XmlUnityConvert.XmlDeserialize <DeviceTypes>(value);

                if (deviceTypes != null && deviceTypes.DeviceTypeList != null)
                {
                    AppConfigInfos.DeviceTypeList = deviceTypes.DeviceTypeList;
                }
            }));
        }
예제 #26
0
파일: MainForm.cs 프로젝트: kaiiorg/WIG
        private void batchImportButton_Click(object sender, EventArgs e)
        {
            //Clear everything in the plates queue
            while (plates.Count > 0)
            {
                lock (plates)
                {
                    plates.Dequeue();
                }
            }

            //Read in .csv file

            //TEST DATA:
            Random rnd = new Random();

            for (int i = 0; i < 30; ++i)
            {
                Plate tempPlate = new Plate();
                tempPlate.fileNames.Add(string.Format("wallplate_{0}", i + 1));
                for (int j = 1; j <= rnd.Next(1, 10); ++j)
                {
                    tempPlate.count = j;
                    tempPlate.text.Add(string.Format("Sample {0}", j));
                    DeviceTypes d = DeviceTypes.None;
                    switch (rnd.Next(0, 2))
                    {
                    case 0:
                        d = DeviceTypes.Outlet;
                        break;

                    case 1:
                        d = DeviceTypes.Toggle;
                        break;

                    default:
                        d = DeviceTypes.Rocker;
                        break;
                    }
                    tempPlate.deviceTypes.Add(d);
                }
                //Probably don't need to lock it, but just to be safe.
                lock (plates)
                    plates.Enqueue(tempPlate);
            }

            //Enable the start button if the List<Plate> size is > 0
            if (plates.Count > 0)
            {
                batchStartButton.Enabled = true;
            }
        }
        public static List <object> ParseCommand(DeviceTypes deviceType, string commandsLine)
        {
            List <object> result = new List <object>();

            try
            {
                switch (deviceType)
                {
                case (DeviceTypes.Serial):
                    foreach (var item in ParseBytes(commandsLine))
                    {
                        result.Add(item);
                    }
                    break;

                case (DeviceTypes.MKO):
                    foreach (var item in ParseWords(commandsLine))
                    {
                        result.Add(item);
                    }
                    break;

                case (DeviceTypes.NPort):
                    foreach (var item in ParseBytes(commandsLine))
                    {
                        result.Add(item);
                    }
                    break;

                case (DeviceTypes.Keysight):
                    foreach (var item in ParseStrings(commandsLine))
                    {
                        result.Add(item);
                    }
                    break;

                case (DeviceTypes.Multicomponent):
                    break;

                default:
                    result = null;
                    break;
                }
            }
            catch (Exception exception)
            {
                throw CreateThrowUpException(exception);
            }
            return(result);
        }
예제 #28
0
파일: MainForm.cs 프로젝트: kaiiorg/WIG
        //Generate the preview
        private void previewButton_Click(object sender, EventArgs e)
        {
            //Get the comboboxes. They seem to always be in reverse order. This method may go terribily wrong later.
            List <ComboBox> comboBoxes = individualModeDataGroupBox.Controls.OfType <ComboBox>().ToList();

            comboBoxes.Reverse();
            //Get the textboxes. They seem to always be in reverse order. This method may go terribily wrong later.
            List <TextBox> textBoxes = individualModeDataGroupBox.Controls.OfType <TextBox>().ToList();

            textBoxes.Reverse();

            Plate p = new Plate();

            p.count = (int)deviceCountNumericUpDown.Value;

            for (int i = 0; i < deviceCountNumericUpDown.Value; ++i)
            {
                DeviceTypes d = (DeviceTypes)Enum.Parse(typeof(DeviceTypes), comboBoxes[i].SelectedItem.ToString(), true);

                p.deviceTypes.Add(d);
                p.text.Add(textBoxes[i].Text);
            }

            //Delete the current picture and force GC to collect.
            if (previewPictureBox.Image != null)
            {
                previewPictureBox.Image.Dispose();
                GC.Collect();
            }
            if (laserPictureBox.Image != null)
            {
                laserPictureBox.Image.Dispose();
                GC.Collect();
            }

            Image img = new Bitmap(1, 1);

            //Set the preview image and the hidden laser image
            previewPictureBox.Image = Wallplate.renderPreview(
                p.count,
                p.text.ToArray(),
                p.deviceTypes.ToArray(),
                ref img);

            laserPictureBox.Image = img;

            previewPictureBox.BringToFront();
            showPreviewButton.Enabled = false;
            showLaserButton.Enabled   = true;
        }
예제 #29
0
        private DeviceTypes GetDeviceType(IntPtr device)
        {
            Guid        m_guid = Guid.Empty;
            DeviceTypes retVal = DeviceTypes.X52Pro;

            DirectOutputClass.GetDeviceType(device, ref m_guid);

            if (string.Compare(m_guid.ToString(), DirectOutputClass.DeviceTypeFip, true, CultureInfo.InvariantCulture) == 0)
            {
                retVal = DeviceTypes.Fip;
            }

            return(retVal);
        }
예제 #30
0
        public IMappedController Create(string id, string name, DeviceTypes deviceType)
        {
            IMappedController controller = deviceType switch {
                DeviceTypes.MicrosoftXbox360 => new XboxController(),
                DeviceTypes.SonyDualShock4 => new Ds4Controller(),
                _ => throw new NotImplementedException($"Unknown device type {deviceType}"),
            };

            lock (sync)
            {
                controllers.Add(controller);
            }
            return(controller);
        }
예제 #31
0
 private void InitDevices()
 {
     //This should come from server side.
     _device = new DeviceTypes
     {
         DeviceName   = "1",
         DeviceIp     = ConfigurationManager.AppSettings["DeviceIPIN"].ToString(),
         Port         = Convert.ToInt32(ConfigurationManager.AppSettings["Deviceport"].ToString()),
         DeviceType   = "IN",
         BranchId     = -1,
         DeviceId     = 1,
         CommPassword = 123456
     };
 }
예제 #32
0
 protected BaseDevice(
     string sid,
     DeviceTypes type,
     string shortId,
     string name,
     string model,
     IMiCommunication communication)
 {
     Sid            = sid;
     Type           = type;
     ShortId        = shortId;
     Name           = string.IsNullOrWhiteSpace(name) ? sid : name;
     Model          = model;
     _communication = communication;
 }
예제 #33
0
        /// Setup printer object with device settings
        /// </summary>
        /// <param name="deviceTypeName">Type of the device.</param>
        /// <param name="deviceName">Name of the device.</param>
        /// <param name="deviceDescription">The device description.</param>
        public void SetUpPrinter(string deviceTypeName, string deviceName, string deviceDescription)
        {
            DeviceTypes device;

            if (Enum.TryParse <DeviceTypes>(deviceTypeName, out device))
            {
                this.deviceType        = device;
                this.DeviceName        = deviceName;
                this.DeviceDescription = deviceDescription;
            }
            else
            {
                throw new ArgumentException("deviceType");
            }
        }
예제 #34
0
 public void ClearDeviceList(DeviceTypes types)
 {
     if (0 != (types & DeviceTypes.Hid))
     {
         _hid.DeviceList.Clear();
     }
     if (0 != (types & DeviceTypes.Serial))
     {
         _serial.DeviceList.Clear();
     }
     if (0 != (types & DeviceTypes.Ble))
     {
         _ble.DeviceList.Clear();
     }
 }
예제 #35
0
 public static CardboardProfile GetKnownProfile(ScreenSizes screenSize, DeviceTypes deviceType)
 {
     Screen screen;
     switch (screenSize) {
       default:
     screen = Nexus5;
     break;
     }
     Device device;
     switch (deviceType) {
       default:
     device = CardboardV1;
     break;
     }
     return new CardboardProfile { screen = screen, device = device };
 }
예제 #36
0
        public PageReturn PostHandler_HS3_EnOcean(String pPageName, String pCleanName, NameValueCollection pArgs)
        {
            var node_id       = pArgs.Get("configure_node");
            var controller_id = pArgs.Get("controller_id");
            var node_type     = pArgs.Get("device_profile");
            var node_name     = pArgs.Get("node_name");
            var ctrl          = mCore.GetInterfaceById(controller_id);
            var newConfig     = new JObject();

            newConfig["node_name"] = node_name;
            DeviceTypes.CreateDeviceInstance(HS, ctrl, node_id, node_type, newConfig);
            if (ctrl.getSeenDevices().ContainsKey(node_id))
            {
                ctrl.getSeenDevices().Remove(node_id);
            }
            return(new PageReturn("<script>window.location='" + pPageName + "';</script>\n", true));
        }
        /// <summary>
        /// push_msg(Broadcast) 请求参数
        /// </summary>
        /// <param name="deviceType"></param>
        /// <param name="messageType"></param>
        /// <param name="messages"></param>
        /// <param name="msgKeyses"></param>
        public MessagePushBroadcastRequest(
            DeviceTypes? deviceType,
            MessageTypes? messageType,
            IList<string> messages,
            IList<string> msgKeyses
           )
        {
            Method = Methods.push_msg;
            PushType = PushTypes.Broadcast;

            DeviceType = deviceType;

            MessageType = messageType;
            MessageList = messages;
            MessageKeyList = msgKeyses;
            Timestamp = DateTime.Now;
        }
        /// <summary>
        /// push_msg(Tag) 请求参数
        /// Push Message to special TAG
        /// </summary>
        /// <param name="deviceType"></param>
        /// <param name="tag"></param>
        /// <param name="messageType"></param>
        /// <param name="messages"></param>
        /// <param name="msgKeyses"></param>
        public MessagePushTagRequest(
            DeviceTypes? deviceType,
            string tag,
            MessageTypes? messageType,
            IList<string> messages,
            IList<string> msgKeyses
           )
        {
            Method = Methods.push_msg;
            PushType = PushTypes.Tag;

            DeviceType = deviceType;

            Tag = tag;

            MessageType = messageType;
            MessageList = messages;
            MessageKeyList = msgKeyses;
            Timestamp = DateTime.Now;
        }
        /// <summary>
        /// push_msg(Unicast) 请求参数
        /// Push to Special user by channelId and UserId
        /// </summary>
        /// <param name="deviceType"></param>
        /// <param name="channelId"></param>
        /// <param name="userId"></param>
        /// <param name="messageType"></param>
        /// <param name="messages"></param>
        /// <param name="msgKeyses"></param>
        public MessagePushUnicastRequest(
            DeviceTypes? deviceType,
            ulong channelId,
            string userId,
            MessageTypes? messageType,
            IList<string> messages,
            IList<string> msgKeyses
           )
        {
            Method = Methods.push_msg;
            PushType = PushTypes.Unicast;

            DeviceType = deviceType;

            ChannelId = channelId;
            UserId = userId;

            MessageType = messageType;
            MessageList = messages;
            MessageKeyList = msgKeyses;
            Timestamp = DateTime.Now;
        }
예제 #40
0
 /// <summary>
 /// Trouver un type de device
 /// </summary>
 /// <param name="deviceType"></param>
 /// <returns></returns>
 public static DeviceViewModel FindDevice(DeviceTypes deviceType)
 {
     return Devices.FirstOrDefault((d) => d.DeviceType == deviceType);
 }
예제 #41
0
		public HeatingThermostat()
		{
			_Type = DeviceTypes.HeatingThermostat;
		}		
예제 #42
0
		public ShutterContact()
		{
			_Type = DeviceTypes.ShutterContact;
		}		
예제 #43
0
 public UnknownDevice()
 {
     _Type = DeviceTypes.Invalid;
     lastUpdate = DateTime.Now;
 }
예제 #44
0
 public HeatingThermostat()
 {
     _Type = DeviceTypes.HeatingThermostat;
     lastUpdate = DateTime.Now;
 }
예제 #45
0
		public WallMountedThermostat()
		{
			_Type = DeviceTypes.WallMountedThermostat;
		}		
예제 #46
0
		public UnknownDevice()
		{
			_Type = DeviceTypes.Invalid;
		}		
예제 #47
0
        private void ChangeDeviceType(DeviceTypes value)
        {
            // XMLDeviceType is used because the device type stored in XML should never be a type i becuase
            // all type i focusers are capable of reporting their device types.
            DeviceTypes XMLDeviceType = value;

            char setChar;
            if (value == DeviceTypes.TCF_S || value == DeviceTypes.TCF_Si)
            {
                XMLDeviceType = DeviceTypes.TCF_S;
                setChar = '1';
            }
            else
            {
                XMLDeviceType = DeviceTypes.TCF_S3;
                setChar = '3';
            }
            try
            {
                string resp = mySerialCommunicator.SendCommand("FExxx" + setChar, 2000);
                if (resp.Contains("DONE"))
                {
                    deviceType = XMLDeviceType;
                    XMLSettings.DeviceType = XMLDeviceType;
                    XMLSettings.DeviceTypeManuallySet = true;
                    EnterSerialMode();
                }
                else throw new ApplicationException("An error occurred while attempting to set the device type. Incorrect response received from the device.");
            }
            catch (TimeoutException)
            {
                throw new InvalidOperationException("Unable to set the device type. It is likely that your devices firmware is very old and does not support " +
                    "changing the device type.");
            }
        }
예제 #48
0
		public WallMountedThermostat()
		{
			_Type = DeviceTypes.WallMountedThermostat;
			lastUpdate = DateTime.Now;
		}		
예제 #49
0
        static void Main(string[] args)
        {
            MergedLineups merged_lineups = new MergedLineups(ChannelEditing.object_store);
            MergedLineup main_lineup = merged_lineups.ToArray()[1];
            Lineup[] lineups = ChannelEditing.GetLineups();
            foreach (Lineup lineup in lineups)
            {
                if ((lineup.Name == "Scanned (Digital Cable (ClearQAM))") && lineup.ScanDevices.Empty) {
                    foreach (Channel ch in lineup.GetChannels())
                    {
                        lineup.RemoveChannel(ch);
                    }
                    lineup.Unlock();
                }
                if (!lineup.ScanDevices.Empty)
                {
                    lineup.PrimaryProvider = main_lineup;
                }
            }
            foreach (MergedLineup mergedlineup in merged_lineups)
            {
                if (mergedlineup.GetChannels().Count() == 0)
                {
                    mergedlineup.Unlock();
                    //merged_lineups.RemoveAllMatching(mergedlineup);
                }
            }
            Service[] services = new Services(ChannelEditing.object_store).ToArray();
            DeviceGroup[] device_groups = new DeviceGroups(ChannelEditing.object_store).ToArray();
            foreach (DeviceGroup device_group in device_groups)
            {
                Console.WriteLine("DeviceGroup: {0}", device_group.Name);
            }
            Device[] devices = new Devices(ChannelEditing.object_store).ToArray();
            foreach (Device d in devices)
            {
                Console.WriteLine("Device: {0}", d.Name);
            }
            DeviceType[] device_types = new DeviceTypes(ChannelEditing.object_store).ToArray();
            foreach (DeviceType dt in device_types)
            {
                Console.WriteLine("DeviceType: {0} DisplayName: {1} HeadendType: {2} Id: {3} IsSetTopBox: {4} NetworkType: {5} TuningSpaceName: {6} VideoSource: {7} ViewPriority: {8}",
                    dt.Name, dt.DisplayName, dt.HeadendType, dt.Id, dt.IsSetTopBox, dt.NetworkType, dt.TuningSpaceName, dt.VideoSource, dt.ViewPriority);
                Microsoft.MediaCenter.TV.Tuning.TuningSpace tuning_space = dt.TuningSpace;
                if (tuning_space != null)
                {
                    Console.WriteLine("Tuning space CLSID: {0} FriendlyName: {1} UniqueName: {2}", tuning_space.CLSID, tuning_space.FriendlyName, tuning_space.UniqueName);
                }
            }
            foreach (Service service in services)
            {
                Console.WriteLine("Service: {0} IsCached: {1} IsMerged: {2}", service.Name, service.IsCached, service.IsMergedService);
            }
            if (false)
                foreach (Lineup lineup in lineups)
            {
                Console.WriteLine("Lineup: {0} ", lineup.Name);
                if (lineup.DeviceGroup != null)
                {
                    Console.WriteLine("DeviceGroup: {0}", lineup.DeviceGroup.Name);
                    if (lineup.DeviceGroup.Devices != null)
                        foreach(Device d in lineup.DeviceGroup.Devices)
                            Console.WriteLine(d.Name);
                }
                if (lineup.ScanDevices != null)
                    foreach (Device d in lineup.ScanDevices)
                        Console.WriteLine("ScanDevice: {0}", d);
                if (lineup.WmisDevices != null)
                {
                    foreach (Device d in lineup.WmisDevices)
                        Console.WriteLine("WmiDevice: {0}", d);
                    //if (lineup.WmisDevices.Empty && lineup.ScanDevices.Empty)
                        foreach (Channel ch in lineup.GetChannels())
                        {
                            if (ch.Service != null)
                            {
                                Console.WriteLine("Callsign: {0}, CHannelNumber {1}, Service Callsign {2}, Service Name {3}",
                                    ch.CallSign, ch.ChannelNumber, ch.Service.CallSign, ch.Service.Name);
                                if (!ch.Service.ScheduleEntries.Empty)
                                {
                                    foreach (ScheduleEntry entry in ch.Service.ScheduleEntries)
                                    {
                                        if (entry.Program != null)
                                        Console.WriteLine(entry.Program.Title);
                                    }
                                }
                            }
                        }
                }

             /*   foreach (Channel ch in lineup.GetChannels())
                {
                    Console.WriteLine("Channel: {0} Service: {1}", ch.Number, ch.Service);
                } */
            }
            MergedLineup merged_lineup = lineups[0].PrimaryProvider;
            Console.WriteLine("MergedLineup: {0}", merged_lineup);
            if (merged_lineup.SecondaryLineups != null)
                foreach (Lineup lineup in merged_lineup.SecondaryLineups)
                    Console.WriteLine("Secondary Lineup: {0}", lineup.Name);
            Console.ReadLine();
            FavoriteLineups favorite_lineups = new FavoriteLineups(ChannelEditing.object_store);
            foreach (FavoriteLineup favorite in favorite_lineups)
            {
                Console.WriteLine(favorite.Name);
            }
            PackageSubscriptions subscriptions = new PackageSubscriptions(ChannelEditing.object_store);
            foreach (PackageSubscription sub in subscriptions) {
                Console.WriteLine(sub.Package.Description);
            }
        }
 internal static LightSwitchCommand CreateUpdateCmd(string name, string id, string level, DeviceTypes type)
 {
     return new LightSwitchCommand($"UPDATE~{name}~{id}~{level}~{type.ToString()}{Environment.NewLine}");
 }
예제 #51
0
        public List<IDataProvider> ExecuteWithCarId(IEntryPoint entryPoint, Guid userId, string userName,
            string firstName, Guid requestId, string accountNumber, Guid contractId,
            long contractVersion, DeviceTypes fromDevice, string fromIpAddress, string osVersion, SystemType system,
            IEnumerable<RequestFieldDto> requestFieldsDtos, double packageCostPrice, double packageRecommendedPrice, bool hasConsent)
        {
            this.Info(() => "Form LACE Request Initialized for {0}, TimeStamp: {1}".FormatWith(requestId, DateTime.UtcNow));
            var request = FormLaceRequest(userId, userName, firstName, requestId, accountNumber, contractId,
                contractVersion, fromDevice, fromIpAddress, osVersion, system, requestFieldsDtos, packageCostPrice, packageRecommendedPrice,
                hasConsent);
            this.Info(() => "Form LACE Request Completed for {0}, TimeStamp: {1}".FormatWith(requestId, DateTime.UtcNow));

            if (request == null)
                throw new LightstoneAutoException(string.Format("Request cannot be built to Contract with Id {0}", contractId));

            this.Info(() => "EntryPoint Get LACE Response Initialized for {0}, TimeStamp: {1}".FormatWith(requestId, DateTime.UtcNow));
            var responses = entryPoint.GetResponsesForCarId(new[] {request});
            this.Info(() => "EntryPoint Get LACE Response Completed for {0}, TimeStamp: {1}".FormatWith(requestId, DateTime.UtcNow));

            return MapLaceResponses(responses, requestId).ToList();
        }
예제 #52
0
		private void CheckDeviceType(DeviceTypes aDeviceType)
		{
			if ((aDeviceType != DeviceTypes.PC) &&
				(aDeviceType != DeviceTypes.IPAQ) &&
				(aDeviceType != DeviceTypes.MPX220))
			{
				Error("Unknown device type" + aDeviceType);
			}
		}
 public void SetRequestMetadata(DeviceTypes deviceType, SystemType systemType, string fromIpAddress)
 {
     FromIpAddress = fromIpAddress;
     DeviceType = deviceType;
     SystemType = systemType;
 }
예제 #54
0
 public PushButton()
 {
     _Type = DeviceTypes.PushButton;
     lastUpdate = DateTime.Now;
 }
 /// Returns a CardboardProfile with the given parameters.
 public static CardboardProfile GetKnownProfile(ScreenSizes screenSize, DeviceTypes deviceType) {
   Screen screen;
   switch (screenSize) {
     case ScreenSizes.Nexus6:
       screen = Nexus6;
       break;
     case ScreenSizes.GalaxyS6:
       screen = GalaxyS6;
       break;
     case ScreenSizes.GalaxyNote4:
       screen = GalaxyNote4;
       break;
     case ScreenSizes.LGG3:
       screen = LGG3;
       break;
     case ScreenSizes.iPhone4:
       screen = iPhone4;
       break;
     case ScreenSizes.iPhone5:
       screen = iPhone5;
       break;
     case ScreenSizes.iPhone6:
       screen = iPhone6;
       break;
     case ScreenSizes.iPhone6p:
       screen = iPhone6p;
       break;
     default:
       screen = Nexus5;
       break;
   }
   Device device;
   switch (deviceType) {
     case DeviceTypes.CardboardMay2015:
       device = CardboardMay2015;
       break;
     case DeviceTypes.GoggleTechC1Glass:
       device = GoggleTechC1Glass;
       break;
     default:
       device = CardboardJun2014;
       break;
   }
   return new CardboardProfile { screen = screen, device = device };
 }
예제 #56
0
 // Create a SoundDevice class for a specific device type
 static SoundDeviceVolume()
 {
     _type = DeviceTypes.Wave;
 }
                {
                    return this._rotation;
                }
            }

            /// <summary>
            /// 获取或设置物件的缩放程度
예제 #58
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="aForm"></param>
		/// <param name="aDeviceType"></param>
		/// <param name="maxPlots"></param>
		/// <param name="aMITesDecoder"></param>
		/// <param name="aSize"></param>
		public MITesScalablePlotter(System.Windows.Forms.Panel aPanel, DeviceTypes aDeviceType, int maxPlots, MITesDecoder aMITesDecoder, Size aSize)
		{
			this.plotAreaSize = aSize; 
			this.aMITesDecoder = aMITesDecoder;
			//this.aTab = aTab;
            this.aPanel = aPanel;
			this.maxPlots = maxPlots;
			devType = aDeviceType; 
			CheckDeviceType(devType);

			for (int i = 0; i < someIDMappings.Length; i++)
				someIDMappings[i] = MITesData.NONE; 

			// Allocate arrays and setup for scaling 
			SetupScaleFactor(plotAreaSize, maxPlots);

			InitPlotVals();

			SetPenColors();
			SetAxisOffset();

			ResetIsSeenID();

		}
예제 #59
0
        private IPointToLaceRequest FormLaceRequest(Guid userId, string userName, string firstName, Guid requestId, string accountNumber,
            Guid contractId, long contractVersion, DeviceTypes fromDevice, string fromIpAddress, string osVersion, SystemType system,
            IEnumerable<RequestFieldDto> requestFieldsDtos, double packageCostPrice, double packageRecommendedPrice, bool hasConsent)
        {
            if (DataProviders == null)
                return null;

            var dataProviders = DataProviders;
            if (!hasConsent)
                dataProviders = DataProviders.Where(dp => !dp.RequiresConsent);

            dataProviders = dataProviders.Where(fld => fld.DataFields.Filter(x => x.IsSelected == true).Any());
            var laceProviders = new List<IAmDataProvider>();
            var fields = Mapper.Map<IEnumerable<RequestFieldDto>, IEnumerable<DataField>>(requestFieldsDtos);

            var user = new User(userId, userName, firstName);
            var requestTypes = new RequestTypeBuilder();

            foreach (var dataProvider in dataProviders.ToList())
            {
                //var selectedfields = dataProvider.RequestFields.Filter(x => x.IsSelected == true); // todo: Validate & compare to api request fields 
                var requestFields = Mapper.Map<IEnumerable<IDataField>, IEnumerable<IAmRequestField>>(fields);
                laceProviders.Add(new LaceDataProvider(dataProvider.Name, requestFields, dataProvider.CostOfSale, RecommendedSalePrice, user, Name,requestTypes));
            }

            var request = new LaceRequest(
                user,
                new Contract(contractVersion, accountNumber, contractId),
                new RequestPackage(laceProviders.ToArray(), Id, Name, (long) DisplayVersion, packageCostPrice, packageRecommendedPrice),
                new RequestContext(requestId, fromDevice, fromIpAddress, osVersion, system),
                DateTime.UtcNow);

            return request;
        }
예제 #60
0
 public ShutterContact()
 {
     _Type = DeviceTypes.ShutterContact;
     lastUpdate = DateTime.Now;
 }