Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Panasonic Viera TV remote control #2137

Closed
wants to merge 2 commits into from

Conversation

slaff
Copy link
Contributor

@slaff slaff commented Nov 3, 2020

A library and sample application that allows you to control a Panasonic Viera TV directly from an embedded device using Sming.

This PR should be merged AFTER #2136.

@slaff slaff added this to the 4.2.0 milestone Nov 3, 2020
@mikee47
Copy link
Contributor

mikee47 commented Nov 5, 2020

@slaff I'm thinking perhaps this and #2136 should be submodules in external repo?

@slaff
Copy link
Contributor Author

slaff commented Nov 5, 2020

@slaff I'm thinking perhaps this and #2136 should be submodules in external repo?

I agree with you. Would it be possible to review the DIAL PR and this one and if it looks good to you I will put them in separate repo, similar to Sming-UPnP and Sming-SSDP ?

Note to myself - we are coming close to a recommended file structure for external Sming Libraries. I should spend some time to create a travis.yml template that can be reused in the different external Sming libraries to test / demo the code.

Probably we should also create a make -C $SMING_HOME sample-app target in the Sming Library that bootstraps a sample Sming based application and make -C $SMING_HOME sample-lib for a Library.

@mikee47
Copy link
Contributor

mikee47 commented Nov 5, 2020

@slaff I've pushed changes to SSDP and UPnP libraries (develop branch) to ensure consistent use of strong enums thoughout. MessageSpec is now managed using methods, and you'll need to update types, e.g. SSDP::TARGET_ROOT -> SSDP::SearchTarget::root.

@mikee47
Copy link
Contributor

mikee47 commented Nov 5, 2020

@slaff I'm thinking perhaps this and #2136 should be submodules in external repo?

I agree with you. Would it be possible to review the DIAL PR and this one and if it looks good to you I will put them in separate repo, similar to Sming-UPnP and Sming-SSDP ?

Will do.

Note to myself - we are coming close to a recommended file structure for external Sming Libraries. I should spend some time to create a travis.yml template that can be reused in the different external Sming libraries to test / demo the code.

Also I think a template for such an external library with boiler plate stuff like README.rst, directory structure, default component.mk, .gitignore, .cs, etc. I can take care of that one?

Probably we should also create a make -C $SMING_HOME sample-app target in the Sming Library that bootstraps a sample Sming based application and make -C $SMING_HOME sample-lib for a Library.

Good idea. make fetch is probably a good starting point?

@slaff
Copy link
Contributor Author

slaff commented Nov 5, 2020

I can take care of that one? ... make fetch is probably a good starting point

This would be awesome 👍

@slaff slaff changed the title Panasonic Viera TV remote control [WIP] Panasonic Viera TV remote control Nov 7, 2020
Copy link
Contributor

@mikee47 mikee47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slaff I've done a refactor of this and pushed it to my repo https://github.com/mikee47/Sming/tree/feature/panasonic-tv-remote.

Can't test it but it compiles.

I've changed the Client::Connected callback type from (1) to (2) below.

using Connected = Delegate<void(Client& client, HttpConnection& connection, const XML::Document& description)>; // (1)
using Connected = Delegate<void(HttpConnection& connection, const XML::Document& description)>; // (2)

I'm leaning towards (2) for a couple of reasons. First, it's simpler, and secondly for the client parameter to be useful it may have to be up-cast. In practice it's easier to use a lambda to capture the required parameters instead. In your sample application client is a global so isn't required anyway, which supports my argument in that the application decides how to track it.

Another funny in your code is you've done (bool)node->getValue() and (int)node->getValue() which doesn't make sense; I've replaced these with calls to atoi() assuming they're numeric strings.

@slaff
Copy link
Contributor Author

slaff commented Nov 24, 2020

Once PR #2154 is merged this PR should be reworked and turned into a sample-application-only targeting Panasonic Viera TVs and explaining in more details the different steps needed to

  • scan and extract the XML files from your UPnP device.
  • generate code from the XML files.
  • use that code to mute the TV, change a channel, get the mute state, etc.

@slaff slaff closed this Nov 24, 2020
@slaff slaff removed this from the 4.2.0 milestone Nov 24, 2020
@slaff slaff removed the 3 - Review label Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants