Exemple #1
0
        public int AddDevice(AcDeviceDto deviceDto)
        {
            var device = new ACDevice()
            {
                Id    = deviceDto.Id,
                Brand = deviceDto.Brand,
                Model = deviceDto.Model,

                //fixed values, because other devices are not supported at this moment
                DutyCycle = 0.5,
                ModulationFrequencyInHz = 38000
            };

            return(AddDevice(device));
        }
Exemple #2
0
        public async Task <IActionResult> Register([Bind("SerialNumber,FirmwareVersion")][FromBody] ACDevice device)
        {
            var newDevice = await _apiService.RegisterDevice(device.SerialNumber, device.FirmwareVersion);

            return(Json(new
            {
                response = "success",
                device = new
                {
                    SerialNumber = newDevice.SerialNumber,
                    FirmwareVersion = newDevice.FirmwareVersion,
                    RegistrationDate = newDevice.RegistrationDate,
                    AccessKey = newDevice.AccessKey
                }
            }));
        }