Exemplo n.º 1
0
        public SteamThing(string name, string description, string identifier, ConnectedThingClient client)
            : base(name, description, identifier, client)
        {
            cp = new Component();
            cp.Connect();
            cp.SetCallBackPeriod();
            cp.WriteDigits(0);

            cp._motionDetector.MotionDetectedCallback += this.MotionEmit;
            cp._rotaryPoti.PositionCallback           += this.RotaryEmit;



            // Data Shape definition that is used by the steam sensor fault event
            // The event only has one field, the message
            var faultFields = new FieldDefinitionCollection();

            faultFields.addFieldDefinition(new FieldDefinition(CommonPropertyNames.PROP_MESSAGE, BaseTypes.STRING));
            base.defineDataShapeDefinition("SteamSensor.Fault", faultFields);

            // Data shape definition that is used by the GetSteamSensorReadings service
            var readingfields = new FieldDefinitionCollection();

            readingfields.addFieldDefinition(new FieldDefinition(SENSOR_NAME_FIELD, BaseTypes.STRING));
            readingfields.addFieldDefinition(new FieldDefinition(ACTIV_TIME_FIELD, BaseTypes.DATETIME));
            readingfields.addFieldDefinition(new FieldDefinition(TEMPERATURE_FIELD, BaseTypes.NUMBER));
            readingfields.addFieldDefinition(new FieldDefinition(PRESSURE_FIELD, BaseTypes.NUMBER));
            readingfields.addFieldDefinition(new FieldDefinition(FAULT_STATUS_FIELD, BaseTypes.BOOLEAN));
            readingfields.addFieldDefinition(new FieldDefinition(INLET_VALVE_FIELD, BaseTypes.BOOLEAN));
            readingfields.addFieldDefinition(new FieldDefinition(TEMPERATURE_LIMIT_FIELD, BaseTypes.NUMBER));
            readingfields.addFieldDefinition(new FieldDefinition(TOTAL_FLOW_FIELD, BaseTypes.INTEGER));
            defineDataShapeDefinition("SteamSensorReadings", readingfields);

            // Populate the thing shape with the properties, services, and events that are annotated in this code
            base.initializeFromAnnotations();
        }
 public SteamThing(string name, string description, string identifier, ConnectedThingClient client)
     : base(name, description, identifier, client)
 {
     // Populate the thing shape with the properties, services, and events that are annotated in this code
     base.initializeFromAnnotations();
 }