コード例 #1
0
        /// <summary>
        /// <param name="accelerometerLow">Lower bound for the accelerometer, any accelerometer above this threshold fires an observation event</param>
        /// <param name="accelerometerHigh">Optional Upper bound, any accelerometer below this threshold and above LowAccelerometer, fires an observe event</param>
        /// </summary>
        public AccelerometerObserver(Guid vehicleId, bool events = false, Accelerometer accelerometerLow = null, Accelerometer accelerometerHigh = null,
                                     ObserverTiming timing       = ObserverTiming.edge)
            : base(ObserverType.Accelerometer,
                   events == true ? typeof(Event) : typeof(Vehicle), // events == true means observe events for a vehicle
                   events == true ? typeof(Vehicle) : null,          // events == false means observe a vehicle
                   timing)
        {
            if (accelerometerLow == null)
            {
                accelerometerLow = new Accelerometer {
                    X = 2.0, Y = 2.0, Z = 2.0
                }
            }
            ;
            if (events)
            {
                ParentId = vehicleId;
            }
            else
            {
                SubjectId = vehicleId;
            }

            SetCondition(accelerometerLow, accelerometerHigh);
        }
コード例 #2
0
        public DiagnosticCodeObserver(Guid vehicleId, bool events = false, string[] diagnosticCodes = null,
                                      ObserverTiming timing       = ObserverTiming.edge)
            : base(ObserverType.Diagnostic,
                   events == true ? typeof(Event) : typeof(Vehicle), // events == true means observe events for a vehicle
                   events == true ? typeof(Vehicle) : null,          // events == false means observe a vehicle
                   timing)
        {
            if (diagnosticCodes == null)
            {
                diagnosticCodes = new string[] { "All" }
            }
            ;

            if (events)
            {
                ParentId = vehicleId;
            }
            else
            {
                SubjectId = vehicleId;
            }

            DiagnosticCodes = diagnosticCodes;
        }
    }
コード例 #3
0
 /// <summary>
 /// The operators can be <, > , <=, >=, ==, !=
 /// <param name="type"></param>
 /// <param name="subject">The</param>
 /// <param name="parent"></param>
 /// <param name="field">The name of the field on the entity where the condition will be applied</param>
 /// </summary>
 public BooleanFieldObserver(Type subject          = null, Guid subjectId = new Guid(),
                             string field          = "Speed",
                             ObserverTiming timing = ObserverTiming.edge
                             )
     : this(subject, subjectId, null, new Guid(),
            field, timing)
 {
 }
コード例 #4
0
 /// <summary>
 /// The operators can be <, > , <=, >=, ==, !=
 /// <param name="type"></param>
 /// <param name="subject">The</param>
 /// <param name="parent"></param>
 /// <param name="field">The name of the field on the entity where the condition will be applied</param>
 /// </summary>
 public BooleanFieldObserver(Type subject = null, Guid subjectId = new Guid(),
     string field = "Speed",
     ObserverTiming timing = ObserverTiming.edge
     )
     : this(subject, subjectId, null, new Guid(),
         field, timing)
 {
 }
コード例 #5
0
 /// <summary>
 /// <param name="accelerationLow">Lower bound for the acceleration, any acceleration above this threshold fires an observation event</param>
 /// <param name="accelerationHigh">Optional Upper bound, any acceleration below this threshold and above LowAcceleration, fires an observe event</param>
 /// </summary>
 public AccelerationObserver(Guid vehicleId, double accelerationLow = 80.0, double?accelerationHigh = null,
                             ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.Acceleration,
            typeof(Vehicle), // events == true means observe events for a vehicle
            null,            // events == false means observe a vehicle
            timing)
 {
     SubjectId = vehicleId;
     SetCondition(accelerationLow, accelerationHigh);
 }
コード例 #6
0
 /// <summary>
 /// <param name="odometerLow">Lower bound for the odometer, any odometer above this threshold fires an observation event</param>
 /// <param name="odometerHigh">Optional Upper bound, any odometer below this threshold and above LowOdometer, fires an observe event</param>
 /// </summary>
 public OdometerObserver(Guid vehicleId, bool events = false, double odometerLow = 80.0, double? odometerHigh = null, 
     ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.Odometer,
             events == true ? typeof(Event) : typeof(Vehicle),  // events == true means observe events for a vehicle
             events == true ? typeof(Vehicle) : null,  // events == false means observe a vehicle
             timing)
 {
     ParentId = vehicleId;
     SetCondition(odometerLow, odometerHigh);
 }
