Closed gvdhoven closed 6 years ago
That's a good question. Correct me if I'm wrong, you're implementing the CBL/SAT driver using all 9 digits. I'm guessing you use either type DVB or TUNNER for the device. That lets you use the favorites interface in the app where you can select the channel numbers. Let's say you add a favorite with "234" on the SDK side the button handler is called 3 times:
Currently I think it's not possible on the SDK to tell if a set of digit commands are coming from a favorites action on the Brain. We can implement some changes to make this possible but this can do in different directions.
Option A. One way to add a postfix command would be to register these with the SDK driver. For example .addFavoritePostfixCommand('OK')
. This would make it work similar to the way we handle infrared devices. The Brain would know if sending favorites to add "OK" at the end:
Option B. Instead of relaying favorite commands one by one, we handle them similar to a list defined by the SDK as it's favorites using perhaps custom images, then it would be handled through a separate callback maybe .addFavorites({ getter: () => {}, handler: () => {}})
This would be the same approach as mentioned in https://github.com/NEEOInc/neeo-sdk/issues/52
It might be more useful for devices that have their own favorites like a streaming device or device with built in apps and such, it's more flexible since favorites don't have to be numbers but it might be more difficult to setup and might require more work to integrate the interface to add/remove favorites.
I'd like it better if one solution would cover all use cases, but I don't see how Option B can be merged into A. Though maybe there's a way to make Option B easily cover A (but i'm not sure if that would cause a breaking change in the SDK API).
Let's say we go with Option B but we can keep the default channel results, so in the interface the user adds the channel, but on the SDK instead of the button handle you get a callback with the favorite digits as a string "234"
handle them as you will (split, and send follow up commands) would that work?
@pfiaux I also agree that option B would be least destructive and gives most flexibility for future expansion.
I updated https://github.com/NEEOInc/neeo-sdk/issues/52 with the options we discussed here. If you want to add details can you do it there? This way we have a single issue on the topic.
Apparently, Andy can configure certain devices in the Neeo DB to send an "OK" or "RETURN" command after a favorite has been chosen, in order to make channel switching near instant (for discussion see here: https://planet.neeo.com/t/k9r3nz)
The question i have is, if we write our own driver (like my CBL/SAT driver) how can i either tell the NeeoSDK in my build driver definition to send an additional command in case of favorites, or how can i know in code if a favorite has been chosen?