private DeviceModelMessageSchema GetDeviceModelMessageSchema()
        {
            var schema = new DeviceModelMessageSchema()
            {
                Name   = "chiller-sensors",
                Format = DeviceModelMessageSchemaFormat.JSON,
                Fields = new Dictionary <string, DeviceModelMessageSchemaType>()
                {
                    { "cargotemperature", DeviceModelMessageSchemaType.Double }
                }
            };

            return(schema);
        }
        public DeviceReplayActor(
            ILogger logger,
            IActorsLogger actorLogger,
            IServicesConfig config,
            IEngines engines,
            IInstance instance)
        {
            this.log         = logger;
            this.actorLogger = actorLogger;
            this.instance    = instance;

            this.status            = ActorStatus.None;
            this.deviceModel       = null;
            this.currentLine       = "";
            this.whenToRun         = 0;
            this.prevInterval      = 0;
            this.emptySchema       = new DeviceModelMessageSchema();
            this.replayFileService = new ReplayFileService(config, engines, logger);
        }
Ejemplo n.º 3
0
        // Map service model to API model
        public static DeviceModelTelemetryMessageSchema FromServiceModel(DeviceModelMessageSchema value)
        {
            if (value == null)
            {
                return(null);
            }

            var result = new DeviceModelTelemetryMessageSchema
            {
                Name   = value.Name,
                Format = value.Format.ToString()
            };

            foreach (var field in value.Fields)
            {
                result.Fields.Add(field.Key, field.Value.ToString());
            }

            return(result);
        }
Ejemplo n.º 4
0
        // Map API model to service model
        public static DeviceModelMessageSchema ToServiceModel(DeviceModelTelemetryMessageSchema value)
        {
            if (value == null)
            {
                return(null);
            }

            Enum.TryParse(value.Format, out DeviceModelMessageSchemaFormat format);
            var result = new DeviceModelMessageSchema
            {
                Name   = value.Name,
                Format = format
            };

            foreach (var field in value.Fields)
            {
                Enum.TryParse(field.Value, out DeviceModelMessageSchemaType fieldValue);
                result.Fields.Add(field.Key, fieldValue);
            }

            return(result);
        }
Ejemplo n.º 5
0
 public DeviceModelMessage()
 {
     this.Interval        = TimeSpan.Zero;
     this.MessageTemplate = string.Empty;
     this.MessageSchema   = new DeviceModelMessageSchema();
 }