コード例 #7
0
 /// <summary>
 /// <param name="headingLow">Lower bound for the heading, any heading above this threshold fires an observation event</param>
 /// <param name="headingHigh">Optional Upper bound, any heading below this threshold and above LowHeading, fires an observe event</param>
 /// </summary>
 public HeadingObserver(Guid vehicleId, double headingLow = 80.0, double? headingHigh = null,
     ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.Heading,
             typeof(Vehicle),  // events == true means observe events for a vehicle
             null,  // events == false means observe a vehicle
             timing)
 {
     SubjectId = vehicleId;
     SetCondition(headingLow, headingHigh);
 }
コード例 #8
0
 /// <summary>
 /// <param name="distanceLow">Lower bound for the distance, any distance above this threshold fires an observation event</param>
 /// <param name="distanceHigh">Optional Upper bound, any distance below this threshold and above LowDistance, fires an observe event</param>
 /// </summary>
 public DistanceObserver(Guid vehicleId, double distanceLow = 80.0, double? distanceHigh = null,
     ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.Distance,
             typeof(Vehicle),  // events == true means observe events for a vehicle
             null,  // events == false means observe a vehicle
             timing)
 {
     SubjectId = vehicleId;
     SetCondition(distanceLow, distanceHigh);
 }
コード例 #9
0
 /// <summary>
 /// The operators can be <, > , <=, >=, ==, !=
 /// <param name="type"></param>
 /// <param name="subject">The</param>
 /// <param name="parent"></param>
 /// <param name="field">The name of the field on the entity where the condition will be applied</param>
 /// <param name="operator1">Comparitor against the threshold</param>
 /// <param name="threshold1">The threshold</param>
 /// <param name="operator2">Optional second operator for a second threshold</param>
 /// <param name="threshold2">Optional second threshold</param>
 /// <param name="conjunction">Logical operator to combine the two thresholds.</param>
 /// </summary>
 public ConditionalObserver(Type subject = null, Guid subjectId = new Guid(),
     string field="Speed", string operator1=">", double threshold1=80.0,
     ObserverTiming timing = ObserverTiming.edge
     )
     : this(subject, subjectId, null, new Guid(),
         field, operator1, threshold1,
         null, null, null, 
         timing)
 {
 }
コード例 #10
0
 /// <summary>
 /// <param name="fuelLow">Lower bound for the fuel, any fuel above this threshold fires an observation event</param>
 /// <param name="fuelHigh">Optional Upper bound, any fuel below this threshold and above LowFuel, fires an observe event</param>
 /// </summary>
 public FuelLevelObserver(Guid vehicleId, double fuelLow = 80.0, double? fuelHigh = null,
     ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.FuelLevel,
             typeof(Vehicle),  // events == true means observe events for a vehicle
             null,  // events == false means observe a vehicle
             timing)
 {
     SubjectId = vehicleId;
     SetCondition(fuelLow, fuelHigh);
 }
コード例 #11
0
 /// <summary>
 /// The operators can be <, > , <=, >=, ==, !=
 /// <param name="type"></param>
 /// <param name="subject">The</param>
 /// <param name="parent"></param>
 /// <param name="field">The name of the field on the entity where the condition will be applied</param>
 /// <param name="operator1">Comparitor against the threshold</param>
 /// <param name="threshold1">The threshold</param>
 /// <param name="operator2">Optional second operator for a second threshold</param>
 /// <param name="threshold2">Optional second threshold</param>
 /// <param name="conjunction">Logical operator to combine the two thresholds.</param>
 /// </summary>
 public ConditionalObserver(Type subject          = null, Guid subjectId      = new Guid(),
                            string field          = "Speed", string operator1 = ">", double threshold1 = 80.0,
                            ObserverTiming timing = ObserverTiming.edge
                            )
     : this(subject, subjectId, null, new Guid(),
            field, operator1, threshold1,
            null, null, null,
            timing)
 {
 }
コード例 #12
0
ファイル: SpeedObserver.cs プロジェクト: gao1183/Mojio.Client
 /// <summary>
 /// <param name="speedLow">Lower bound for the speed, any speed above this threshold fires an observation event</param>
 /// <param name="speedHigh">Optional Upper bound, any speed below this threshold and above LowSpeed, fires an observe event</param>
 /// </summary>
 public SpeedObserver(Guid vehicleId, double speedLow = 80.0, double? speedHigh = null,
     ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.Speed,
             typeof(Vehicle),  // events == true means observe events for a vehicle
             null,  // events == false means observe a vehicle
             timing)
 {
     SubjectId = vehicleId;
     SetCondition(speedLow, speedHigh);
 }
