internal static string GetInitiateDeviceData(string deviceId)
        {
            DeviceProperties device     = new DeviceProperties();
            Thermostat       thermostat = new Thermostat();

            thermostat.ObjectType        = "DeviceInfo";
            thermostat.IsSimulatedDevice = false;
            thermostat.Version           = "1.0";

            device.HubEnabledState = true;
            device.DeviceID        = deviceId;
            device.Manufacturer    = "Microsoft";
            device.ModelNumber     = "Lumia950";
            device.SerialNumber    = "5849735293875";
            device.FirmwareVersion = "10";
            device.Platform        = "Windows 10";
            device.Processor       = "SnapDragon";
            device.InstalledRAM    = "3GB";
            device.DeviceState     = "normal";

            thermostat.DeviceProperties = device;
            Command TriggerAlarm = new Command();

            TriggerAlarm.Name = "TriggerAlarm";
            CommandParameter param = new CommandParameter();

            param.Name = "Message";
            param.Type = "String";
            TriggerAlarm.Parameters = new CommandParameter[] { param };

            Command demoCommand = new Command();

            demoCommand.Name = "DemoCommand";
            CommandParameter demoParam = new CommandParameter();

            demoParam.Name         = "CommandType";
            demoParam.Type         = "String";
            demoCommand.Parameters = new CommandParameter[] { demoParam };

            thermostat.Commands = new Command[] { TriggerAlarm, demoCommand };

            var ret = JsonConvert.SerializeObject(thermostat);

            return(ret);
        }
        internal static string GetInitiateDeviceData(string deviceId)
        {
            DeviceProperties device = new DeviceProperties();
            Thermostat thermostat = new Thermostat();
            thermostat.ObjectType = "DeviceInfo";
            thermostat.IsSimulatedDevice = false;
            thermostat.Version = "1.0";

            device.HubEnabledState = true;
            device.DeviceID = deviceId;
            device.Manufacturer = "BYD";
            device.ModelNumber = "RTU-001";
            device.SerialNumber = "5849735293875";
            device.FirmwareVersion = "10";
            device.Platform = "uC/OS-II";
            device.Processor = "ARM M4";
            device.InstalledRAM = "64 MB";
            device.DeviceState = "normal";

            thermostat.DeviceProperties = device;
            Command TriggerAlarm = new Command();
            TriggerAlarm.Name = "TriggerAlarm";
            CommandParameter param = new CommandParameter();
            param.Name = "Message";
            param.Type = "String";
            TriggerAlarm.Parameters = new CommandParameter[] { param };

            Command demoCommand = new Command();
            demoCommand.Name = "DemoCommand2";
            CommandParameter demoParam = new CommandParameter();
            demoParam.Name = "CommandType";
            demoParam.Type = "String";
            CommandParameter demoParam2 = new CommandParameter();
            demoParam2.Name = "CommandType2";
            demoParam2.Type = "String";
            demoCommand.Parameters = new CommandParameter[] { demoParam, demoParam2 };

            thermostat.Commands = new Command[] { TriggerAlarm, demoCommand };
            thermostat.Telemetry = new TelemetryMember[] {

             new TelemetryMember {
                    Name = "_100",
                    Type = "int",
                    DisplayName = "電壓"
                },
            new TelemetryMember {
                    Name = "_101",
                    Type = "int",
                    DisplayName = "電流"
                },
            new TelemetryMember {
                    Name = "_102",
                    Type = "int",
                    DisplayName = "功率"
                }};
            var ret = JsonConvert.SerializeObject(thermostat);

            return ret;
        }
        internal static string GetInitiateDeviceData(string deviceId)
        {
            DeviceProperties device = new DeviceProperties();
            Thermostat thermostat = new Thermostat();
            thermostat.ObjectType = "DeviceInfo";
            thermostat.IsSimulatedDevice = false;
            thermostat.Version = "1.0";

            device.HubEnabledState = true;
            device.DeviceID = deviceId;
            device.Manufacturer = "Microsoft";
            device.ModelNumber = "Lumia950";
            device.SerialNumber = "5849735293875";
            device.FirmwareVersion = "10";
            device.Platform = "Windows 10";
            device.Processor = "SnapDragon";
            device.InstalledRAM = "3GB";
            device.DeviceState = "normal";

            thermostat.DeviceProperties = device;
            Command TriggerAlarm = new Command();
            TriggerAlarm.Name = "TriggerAlarm";
            CommandParameter param = new CommandParameter();
            param.Name = "Message";
            param.Type = "String";
            TriggerAlarm.Parameters = new CommandParameter[] { param };

            Command demoCommand = new Command();
            demoCommand.Name = "DemoCommand";
            CommandParameter demoParam = new CommandParameter();
            demoParam.Name = "CommandType";
            demoParam.Type = "String";
            demoCommand.Parameters = new CommandParameter[] { demoParam };

            thermostat.Commands = new Command[] { TriggerAlarm, demoCommand };

            var ret = JsonConvert.SerializeObject(thermostat);

            return ret;
        }
Ejemplo n.º 4
0
        internal static string GetInitiateDeviceData(string deviceId)
        {
            DeviceProperties device     = new DeviceProperties();
            Thermostat       thermostat = new Thermostat();

            thermostat.ObjectType        = "DeviceInfo";
            thermostat.IsSimulatedDevice = false;
            thermostat.Version           = "1.0";

            device.HubEnabledState = true;
            device.DeviceID        = deviceId;
            device.Manufacturer    = "BYD";
            device.ModelNumber     = "RTU-001";
            device.SerialNumber    = "5849735293875";
            device.FirmwareVersion = "10";
            device.Platform        = "uC/OS-II";
            device.Processor       = "ARM M4";
            device.InstalledRAM    = "64 MB";
            device.DeviceState     = "normal";

            thermostat.DeviceProperties = device;
            Command TriggerAlarm = new Command();

            TriggerAlarm.Name = "TriggerAlarm";
            CommandParameter param = new CommandParameter();

            param.Name = "Message";
            param.Type = "String";
            TriggerAlarm.Parameters = new CommandParameter[] { param };

            Command demoCommand = new Command();

            demoCommand.Name = "DemoCommand2";
            CommandParameter demoParam = new CommandParameter();

            demoParam.Name = "CommandType";
            demoParam.Type = "String";

            CommandParameter demoParam2 = new CommandParameter();

            demoParam2.Name        = "CommandType2";
            demoParam2.Type        = "String";
            demoCommand.Parameters = new CommandParameter[] { demoParam, demoParam2 };

            CommandParameter demoParam3 = new CommandParameter();

            demoParam3.Name        = "CommandType3";
            demoParam3.Type        = "String";
            demoCommand.Parameters = new CommandParameter[] { demoParam, demoParam2, demoParam3 };

            thermostat.Commands  = new Command[] { TriggerAlarm, demoCommand };
            thermostat.Telemetry = new TelemetryMember[] {
                new TelemetryMember {
                    Name        = "_100",
                    Type        = "int",
                    DisplayName = "電壓"
                },
                new TelemetryMember {
                    Name        = "_101",
                    Type        = "int",
                    DisplayName = "電流"
                },
                new TelemetryMember {
                    Name        = "_102",
                    Type        = "int",
                    DisplayName = "功率"
                }
            };
            var ret = JsonConvert.SerializeObject(thermostat);

            return(ret);
        }