示例#1
0
        public override void OnCommunication(CommunicationEventArgs e)
        {
            base.OnCommunication(e);

            if (e.Data.DirectiveType == DirectiveTypeEnum.Running)
            {
                HandleDeviceStatusChange(new IoStatusChangeEventArgs()
                {
                    DeviceId   = e.DeviceId,
                    DeviceType = e.DeviceType,
                    IoStatus   = e.DeviceStatus,
                    Delta      = 0,
                    Feedback   = e.Data
                });
                var x = e.Data as GasDirectiveData;
                if (x != null)
                {
                    DeviceService.SaveGasRecord(new GasRecord()
                    {
                        CellCultivationId = CultivationService.GetLastCultivationId(),
                        Concentration     = x.Concentration,
                        FlowRate          = x.Flowrate,
                        CreatedAt         = DateTime.Now
                    });
                }

                Center.SyncGasWithServer();
            }
        }
示例#2
0
 private void SaveRecord(bool isManual)
 {
     DeviceService.SavePumpRecord(new PumpRecord()
     {
         CellCultivationId = CultivationService.GetLastCultivationId(),
         DeviceId          = Device.DeviceId,
         StartTime         = StartTime,
         EndTime           = DateTime.Now,
         FlowRate          = Flowrate,
         Volume            = Volume,
         IsManual          = isManual
     });
 }