コード例 #13
0
 /// <summary>
 /// <param name="distanceLow">Lower bound for the distance, any distance above this threshold fires an observation event</param>
 /// <param name="distanceHigh">Optional Upper bound, any distance below this threshold and above LowDistance, fires an observe event</param>
 /// </summary>
 public DistanceObserver(Guid vehicleId, double distanceLow = 80.0, double?distanceHigh = null,
                         ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.Distance,
            typeof(Vehicle), // events == true means observe events for a vehicle
            null,            // events == false means observe a vehicle
            timing)
 {
     SubjectId = vehicleId;
     SetCondition(distanceLow, distanceHigh);
 }
コード例 #14
0
 /// <summary>
 /// <param name="speedLow">Lower bound for the speed, any speed above this threshold fires an observation event</param>
 /// <param name="speedHigh">Optional Upper bound, any speed below this threshold and above LowSpeed, fires an observe event</param>
 /// </summary>
 public SpeedObserver(Guid vehicleId, double speedLow = 80.0, double?speedHigh = null,
                      ObserverTiming timing           = ObserverTiming.edge)
     : base(ObserverType.Speed,
            typeof(Vehicle), // events == true means observe events for a vehicle
            null,            // events == false means observe a vehicle
            timing)
 {
     SubjectId = vehicleId;
     SetCondition(speedLow, speedHigh);
 }
コード例 #15
0
 /// <summary>
 /// <param name="rpmLow">Lower bound for the rpm, any rpm above this threshold fires an observation event</param>
 /// <param name="rpmHigh">Optional Upper bound, any rpm below this threshold and above LowRpm, fires an observe event</param>
 /// </summary>
 public RPMObserver(Guid vehicleId, double rpmLow = 80.0, double?rpmHigh = null,
                    ObserverTiming timing         = ObserverTiming.edge)
     : base(ObserverType.Rpm,
            typeof(Vehicle), // events == true means observe events for a vehicle
            null,            // events == false means observe a vehicle
            timing)
 {
     SubjectId = vehicleId;
     SetCondition(rpmLow, rpmHigh);
 }
コード例 #16
0
 /// <summary>
 /// <param name="accelerationLow">Lower bound for the acceleration, any acceleration above this threshold fires an observation event</param>
 /// <param name="accelerationHigh">Optional Upper bound, any acceleration below this threshold and above LowAcceleration, fires an observe event</param>
 /// </summary>
 public AccelerationObserver(Guid vehicleId, double accelerationLow = 80.0, double? accelerationHigh = null,
     ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.Acceleration,
             typeof(Vehicle),  // events == true means observe events for a vehicle
             null,  // events == false means observe a vehicle
             timing)
 {
     SubjectId = vehicleId;
     SetCondition(accelerationLow, accelerationHigh);
 }
コード例 #17
0
 /// <summary>
 /// <param name="batteryVoltageLow">Lower bound for the batteryVoltage, any batteryVoltage above this threshold fires an observation event</param>
 /// <param name="batteryVoltageHigh">Optional Upper bound, any batteryVoltage below this threshold and above LowBatteryVoltage, fires an observe event</param>
 /// </summary>
 public BatteryVoltageObserver(Guid vehicleId, double batteryVoltageLow = 80.0, double? batteryVoltageHigh = null,
     ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.BatteryVoltage,
             typeof(Vehicle),  // events == true means observe events for a vehicle
             null,  // events == false means observe a vehicle
             timing)
 {
     SubjectId = vehicleId;
     SetCondition(batteryVoltageLow, batteryVoltageHigh);
 }
コード例 #18
0
 /// <summary>
 /// <param name="odometerLow">Lower bound for the odometer, any odometer above this threshold fires an observation event</param>
 /// <param name="odometerHigh">Optional Upper bound, any odometer below this threshold and above LowOdometer, fires an observe event</param>
 /// </summary>
 public OdometerObserver(Guid vehicleId, bool events = false, double odometerLow = 80.0, double?odometerHigh = null,
                         ObserverTiming timing       = ObserverTiming.edge)
     : base(ObserverType.Odometer,
            events == true ? typeof(Event) : typeof(Vehicle), // events == true means observe events for a vehicle
            events == true ? typeof(Vehicle) : null,          // events == false means observe a vehicle
            timing)
 {
     ParentId = vehicleId;
     SetCondition(odometerLow, odometerHigh);
 }
