Updated prior Examples and eliminated ServiceType
This commit is contained in:
parent
fa8c5934ea
commit
7d8a91f13b
|
|
@ -10,7 +10,7 @@ struct DEV_Identify : Service::AccessoryInformation {
|
||||||
|
|
||||||
// NEW! modified constructor() method to include optional ServiceType argument
|
// NEW! modified constructor() method to include optional ServiceType argument
|
||||||
|
|
||||||
DEV_Identify(char *name, char *manu, char *sn, char *model, char *version, int nBlinks, ServiceType sType=ServiceType::Regular) : Service::AccessoryInformation(sType){
|
DEV_Identify(char *name, char *manu, char *sn, char *model, char *version, int nBlinks) : Service::AccessoryInformation(){
|
||||||
|
|
||||||
new Characteristic::Name(name); // create all the required Characteristics with values set based on above arguments
|
new Characteristic::Name(name); // create all the required Characteristics with values set based on above arguments
|
||||||
new Characteristic::Manufacturer(manu);
|
new Characteristic::Manufacturer(manu);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ struct DEV_TempSensor : Service::TemperatureSensor { // A standalone Tempera
|
||||||
|
|
||||||
SpanCharacteristic *temp; // reference to the Current Temperature Characteristic
|
SpanCharacteristic *temp; // reference to the Current Temperature Characteristic
|
||||||
|
|
||||||
DEV_TempSensor(ServiceType sType=ServiceType::Regular) : Service::TemperatureSensor(sType){ // constructor() method
|
DEV_TempSensor() : Service::TemperatureSensor(){ // constructor() method
|
||||||
|
|
||||||
// First we instantiate the main Characteristic for a Temperature Sensor, namely the Current Temperature, and set its initial value
|
// First we instantiate the main Characteristic for a Temperature Sensor, namely the Current Temperature, and set its initial value
|
||||||
// to 20 degrees. For a real sensor, we would take a reading and initialize it to that value instead. NOTE: HomeKit uses
|
// to 20 degrees. For a real sensor, we would take a reading and initialize it to that value instead. NOTE: HomeKit uses
|
||||||
|
|
@ -64,7 +64,7 @@ struct DEV_AirQualitySensor : Service::AirQualitySensor { // A standalone Ai
|
||||||
SpanCharacteristic *o3Density; // reference to the Ozone Density Characteristic, which is a float from 0 to 1000
|
SpanCharacteristic *o3Density; // reference to the Ozone Density Characteristic, which is a float from 0 to 1000
|
||||||
SpanCharacteristic *no2Density; // reference to the Nitrogen Dioxide Characteristic, which is a float from 0 to 1000
|
SpanCharacteristic *no2Density; // reference to the Nitrogen Dioxide Characteristic, which is a float from 0 to 1000
|
||||||
|
|
||||||
DEV_AirQualitySensor(ServiceType sType=ServiceType::Regular) : Service::AirQualitySensor(sType){ // constructor() method
|
DEV_AirQualitySensor() : Service::AirQualitySensor(){ // constructor() method
|
||||||
|
|
||||||
airQuality=new Characteristic::AirQuality(1); // instantiate the Air Quality Characteristic and set initial value to 1
|
airQuality=new Characteristic::AirQuality(1); // instantiate the Air Quality Characteristic and set initial value to 1
|
||||||
o3Density=new Characteristic::OzoneDensity(300.0); // instantiate the Ozone Density Characteristic and set initial value to 300.0
|
o3Density=new Characteristic::OzoneDensity(300.0); // instantiate the Ozone Density Characteristic and set initial value to 300.0
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ struct DEV_GarageDoor : Service::GarageDoorOpener { // A Garage Door Opener
|
||||||
SpanCharacteristic *target; // reference to the Target Door State Characteristic (specific to Garage Door Openers)
|
SpanCharacteristic *target; // reference to the Target Door State Characteristic (specific to Garage Door Openers)
|
||||||
SpanCharacteristic *obstruction; // reference to the Obstruction Detected Characteristic (specific to Garage Door Openers)
|
SpanCharacteristic *obstruction; // reference to the Obstruction Detected Characteristic (specific to Garage Door Openers)
|
||||||
|
|
||||||
DEV_GarageDoor(ServiceType sType=ServiceType::Regular) : Service::GarageDoorOpener(sType){ // constructor() method
|
DEV_GarageDoor() : Service::GarageDoorOpener(){ // constructor() method
|
||||||
|
|
||||||
current=new Characteristic::CurrentDoorState(1); // initial value of 1 means closed
|
current=new Characteristic::CurrentDoorState(1); // initial value of 1 means closed
|
||||||
target=new Characteristic::TargetDoorState(1); // initial value of 1 means closed
|
target=new Characteristic::TargetDoorState(1); // initial value of 1 means closed
|
||||||
|
|
@ -69,7 +69,7 @@ struct DEV_WindowShade : Service::WindowCovering { // A motorized Window Sha
|
||||||
SpanCharacteristic *current; // reference to a "generic" Current Position Characteristic (used by a variety of different Service)
|
SpanCharacteristic *current; // reference to a "generic" Current Position Characteristic (used by a variety of different Service)
|
||||||
SpanCharacteristic *target; // reference to a "generic" Target Position Characteristic (used by a variety of different Service)
|
SpanCharacteristic *target; // reference to a "generic" Target Position Characteristic (used by a variety of different Service)
|
||||||
|
|
||||||
DEV_WindowShade(ServiceType sType=ServiceType::Regular) : Service::WindowCovering(sType){ // constructor() method
|
DEV_WindowShade() : Service::WindowCovering(){ // constructor() method
|
||||||
|
|
||||||
current=new Characteristic::CurrentPosition(0); // Windows Shades have positions that range from 0 (fully lowered) to 100 (fully raised)
|
current=new Characteristic::CurrentPosition(0); // Windows Shades have positions that range from 0 (fully lowered) to 100 (fully raised)
|
||||||
new SpanRange(0,100,10); // set the allowable current-position range to 0-100 IN STEPS of 10
|
new SpanRange(0,100,10); // set the allowable current-position range to 0-100 IN STEPS of 10
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ struct DEV_Identify : Service::AccessoryInformation {
|
||||||
|
|
||||||
// NEW! modified constructor() method to include optional ServiceType argument
|
// NEW! modified constructor() method to include optional ServiceType argument
|
||||||
|
|
||||||
DEV_Identify(char *name, char *manu, char *sn, char *model, char *version, int nBlinks, ServiceType sType=ServiceType::Regular) : Service::AccessoryInformation(sType){
|
DEV_Identify(char *name, char *manu, char *sn, char *model, char *version, int nBlinks) : Service::AccessoryInformation(){
|
||||||
|
|
||||||
new Characteristic::Name(name); // create all the required Characteristics with values set based on above arguments
|
new Characteristic::Name(name); // create all the required Characteristics with values set based on above arguments
|
||||||
new Characteristic::Manufacturer(manu);
|
new Characteristic::Manufacturer(manu);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ struct DEV_Identify : Service::AccessoryInformation {
|
||||||
int nBlinks; // number of times to blink built-in LED in identify routine
|
int nBlinks; // number of times to blink built-in LED in identify routine
|
||||||
SpanCharacteristic *identify; // reference to the Identify Characteristic
|
SpanCharacteristic *identify; // reference to the Identify Characteristic
|
||||||
|
|
||||||
DEV_Identify(char *name, char *manu, char *sn, char *model, char *version, int nBlinks, ServiceType sType=ServiceType::Regular) : Service::AccessoryInformation(sType){
|
DEV_Identify(char *name, char *manu, char *sn, char *model, char *version, int nBlinks) : Service::AccessoryInformation(){
|
||||||
|
|
||||||
new Characteristic::Name(name); // create all the required Characteristics with values set based on above arguments
|
new Characteristic::Name(name); // create all the required Characteristics with values set based on above arguments
|
||||||
new Characteristic::Manufacturer(manu);
|
new Characteristic::Manufacturer(manu);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED
|
||||||
|
|
||||||
// NEW! Consructor includes 3 additionl arguments to specify pin numbers for power, raise, and lower buttons
|
// NEW! Consructor includes 3 additionl arguments to specify pin numbers for power, raise, and lower buttons
|
||||||
|
|
||||||
DEV_DimmableLED(int channel, int ledPin, int powerPin, int raisePin, int lowerPin, ServiceType sType=ServiceType::Regular) : Service::LightBulb(sType){
|
DEV_DimmableLED(int channel, int ledPin, int powerPin, int raisePin, int lowerPin) : Service::LightBulb(){
|
||||||
|
|
||||||
power=new Characteristic::On();
|
power=new Characteristic::On();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue