1

Adding Api Routes to BSP.localserver

Hi everyone,

i'm new to BrightScript.
I'm trying to build a smatrphone app to control a BrightSign player

I found in default autorun.brs (lines 657 to 682) the "api routes" section.
i tried to go al my.player.ip.address:port/GetCurrentStatus and an XML file is returned.

can i implements new routes? 

i'd like to upload in sd a file (.mp4), then call my.player.ip.address:por/play?filename=video.mp4

is this possibile? how?

thanks for answers

Luca

3 comments

  • 0
    Avatar
    Lyndon

     

    No, you can't add new routes. The local server is started in the main brighauthor autorun using the rohttpserver object. It has predefined examples like GetCurrent Status (GetID, GetRemoteData, GetUDPEvents).

     

    If you created your own rohttpserver object, then you could define your own functions and handlers. 

    If you were running a script on the card, you could send udp commands to play x filename.

     

  • 0
    Avatar
    Luca Ceccato

    Thanks for the answer,

    but i have to reply you. YES, I CAN

    I tooke the "roHttpServer" part in the default autorun and paste it in my new script (a modified version of "Serial UDP Control" autorun).

    then i add functions like the default ones.

    control.HttpPlayFileAA = { HandleEvent: HttpPlayFile, mVar: control }
    control.localServer.AddPostToFormData({ url_path: "/HttpPlayFile", user_data: control.HttpPlayFileAA })
    control.HttpPlayFile = HttpPlayFile
     
    i've done it with other function and... seems works!
     
  • 0
    Avatar
    Luca Ceccato

    BrightScript Language is not so easy... but after some time spending reading and reading again code and documentation, it's possibile to implements other functions and functionalities.

    by the way, my eyes are still bleeding :)

    jk :)

     

Please sign in to leave a comment.