コード例 #19
0
 /// <summary>
 /// <param name="altitudeLow">Lower bound for the altitude, any altitude above this threshold fires an observation event</param>
 /// <param name="altitudeHigh">Optional Upper bound, any altitude below this threshold and above LowAltitude, fires an observe event</param>
 /// </summary>
 public AltitudeObserver(Guid vehicleId, double altitudeLow = 80.0, double? altitudeHigh = null,
     ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.Altitude,
             typeof(Vehicle),  // events == true means observe events for a vehicle
             null,  // events == false means observe a vehicle
             timing)
 {
     SubjectId = vehicleId;
     SetCondition(altitudeLow, altitudeHigh);
 }
コード例 #20
0
 /// <summary>
 /// <param name="altitudeLow">Lower bound for the altitude, any altitude above this threshold fires an observation event</param>
 /// <param name="altitudeHigh">Optional Upper bound, any altitude below this threshold and above LowAltitude, fires an observe event</param>
 /// </summary>
 public AltitudeObserver(Guid vehicleId, double altitudeLow = 80.0, double?altitudeHigh = null,
                         ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.Altitude,
            typeof(Vehicle), // events == true means observe events for a vehicle
            null,            // events == false means observe a vehicle
            timing)
 {
     SubjectId = vehicleId;
     SetCondition(altitudeLow, altitudeHigh);
 }
コード例 #21
0
ファイル: RPMObserver.cs プロジェクト: gao1183/Mojio.Client
 /// <summary>
 /// <param name="rpmLow">Lower bound for the rpm, any rpm above this threshold fires an observation event</param>
 /// <param name="rpmHigh">Optional Upper bound, any rpm below this threshold and above LowRpm, fires an observe event</param>
 /// </summary>
 public RPMObserver(Guid vehicleId, double rpmLow = 80.0, double? rpmHigh = null,
     ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.Rpm,
             typeof(Vehicle),  // events == true means observe events for a vehicle
             null,  // events == false means observe a vehicle
             timing)
 {
     SubjectId = vehicleId;
     SetCondition(rpmLow, rpmHigh);
 }
コード例 #22
0
 /// <summary>
 /// <param name="headingLow">Lower bound for the heading, any heading above this threshold fires an observation event</param>
 /// <param name="headingHigh">Optional Upper bound, any heading below this threshold and above LowHeading, fires an observe event</param>
 /// </summary>
 public HeadingObserver(Guid vehicleId, double headingLow = 80.0, double?headingHigh = null,
                        ObserverTiming timing             = ObserverTiming.edge)
     : base(ObserverType.Heading,
            typeof(Vehicle), // events == true means observe events for a vehicle
            null,            // events == false means observe a vehicle
            timing)
 {
     SubjectId = vehicleId;
     SetCondition(headingLow, headingHigh);
 }
コード例 #23
0
 public BooleanFieldObserver(Type subject = null, Guid subjectId = new Guid(),
     Type parent = null, Guid parentId = new Guid(),
     string field = "Speed", 
     ObserverTiming timing = ObserverTiming.edge
     )
     : base(ObserverType.BooleanField, subject, parent, timing)
 {
     SubjectId = subjectId;
     ParentId = parentId;
     Field = field;
 }
コード例 #24
0
 /// <summary>
 /// <param name="fuelLow">Lower bound for the fuel, any fuel above this threshold fires an observation event</param>
 /// <param name="fuelHigh">Optional Upper bound, any fuel below this threshold and above LowFuel, fires an observe event</param>
 /// </summary>
 public FuelLevelObserver(Guid vehicleId, double fuelLow = 80.0, double?fuelHigh = null,
                          ObserverTiming timing          = ObserverTiming.edge)
     : base(ObserverType.FuelLevel,
            typeof(Vehicle), // events == true means observe events for a vehicle
            null,            // events == false means observe a vehicle
            timing)
 {
     SubjectId = vehicleId;
     SetCondition(fuelLow, fuelHigh);
     SetDefaultThrottle();
 }
コード例 #25
0
 /// <summary>
 /// <param name="batteryVoltageLow">Lower bound for the batteryVoltage, any batteryVoltage above this threshold fires an observation event</param>
 /// <param name="batteryVoltageHigh">Optional Upper bound, any batteryVoltage below this threshold and above LowBatteryVoltage, fires an observe event</param>
 /// </summary>
 public BatteryVoltageObserver(Guid vehicleId, double batteryVoltageLow = 80.0, double?batteryVoltageHigh = null,
                               ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.BatteryVoltage,
            typeof(Vehicle), // events == true means observe events for a vehicle
            null,            // events == false means observe a vehicle
            timing)
 {
     SubjectId = vehicleId;
     SetCondition(batteryVoltageLow, batteryVoltageHigh);
     SetDefaultThrottle();
 }
