1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Hyperion/HyperCon Android Development

Discussion in 'Development' started by BioHaZard1, 8 July 2016.

  1. BioHaZard1

    BioHaZard1 New Member Developer

    Messages:
    26
    Hardware:
    RPi2, RPi3, 32/64bit, +Arduino
    Hi, over the past 2 weeks I have been building a Hyperion, native, android application. I only do this in my spare time so I have only spent around 10 hours or so building this app. So far everything is going well, I have my app controlling Hyperion. Essentially, it can do everything that is currently supported by ProtoBuf. However, I am new to ProtoBuf. I assume you need to add features on your end before my app can access/control them?

    If so, could you add the options for sending/receiving effects and and option to retrieve Hyperion version number.

    Although the app isn't finished yet, most of the functionally works fine. It works just like the Hyperion app in the Play Store. However, as mentioned above I can't retrieve or send effects. My long term (maybe not too long) are to add the ability to fully configure Hyperion through SSL via the app.


    Screenshot_20160708-122912.png Screenshot_20160708-122921.png Screenshot_20160708-122931.png Screenshot_20160708-122958.png
     
    • Like Like x 3
  2. Brindosch

    Brindosch Administrator Administrator

    Messages:
    585
    Hardware:
    RPi1/Zero, RPi2, RPi3, +nodeMCU/ESP8266
    You are one of these guys who pushing forward such projects like Hyperion.
    Thank you for participating. Indeed we need new Apps(!), but we need people who could and are willing to work on this.

    If you want a dedicated repository for your Android code just ask. (Also in case you want to replace the current outdated android app with yours :))
    One question, you use ProtoBuf instead the JSON RPC. Is there a reason?

    So the point is now.
    1. An App that replaces the old one (color calibration(!))
    2. An App which uses the new function that are currently in development and is in sync when we release the next Hyperion version (We need much more time for it. So time goes by :))

    If people are interested and someone could to it :)

    @ Hyprion Development have a look at the last PRs.Currently many things need a rework.
    https://github.com/hyperion-project/hyperion.ng/issues

    @Paulchen-Panther is working on a JSON RPC writer to push changed settings to the current loaded .json
    In future you could detect the JSON RPC version level (already implemented) and the Hyperion version number (already implemented).
    And you could detect Hyperion with AVAHI (already implemented) ( no longer fiddle around with port configs)
     
  3. BioHaZard1

    BioHaZard1 New Member Developer

    Messages:
    26
    Hardware:
    RPi2, RPi3, 32/64bit, +Arduino
    The main reason to why I used ProtoBuf was simply because it was much easier to implement. Also, it was a little difficult to find any decent JSON RPC libraries which are regularly maintained. A lot of the current libraries no longer work correctly due to Google API changes. As it's still early days into development I could switch JSON if it's easier for you guys. If it comes to it, I could create a simple JSON RPC library to communicate with Hyperion.

    1. Do you have any example or documentation on how these JSON commands are constructed and sent?
    2. Where are the commands send to?

    Once I have communication (via JSON RPC) working adding all of the other commands should be simple. Google as recently added new ZeroConf API's so we should be able to get this working with just a few lines of code.
     
    • Like Like x 1
  4. penfold42

    penfold42 Moderator Developer

    Messages:
    394
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Checkout out the source for Hyperion-remote it uses the Json interface.

    You could possibly lift large amount of its code for your app
     
  5. BioHaZard1

    BioHaZard1 New Member Developer

    Messages:
    26
    Hardware:
    RPi2, RPi3, 32/64bit, +Arduino
    Thanks for that, I've made the switch over to JSON now. :)
     
  6. Brindosch

    Brindosch Administrator Administrator

    Messages:
    585
    Hardware:
    RPi1/Zero, RPi2, RPi3, +nodeMCU/ESP8266
    Sounds good, can't wait for an alpha :)
     
  7. BioHaZard1

    BioHaZard1 New Member Developer

    Messages:
    26
    Hardware:
    RPi2, RPi3, 32/64bit, +Arduino
    Hopefully, it shouldn't be too off till an Alpha arrives. Just need to finish off adding the Hyperion Remote features and refractor my code.
     
  8. Brindosch

    Brindosch Administrator Administrator

    Messages:
    585
    Hardware:
    RPi1/Zero, RPi2, RPi3, +nodeMCU/ESP8266
    Just as side notice, be aware that the most values (exception: treshold and gamma) are no longer used/ or replaced
    See https://hyperion-project.org/wiki/Color-Calibration

    I am still not satisfied with the new brightness regulation, we may chnage this again.

    OT: One question, as our expert for Android ;) . Is there a api for grabbing/capturing display content?
     
    • Agree Agree x 1
  9. BioHaZard1

    BioHaZard1 New Member Developer

    Messages:
    26
    Hardware:
    RPi2, RPi3, 32/64bit, +Arduino
    Yeah, I did notice a lot of these seem to be deprecated on hyperion-remote. No problem, I'll just change things accordingly.

    I've never done it myself, but I know they are screen recording API's built into Android. It should be possible to use a FrameBuffer too, not sure how many frames can be buffered though. I heard there was a limit to how many frames can be buffered, I think this is a size limit though, so if we decrease the resolution we should be able to hold more.

    Only real issues I can see from this are, mainly on 'lower end' devices, constantly pull/grabbing the screen --> processing the date --> sending via WiFi will overall decrease performance and hammer the battery life.

    When I get some free time though I will looks into this, if we can make it efficient enough I can see it being a good feature to have.
     
  10. Brindosch

    Brindosch Administrator Administrator

    Messages:
    585
    Hardware:
    RPi1/Zero, RPi2, RPi3, +nodeMCU/ESP8266
    Sounds nice, people requested it, so i just wanted to ask you if you may able to implement it on top. You could send the picture to the proto port with a priority (like the kodi addon or the windows grabber). 10 pictures each second and 128x128 in size are enough for a good ambient light experience. More increases cpu load on your App and Hyperion (of course) which is for sure not noticeable (visual).
     
  11. BioHaZard1

    BioHaZard1 New Member Developer

    Messages:
    26
    Hardware:
    RPi2, RPi3, 32/64bit, +Arduino
    Ah no problem, I'll definitely add it to the list. We would most likely run into issues with lollipop and higher due to the new permissions system. Also, some apps prohibit screen capturing mainly due to Data Protection and DMCA so we would have problems there too. I'll see what can be done. :)
     
  12. BitHunt3r

    BitHunt3r New Member

    Messages:
    1
    Hardware:
    RPi1/Zero, RPi2, RPi3
    Hi,
    is there any alpha/beta of this app available?
    I also thought of writing a new android app for hyperion, but I'm a beginner with android development so maybe I could as a first step contribute or at least fork your project to get into it? :)
     
  13. BioHaZard1

    BioHaZard1 New Member Developer

    Messages:
    26
    Hardware:
    RPi2, RPi3, 32/64bit, +Arduino
    Not just yet, but there will be one. I had a few bugs (which wasted a lot of time), I just need to finish up the Calibration/Transforms section. Obviously, there still quite a lot more to do, but we should be ready for a Alpha when this section is done.
     
  14. Brindosch

    Brindosch Administrator Administrator

    Messages:
    585
    Hardware:
    RPi1/Zero, RPi2, RPi3, +nodeMCU/ESP8266
    If you are ready for a repo, just ask :)
     
  15. BioHaZard1

    BioHaZard1 New Member Developer

    Messages:
    26
    Hardware:
    RPi2, RPi3, 32/64bit, +Arduino
    Will need one soon, the plan was the release Alpha, wait for feedback and clean up superfluous code then upload the source :)
     
  16. Brindosch

    Brindosch Administrator Administrator

    Messages:
    585
    Hardware:
    RPi1/Zero, RPi2, RPi3, +nodeMCU/ESP8266
    • Like Like x 1
  17. redPanther

    redPanther Moderator Developer

    Messages:
    193
    Hardware:
    RPi1/Zero, RPi2, 32/64bit, +Arduino
    Just a hint:
    Use protobuf for sending image data (screen grabbing)
    And json for all other things.

    Json api is not fast enough for image data and in proto no hyperion control commands are available.
     
  18. BioHaZard1

    BioHaZard1 New Member Developer

    Messages:
    26
    Hardware:
    RPi2, RPi3, 32/64bit, +Arduino
    Yeah I've already got ProtoBuf working, I implemented ProtoBuf before I switched over to JSON. I left the code in for testing sending image data. The only issue I am having is getting the screen from the Android device.
     
  19. TPmodding

    TPmodding Administrator Staff Member Administrator

    Messages:
    520
    Hardware:
    RPi1/Zero, RPi2, RPi3, +Arduino
  20. BioHaZard1

    BioHaZard1 New Member Developer

    Messages:
    26
    Hardware:
    RPi2, RPi3, 32/64bit, +Arduino
    The problem with this is ADB isn't actually on Android it is a protocol which allows us to connect to an Android device from a PC etc. I did look into this before, there was a way to do it via ADB but it was very 'hacky' and it required us to establish an ADB connection before it would work. I didn't bother testing this method too much as it wasn't very practical and occasionally the connection can timeout so you need to start all over again. The only real way to do it is to access 'fb0' (FrameBuffer) but there is no API and is highly locked down as Google don't want us to access it at all.