Your Digital Media Has Never Looked So Good

 
taylorcw
Topic Author
Posts: 37
Joined: Mon Jan 18, 2016 7:41 pm

HDMI-CEC Implimentation

Tue Jul 09, 2019 6:52 am

I'd like to impliment an action when a CECStatus event is triggered per: https://developer.roku.com/docs/references/brightscript/events/rocecstatusevent.md

To watch for this event, a message port needs to be opened. How would I you do this? 

Here's my main.brs:   Would I put it in here?


    screen   = CreateObject("roSGScreen")
    port     = CreateObject("roMessagePort")
    
    scene    = screen.CreateScene("MainScene")
    screen.setMessagePort(port)    
    screen.show()

    while(true)
        msg     = wait(0, port)
        msgType = type(msg)

        if msgType = "roSGScreenEvent"
            if msg.isScreenClosed() then return
        end if
    end while


Thanks
 
taylorcw
Topic Author
Posts: 37
Joined: Mon Jan 18, 2016 7:41 pm

Re: HDMI-CEC Implimentation

Tue Jul 09, 2019 9:14 pm

Figured out the issue. Documentation is incorrect. It should be:
CECStatus.IsActiveSource() to get the current CEC Status, not "ifCECStatus.IsActiveSource()"

    screen   = CreateObject("roSGScreen")
    port     = CreateObject("roMessagePort")
    cecstatus = CreateObject("roCECStatus")
    
    scene    = screen.CreateScene("MainScene")
    screen.setMessagePort(port) 
    cecstatus.SetMessagePort(port)
    screen.show()

    while(true)
        msg     = wait(0, port)
        msgType = type(msg)

        if msgType = "roCECStatusEvent"
            print "RECEIVED roCECStatusEvent event"
            print "MSG STATUS: "; CECStatus.IsActiveSource()
        end if

        if msgType = "roSGScreenEvent"
            if msg.isScreenClosed() then return
        end if
    end while

Who is online

Users browsing this forum: No registered users and 7 guests