コード例 #26
0
 public ConditionalObserver(Type subject = null, Guid subjectId = new Guid(),
     string field = "Speed", string operator1 = ">", double threshold1 = 80.0,
     string operator2 = "<", double? threshold2 = 100.0, string conjunction = "and",
     ObserverTiming timing = ObserverTiming.edge
     )
     : this(subject, subjectId, null, new Guid(),
         field, operator1, threshold1,
         operator2, threshold2, conjunction, 
         timing)
 {
 }
コード例 #27
0
 public BooleanFieldObserver(Type subject          = null, Guid subjectId = new Guid(),
                             Type parent           = null, Guid parentId  = new Guid(),
                             string field          = "Speed",
                             ObserverTiming timing = ObserverTiming.edge
                             )
     : base(ObserverType.BooleanField, subject, parent, timing)
 {
     SubjectId = subjectId;
     ParentId  = parentId;
     Field     = field;
 }
コード例 #28
0
 public ConditionalObserver(Type subject          = null, Guid subjectId      = new Guid(),
                            string field          = "Speed", string operator1 = ">", double threshold1    = 80.0,
                            string operator2      = "<", double?threshold2    = 100.0, string conjunction = "and",
                            ObserverTiming timing = ObserverTiming.edge
                            )
     : this(subject, subjectId, null, new Guid(),
            field, operator1, threshold1,
            operator2, threshold2, conjunction,
            timing)
 {
 }
コード例 #29
0
ファイル: EventObserver.cs プロジェクト: gao1183/Mojio.Client
        public EventObserver(Guid vehicleId, EventType[] eventTypes = null, ObserverTiming timing = ObserverTiming.edge)
            : base(ObserverType.Event,
                    typeof(Event),
                    typeof(Vehicle),
                    timing)
        {
            if (eventTypes == null)
                eventTypes = new EventType[] { };

            ParentId = vehicleId;
            EventTypes = eventTypes;
        }
コード例 #30
0
 public ConditionalObserver(Type subject = null, Guid subjectId = new Guid(),
     Type parent = null, Guid parentId = new Guid(),
     string field = "Speed", string operator1 = ">", double threshold1 = 80.0,
     string operator2 = "<", double? threshold2 = 100.0, string conjunction = "and",
     ObserverTiming timing = ObserverTiming.edge
     )
     : base(ObserverType.Conditional, subject, parent, timing)
 {
     SubjectId = subjectId;
     ParentId = parentId;
     SetCondition(field, operator1, threshold1, operator2, threshold2, conjunction);
 }
コード例 #31
0
 /// <summary>
 /// <param name="accelerometerLow">Lower bound for the accelerometer, any accelerometer above this threshold fires an observation event</param>
 /// <param name="accelerometerHigh">Optional Upper bound, any accelerometer below this threshold and above LowAccelerometer, fires an observe event</param>
 /// </summary>
 public AccelerometerObserver(Guid vehicleId, Accelerometer accelerometerLow = null, Accelerometer accelerometerHigh = null,
     ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.Accelerometer,
             typeof(Vehicle),  // events == true means observe events for a vehicle
             null,  // events == false means observe a vehicle
             timing)
 {
     if (accelerometerLow == null)
         accelerometerLow = new Accelerometer { X = 2.0, Y = 2.0, Z = 2.0 };
     SubjectId = vehicleId;
     SetCondition(accelerometerLow, accelerometerHigh);
 }
コード例 #32
0
 public ConditionalObserver(Type subject          = null, Guid subjectId      = new Guid(),
                            Type parent           = null, Guid parentId       = new Guid(),
                            string field          = "Speed", string operator1 = ">", double threshold1    = 80.0,
                            string operator2      = "<", double?threshold2    = 100.0, string conjunction = "and",
                            ObserverTiming timing = ObserverTiming.edge
                            )
     : base(ObserverType.Conditional, subject, parent, timing)
 {
     SubjectId = subjectId;
     ParentId  = parentId;
     SetCondition(field, operator1, threshold1, operator2, threshold2, conjunction);
 }
