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

Scrolling text on Arctis Wireless box and unresponsive endpoint #58

Open
szabolcs-dekany92 opened this issue Dec 30, 2018 · 4 comments
Open

Comments

@szabolcs-dekany92
Copy link

szabolcs-dekany92 commented Dec 30, 2018

I'm trying to print some text to the Arctis Wireless box oled screen. I've sucessfully done it by sending context data, however the text gets cut off mid sentence.
Is there any way to scroll longer texts on the screen?
Do we have any means of formatting text that appears on the screen?

The handler I'm sending the request to

{  
   "game":"TS3TOSSE3",
   "event":"POKE_MESSAGE",
   "icon_id":0,
   "handlers":[  
      {  
         "device-type":"screened",
         "mode":"screen",
         "zone":"one",
         "datas":[  
            {  
               "has-text":true,
               "length-millis":5000,
               "arg":"(custom-text:(context-frame: self))"
            }
         ]
      }
   ]
}

The request im sending to the endpoint

{  
   "game":"TS3TOSSE3",
   "event":"POKE_MESSAGE",
   "data":{  
      "frame":{  
         "custom-text":"THIS IS A ERY LONG TEXT"
      }
   }
}

The other issue I just started having is regards to how often can you send events and display text on the screen. It seems that I cannot send two request about two-three seconds apart, since the endpoint seems to not forward the request to the box. I see the JSON sent to the endpont just fine, and the response is also valid (spitting back the contents of my request), however nothing happens.
Or rather, this happens:

box

The screen goes bananas and I have to unplug the device and reset it.
Any idea why is that happening? Is this an issue with my wireless box or bad firmware?
Is there any way to check logs on what the endpoint is trying to do when receiving the request?

@szabolcs-dekany92 szabolcs-dekany92 changed the title Scrolling text on Arctis Wireless box Scrolling text on Arctis Wireless box and unresponsive endpoint Dec 31, 2018
@szabolcs-dekany92
Copy link
Author

Update: After removing the app from SSE3 and re-registering it, It just refuses to work. The message gets sent, the response is there, but nothing happens.

@adamscybot
Copy link

adamscybot commented Jan 23, 2019

I've been battling similar problems and think I can offer some help. Firstly, your "non response" problem, I believe you need to bump the value key on the game_event each time to prevent the device caching. In your example, you are missing the value key as a sibling to the frame key. I think this is supposed to be a unique integer each time.

POST http://127.0.0.1:49391/game_event HTTP/1.1
Content-Type: application/json

{  
    "game": "TS3TOSSE3",
    "event": "POKE_MESSAGE",
    "data": {
      "value": 1, // make this increase each time you want to update
      "frame": {
         "custom-text": "test test 12345564556789"
      }
   }
}

I've also come across the problem of needing scrolling text. I first tried to force a new line (why does it only show 1 line in the centre?! Argh!!) but was unable to even inserting carriage returns in the JSON string.

I was able to get a scrolling affect by hitting the endpoint a lot bumping the aforementioned value integer each time, and manually manipulating the text by cutting off the first character each time.

Another way is to abuse the suffix key when you register the event, and then use the repeat feature. This is probably closer to a final solution, since you first bind the event (I think this sends the frames to the device beforehand) then we "play" them by sending the event.

POST http://127.0.0.1:49391/bind_game_event HTTP/1.1
Content-Type: application/json

{
   "game": "TS3TOSSE3",
   "event": "POKE_MESSAGE",
   "handlers": [
      {
         "device-type": "screened",
         "mode": "screen",
         "zone": "one",
         "datas": [
         {
            "has-text": true,
            "suffix": "I am a long piece of text",
            "length-millis": 200
         },
            {
            "has-text": true,
            "suffix": " am a long piece of text",
            "length-millis": 200
         },
            {
            "has-text": true,
            "suffix": "am a long piece of text",
            "length-millis": 200
         },
            {
            "has-text": true,
            "suffix": "m a long piece of text",
            "length-millis": 200
         },
            {
            "has-text": true,
            "suffix": " a long piece of text",
            "length-millis": 200
         },
            {
            "has-text": true,
               "suffix": "a long piece of text",
            "length-millis": 200
         },
            {
            "has-text": true,
            "suffix": " long piece of text",
            "length-millis": 200
         },
         {
            "has-text": true,
            "suffix": "long piece of text",
            "length-millis": 200,
            "repeats": true
         }
         ]
      }
   ]
}

It's hacky, but you can obviously build an abstraction on top of this. Still though, no way to wrap text as far as a I can see. For that reason, I'm probably going to generate and send my own bitmaps...

@adamscybot
Copy link

adamscybot commented Jan 24, 2019

I found some more tricks :). After looking into the DB that backs the game engine, I can see there are some undocumented features we can use. You can split text on multiple lines like so:

POST http://127.0.0.1:50035/bind_game_event HTTP/1.1
Content-Type: application/json

{
   "game": "TEST",
   "event": "DISPLAY",
   "icon_id": 16,
   "handlers": [
      {"device-type": "screened",
         "mode": "screen",
         "zone": "one",
         "datas": [
            {
               "length-millis": 5000,
               "lines": [
                  {
                     "has-text": true,
                     "context-frame-key": "line1",
                     "bold": true
                  },
                  {
                     "has-text": true,
                     "context-frame-key": "line2"
                  },
                  {
                     "has-text": true,
                     "context-frame-key": "line3"
                  }
               ]
            }
         ]
      }
   ]
}

Then send the event like so:


POST http://127.0.0.1:50035/game_event HTTP/1.1
Content-Type: application/json

{  
    "game": "TEST",
    "event": "DISPLAY",
    "data": {
      "value": 1,
      "frame": {
         "line1": "test1",
         "line2": "test2",
         "line3": "test3"
      }
   }
}

@szabolcs-dekany92
Copy link
Author

Hey @adamscybot !
Thanks for the awesome responses. I'll be sure to tinker around with these during the weekend! Cheers

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

No branches or pull requests

2 participants