diff --git a/examples/19-Television/19-Television.ino b/examples/19-Television/19-Television.ino index f95828a..37a9674 100644 --- a/examples/19-Television/19-Television.ino +++ b/examples/19-Television/19-Television.ino @@ -44,19 +44,21 @@ struct HKTV : Service::Television { active = new Characteristic::Active(); activeIdentifier = new Characteristic::ActiveIdentifier(0); new Characteristic::ConfiguredName("My TV"); -// new Characteristic::PowerModeSelection(); // write-only Characteristic that enables "View TV Settings" on controls screen + new Characteristic::PowerModeSelection(); // write-only Characteristic that enables "View TV Settings" on controls screen new Characteristic::PictureMode(1); new Characteristic::ClosedCaptions(); new Characteristic::Brightness(50); new Characteristic::CurrentMediaState(1); + new Characteristic::TargetMediaState(1); new Characteristic::RemoteKey(); + new Characteristic::SleepDiscoveryMode(1); speaker = new Service::TelevisionSpeaker(); mute = new Characteristic::Mute(); speakerActive = new Characteristic::Active(1); volume = new Characteristic::Volume(); - new Characteristic::VolumeControlType(3); - new Characteristic::VolumeSelector(); + new Characteristic::VolumeControlType(1); + new Characteristic::VolumeSelector(1); hdmi1 = new Service::InputSource(); new Characteristic::ConfiguredName("HDMI 1"); @@ -82,6 +84,7 @@ struct HKTV : Service::Television { addLink(hdmi1); addLink(hdmi2); addLink(netflix); + addLink(speaker); } boolean update(){ @@ -117,9 +120,17 @@ void setup() { new Characteristic::Identify(); new Service::HAPProtocolInformation(); - new Characteristic::Version("1.1.0"); + new Characteristic::Version("1.1.0"); new HKTV(); + + new Service::Speaker(); + new Characteristic::Mute(); +// new Characteristic::Active(1); + new Characteristic::Volume(); +// new Characteristic::VolumeControlType(1); +// new Characteristic::VolumeSelector(1); + } void loop() { diff --git a/src/HomeSpan.cpp b/src/HomeSpan.cpp index e743838..dd7ab1b 100644 --- a/src/HomeSpan.cpp +++ b/src/HomeSpan.cpp @@ -1729,9 +1729,7 @@ StatusCode SpanCharacteristic::loadUpdate(char *val, char *ev){ case STRING: newValue.STRING = (char *)realloc(newValue.STRING, strlen(val) + 1); - strncpy(newValue.STRING, val, strlen(val)); - newValue.STRING[strlen(val)] = '\0'; - + strcpy(newValue.STRING, val); break; default: diff --git a/src/HomeSpan.h b/src/HomeSpan.h index a4f5663..58936ed 100644 --- a/src/HomeSpan.h +++ b/src/HomeSpan.h @@ -309,8 +309,7 @@ struct SpanCharacteristic{ void uvSet(UVal &u, const char *val){ u.STRING = (char *)realloc(u.STRING, strlen(val) + 1); - strncpy(u.STRING, val, strlen(val)); - u.STRING[strlen(val)] = '\0'; + strcpy(u.STRING, val); } char *getString(){