コード例 #33
0
                /// <summary>
        /// <param name="altitudeLow">Lower bound for the altitude, any altitude above this threshold fires an observation event</param>
        /// <param name="altitudeHigh">Optional Upper bound, any altitude below this threshold and above LowAltitude, fires an observe event</param>
        /// </summary>
        public DiagnosticCodeObserver(Guid vehicleId, string[] diagnosticCodes = null,
            ObserverTiming timing = ObserverTiming.edge)
            : base(ObserverType.Diagnostic,
                    typeof(Vehicle),  // events == true means observe events for a vehicle
                    null,  // events == false means observe a vehicle
                    timing)
        {
            if (diagnosticCodes == null)
                diagnosticCodes = new string[] { "All" };

            SubjectId = vehicleId;
            DiagnosticCodes = diagnosticCodes;
        }
コード例 #34
0
        /// <summary>
        /// <param name="accelerationLow">Lower bound for the acceleration, any acceleration above this threshold fires an observation event</param>
        /// <param name="accelerationHigh">Optional Upper bound, any acceleration below this threshold and above LowAcceleration, fires an observe event</param>
        /// </summary>
        public AccelerationObserver(Guid vehicleId, bool events = false, double accelerationLow = 80.0, double? accelerationHigh = null, 
            ObserverTiming timing = ObserverTiming.edge)
            : base(ObserverType.Acceleration,
                    events == true ? typeof(Event) : typeof(Vehicle),  // events == true means observe events for a vehicle
                    events == true ? typeof(Vehicle) : null,  // events == false means observe a vehicle
                    timing)
        {
            if (events)
                ParentId = vehicleId;
            else
                SubjectId = vehicleId;

            SetCondition(accelerationLow, accelerationHigh);
        }
コード例 #35
0
        /// <summary>
        /// <param name="batteryVoltageLow">Lower bound for the batteryVoltage, any batteryVoltage above this threshold fires an observation event</param>
        /// <param name="batteryVoltageHigh">Optional Upper bound, any batteryVoltage below this threshold and above LowBatteryVoltage, fires an observe event</param>
        /// </summary>
        public BatteryVoltageObserver(Guid vehicleId, bool events = false, double batteryVoltageLow = 80.0, double? batteryVoltageHigh = null, 
            ObserverTiming timing = ObserverTiming.edge)
            : base(ObserverType.BatteryVoltage,
                    events == true ? typeof(Event) : typeof(Vehicle),  // events == true means observe events for a vehicle
                    events == true ? typeof(Vehicle) : null,  // events == false means observe a vehicle
                    timing)
        {
            if (events)
                ParentId = vehicleId;
            else
                SubjectId = vehicleId;

            SetCondition(batteryVoltageLow, batteryVoltageHigh);
        }
コード例 #36
0
        /// <summary>
        /// <param name="distanceLow">Lower bound for the distance, any distance above this threshold fires an observation event</param>
        /// <param name="distanceHigh">Optional Upper bound, any distance below this threshold and above LowDistance, fires an observe event</param>
        /// </summary>
        public DistanceObserver(Guid vehicleId, bool events = false, double distanceLow = 80.0, double? distanceHigh = null, 
            ObserverTiming timing = ObserverTiming.edge)
            : base(ObserverType.Distance,
                    events == true ? typeof(Event) : typeof(Vehicle),  // events == true means observe events for a vehicle
                    events == true ? typeof(Vehicle) : null,  // events == false means observe a vehicle
                    timing)
        {
            if (events)
                ParentId = vehicleId;
            else
                SubjectId = vehicleId;

            SetCondition(distanceLow, distanceHigh);
        }
コード例 #37
0
ファイル: SpeedObserver.cs プロジェクト: gao1183/Mojio.Client
        /// <summary>
        /// <param name="speedLow">Lower bound for the speed, any speed above this threshold fires an observation event</param>
        /// <param name="speedHigh">Optional Upper bound, any speed below this threshold and above LowSpeed, fires an observe event</param>
        /// </summary>
        public SpeedObserver(Guid vehicleId, bool events = false, double speedLow = 80.0, double? speedHigh = null, 
            ObserverTiming timing = ObserverTiming.edge)
            : base(ObserverType.Speed,
                    events == true ? typeof(Event) : typeof(Vehicle),  // events == true means observe events for a vehicle
                    events == true ? typeof(Vehicle) : null,  // events == false means observe a vehicle
                    timing)
        {
            if (events)
                ParentId = vehicleId;
            else
                SubjectId = vehicleId;

            SetCondition(speedLow, speedHigh);
        }
