0

Variables properties and limits

I would like (if it is possible) to know more about the varaibles, that can be defined and used on the BS units. Is there a limit to the length of the value string? Where are the variables stored? Are they written and red to and from the SD card, or do they reside in the flesh of the main processors or maybe in ram? I am asking this, because I would like to use them in a more unconventional way - to hold json (or other xml data). I am a bit concerned what could happen to the SD card (if the variables are stored on the card) if the variables had lots of writing in (let's say if I't implement some kind of usage counters for html elements, for statistical purposes). Wouldn't be really wise to implement this kind of features only to find out later, that they caused a premature SD card expiration. Or maybe you could point me into some other direction for storing data in a BS player, from html (write to file).

When I was thinking of this I also wondered how are the media counter variables done, if they are stored on the SD and massively used, what would happen to the SD cards.

Or maybe I'll discover that all these variables are stored in ram and thus flushed after a power outage or reboot. Either way if it is possible, that you provide some additional info on them I would be really happy.

3 comments

  • 0
    Avatar
    Alex

    The limit is 156 symbols according to my test.

    The variables are stored in the userVariables.db file on SD card.

    The size of userVariables.db remains constant.

    userVariables.db file holds the current and the previous values of local variables.

  • 0
    Avatar
    Roni Starc

    Sorry, I forgot to thank you for the reply.

    Today I discovered, an aditional limit (it is more an annoyance, that can be worked around, but it is annoying, and a source of nerve wrecking :). The problem is accessing the user variables in javascript with an ajax call, that is made immediately after a form submission (the way it is coded in the default web page). I have not tried if is an issue also with the classic live text approach.

    If a user specifies a lot of variables (I have about 30 of them), with not so small values in them (strings up to 50 characters), the ajax call at page reload (after the form is submitted by the user) does not yield the expected results - the call returns and populates the input fields with the old values of the variables. A manual page refresh solves the issue (as the page displays the updated values), but it is not a really usable trick, because someone that does not notice that the values are not the ones he or she put in (we all know there are all sorts of end users out there), could (at the next values update) revert some values he or she did not mean to change. This does not happen always. Sometimes when you put in a value it gets back ok, sometimes it does not (even the same value, same field).

    A walk around is of course to insert a short delay (or timeout) before the ajax call, but it is still a work around. It is obvious that the BS unit receives the values and even writes them in the user database (the BS unit displays the correct - updated values), but it seems that while it is busy writing the variables, it sends the old ones out. Of course it could be because of a slow SD card, but the state machines and quite some "paralel" execution, etc. can take it's toll. The most elegant solution would of course be if the BS unit delayed the sending until it has finished writing the values, and then send the correct ones (I think it can be fixed in the autorun.brs), or at least issue a transfer fail flag (so the code can handle it).

    The easyest solution would of course be to insert a delay into the default device web page.

    So if anyone is experiencing issues with the wrong values in the user variables web page after a submit, wrap the getUserVars(doUserVars); like this:

    setTimeout(function() {getUserVars(doUserVars)}, 2000):

    The timing depends on the nuber of the variables, and possibly other stuff. 1ms (1000) didn't cut it for me in this particular project.Hope this will be of help to someone :)

  • 0
    Avatar
    Alfonso Descalzo

    I´m having the same issue, with 12 user variables.

     

    I have to wait 20 seconds to have all the new variables displayed at the webpage.

     

    I´m using an USB pendrive. Is it the normal behaviour?

     

     

Please sign in to leave a comment.