コード例 #38
0
        /// <summary>
        /// <param name="fuelLow">Lower bound for the fuel, any fuel above this threshold fires an observation event</param>
        /// <param name="fuelHigh">Optional Upper bound, any fuel below this threshold and above LowFuel, fires an observe event</param>
        /// </summary>
        public FuelLevelObserver(Guid vehicleId, bool events = false, double fuelLow = 80.0, double? fuelHigh = null, 
            ObserverTiming timing = ObserverTiming.edge)
            : base(ObserverType.FuelLevel,
                    events == true ? typeof(Event) : typeof(Vehicle),  // events == true means observe events for a vehicle
                    events == true ? typeof(Vehicle) : null,  // events == false means observe a vehicle
                    timing)
        {
            if (events)
                ParentId = vehicleId;
            else
                SubjectId = vehicleId;

            SetCondition(fuelLow, fuelHigh);
        }
コード例 #39
0
        public EventObserver(Guid vehicleId, EventType[] eventTypes = null, ObserverTiming timing = ObserverTiming.edge)
            : base(ObserverType.Event,
                   typeof(Event),
                   typeof(Vehicle),
                   timing)
        {
            if (eventTypes == null)
            {
                eventTypes = new EventType[] { }
            }
            ;

            ParentId   = vehicleId;
            EventTypes = eventTypes;
        }
コード例 #40
0
        /// <summary>
        /// <param name="altitudeLow">Lower bound for the altitude, any altitude above this threshold fires an observation event</param>
        /// <param name="altitudeHigh">Optional Upper bound, any altitude below this threshold and above LowAltitude, fires an observe event</param>
        /// </summary>
        public DiagnosticCodeObserver(Guid vehicleId, string[] diagnosticCodes = null,
                                      ObserverTiming timing = ObserverTiming.edge)
            : base(ObserverType.Diagnostic,
                   typeof(Vehicle), // events == true means observe events for a vehicle
                   null,            // events == false means observe a vehicle
                   timing)
        {
            if (diagnosticCodes == null)
            {
                diagnosticCodes = new string[] { "All" }
            }
            ;

            SubjectId       = vehicleId;
            DiagnosticCodes = diagnosticCodes;
        }
コード例 #41
0
 /// <summary>
 /// <param name="accelerometerLow">Lower bound for the accelerometer, any accelerometer above this threshold fires an observation event</param>
 /// <param name="accelerometerHigh">Optional Upper bound, any accelerometer below this threshold and above LowAccelerometer, fires an observe event</param>
 /// </summary>
 public AccelerometerObserver(Guid vehicleId, Accelerometer accelerometerLow = null, Accelerometer accelerometerHigh = null,
                              ObserverTiming timing = ObserverTiming.edge)
     : base(ObserverType.Accelerometer,
            typeof(Vehicle), // events == true means observe events for a vehicle
            null,            // events == false means observe a vehicle
            timing)
 {
     if (accelerometerLow == null)
     {
         accelerometerLow = new Accelerometer {
             X = 2.0, Y = 2.0, Z = 2.0
         }
     }
     ;
     SubjectId = vehicleId;
     SetCondition(accelerometerLow, accelerometerHigh);
 }
コード例 #42
0
        public DiagnosticCodeObserver(Guid vehicleId, bool events = false, string[] diagnosticCodes = null, 
            ObserverTiming timing = ObserverTiming.edge)
            : base(ObserverType.Diagnostic,
                    events == true ? typeof(Event) : typeof(Vehicle),  // events == true means observe events for a vehicle
                    events == true ? typeof(Vehicle) : null,  // events == false means observe a vehicle
                    timing)
        {
            if (diagnosticCodes == null)
                diagnosticCodes = new string[] { "All" };

            if (events)
                ParentId = vehicleId;
            else
                SubjectId = vehicleId; 

            DiagnosticCodes = diagnosticCodes;
        }
コード例 #43
0
        /// <summary>
        /// <param name="speedLow">Lower bound for the speed, any speed above this threshold fires an observation event</param>
        /// <param name="speedHigh">Optional Upper bound, any speed below this threshold and above LowSpeed, fires an observe event</param>
        /// </summary>
        public SpeedObserver(Guid vehicleId, bool events = false, double speedLow = 80.0, double?speedHigh = null,
                             ObserverTiming timing       = ObserverTiming.edge)
            : base(ObserverType.Speed,
                   events == true ? typeof(Event) : typeof(Vehicle), // events == true means observe events for a vehicle
                   events == true ? typeof(Vehicle) : null,          // events == false means observe a vehicle
                   timing)
        {
            if (events)
            {
                ParentId = vehicleId;
            }
            else
            {
                SubjectId = vehicleId;
            }

            SetCondition(speedLow, speedHigh);
        }
コード例 #44
0
        /// <summary>
        /// <param name="accelerationLow">Lower bound for the acceleration, any acceleration above this threshold fires an observation event</param>
        /// <param name="accelerationHigh">Optional Upper bound, any acceleration below this threshold and above LowAcceleration, fires an observe event</param>
        /// </summary>
        public AccelerationObserver(Guid vehicleId, bool events = false, double accelerationLow = 80.0, double?accelerationHigh = null,
                                    ObserverTiming timing       = ObserverTiming.edge)
            : base(ObserverType.Acceleration,
                   events == true ? typeof(Event) : typeof(Vehicle), // events == true means observe events for a vehicle
                   events == true ? typeof(Vehicle) : null,          // events == false means observe a vehicle
                   timing)
        {
            if (events)
            {
                ParentId = vehicleId;
            }
            else
            {
                SubjectId = vehicleId;
            }

            SetCondition(accelerationLow, accelerationHigh);
        }
コード例 #45
0
        /// <summary>
        /// <param name="distanceLow">Lower bound for the distance, any distance above this threshold fires an observation event</param>
        /// <param name="distanceHigh">Optional Upper bound, any distance below this threshold and above LowDistance, fires an observe event</param>
        /// </summary>
        public DistanceObserver(Guid vehicleId, bool events = false, double distanceLow = 80.0, double?distanceHigh = null,
                                ObserverTiming timing       = ObserverTiming.edge)
            : base(ObserverType.Distance,
                   events == true ? typeof(Event) : typeof(Vehicle), // events == true means observe events for a vehicle
                   events == true ? typeof(Vehicle) : null,          // events == false means observe a vehicle
                   timing)
        {
            if (events)
            {
                ParentId = vehicleId;
            }
            else
            {
                SubjectId = vehicleId;
            }

            SetCondition(distanceLow, distanceHigh);
        }
コード例 #46
0
        /// <summary>
        /// <param name="fuelLow">Lower bound for the fuel, any fuel above this threshold fires an observation event</param>
        /// <param name="fuelHigh">Optional Upper bound, any fuel below this threshold and above LowFuel, fires an observe event</param>
        /// </summary>
        public FuelLevelObserver(Guid vehicleId, bool events = false, double fuelLow = 80.0, double?fuelHigh = null,
                                 ObserverTiming timing       = ObserverTiming.edge)
            : base(ObserverType.FuelLevel,
                   events == true ? typeof(Event) : typeof(Vehicle), // events == true means observe events for a vehicle
                   events == true ? typeof(Vehicle) : null,          // events == false means observe a vehicle
                   timing)
        {
            if (events)
            {
                ParentId = vehicleId;
            }
            else
            {
                SubjectId = vehicleId;
            }

            SetCondition(fuelLow, fuelHigh);
            SetDefaultThrottle();
        }
コード例 #47
0
        //public ConditionalObserverBase(Type subject = null, Type parent = null,
        //    ObserverTiming timing = ObserverTiming.edge)
        //    : this(ObserverType.Generic, subject, parent, timing)
        //{
        //}

        public ConditionalObserverBase(ObserverType type, Type subject = null,
                                       Type parent = null, ObserverTiming timing = ObserverTiming.edge)
            : base(type, subject, parent)
        {
            Timing = timing;
        }
コード例 #48
0
 public ConditionalObserverBase(ObserverType type,
                                ObserverTiming timing = ObserverTiming.edge)
     : base(type)
 {
     Timing = timing;
 }
コード例 #49
0
        //public ConditionalObserverBase(Type subject = null, Type parent = null, 
        //    ObserverTiming timing = ObserverTiming.edge)
        //    : this(ObserverType.Generic, subject, parent, timing) 
        //{
        //}

        public ConditionalObserverBase(ObserverType type, Type subject = null, 
            Type parent = null, ObserverTiming timing = ObserverTiming.edge)
            : base(type, subject, parent)
        {
            Timing = timing;
        }
コード例 #50
0
 public ConditionalObserverBase(ObserverType type, 
     ObserverTiming timing = ObserverTiming.edge)
     : base(type)
 {
     Timing = timing;
 }