Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6

Thread: http://ip_address/DbXmlInfo.xml

  1. #1
    Senior Member
    Join Date
    May 2014
    Posts
    170

    http://ip_address/DbXmlInfo.xml

    Does anyone know if there is randomization it this file generation? If I write a parsing function do I have to worry about the order changing someday or not.
    VAV
    Danbury, CT

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    120
    Not that I've seen. But if you use a good XML parsing library, you shouldn't need to worry about the order in the file.

  3. #3
    Senior Member
    Join Date
    May 2014
    Posts
    170
    Quote Originally Posted by FlyingDiver View Post
    Not that I've seen. But if you use a good XML parsing library, you shouldn't need to worry about the order in the file.
    Unfortunately I have to write from scratch. I'll probably bite the bullet and account for possible randomization since I've been bitten before. I did another parsing routine for a command line interface that was always providing data in the same consistent order until a Perl update on the device made it adhere to the Perl standard which was always designed for randomization. They just didn't enforce it. It took a long time converting everything to Jason and CometD which I had to do from scratch too. If I had a library to work with I wouldn't care cuz the hard work would be done but I'm stuck in the AMX world.
    VAV
    Danbury, CT

  4. #4
    Senior Member
    Join Date
    Jul 2014
    Posts
    120
    That sucks. I did my parsing routine to import the Lutron devices into Indigo (Mac based HA system). Indigo uses Python for plugins (device drivers) and the Python XML libraries are quite good. What language does AMX use?

  5. #5
    Senior Member
    Join Date
    May 2014
    Posts
    170
    It's similar to C but more limited. You can also program in JAVA now and I took JAVA class probably 20 years ago but I don't want to learn another language.

    Here's a function I wrote just for parsing the time clocks section (** are closing brackets, the forum changes them):
    Code:
    DEFINE_FUNCTION fnLutron_XML_ParseTimeClocks(_sTimeClocks iStore[], CHAR iStr[], CHAR iFields[][][],CHAR iSubFields[][][],CHAR iModeFields[][][])
         {
         STACK_VAR INTEGER i;
         STACK_VAR INTEGER n;
         STACK_VAR INTEGER y;
         STACK_VAR INTEGER z;
         STACK_VAR INTEGER nFBS1;
         STACK_VAR INTEGER nFBS2;
         STACK_VAR INTEGER nFBS3;
         STACK_VAR INTEGER nFBS4;
         STACK_VAR INTEGER nLen1;
         STACK_VAR INTEGER nLen2;
         STACK_VAR INTEGER nLen3;
         STACK_VAR INTEGER nLen4;
         STACK_VAR CHAR    cCopy1[4096];
         nLen1 = LUT_NUM_INSTALLED_TSTATs;
         nLen2 = LENGTH_ARRAY(iFields);
         nLen3 = LUT_TMCLOCK_MODES;
         nLen4 = LENGTH_ARRAY(iModeFields);
         nFBS1 = 1;
         cCopy1 = iStr;
         for(i=1;i <= LUT_NUM_INSTALLED_TSTATs;i++)
          {
          STACK_VAR CHAR cCopy2[4096];
          STACK_VAR CHAR cCopy3[2048];
          nFBS1 = find_string(cCopy1,iSubFields[1][1],nFBS1);
          if(nFBS1)
               {
               iStore[i].cStr = fnJSON_ReturnMidString(cCopy1,iSubFields[1][1],iSubFields[1][2],nFBS1);
               nFBS1 = (nFBS1 + length_string(iSubFields[1][1]) + length_string(iStore[i].cStr));
               **
          nFBS2 = 1;
          cCopy2 = iStore[i].cStr;
          for(n=1; n<=nLen2; n++)
               {
               nFBS2 = find_string(cCopy2,iFields[n][1],nFBS2);
               if(nFBS2)
                {
                iStore[i].cValue[n] = fnJSON_ReturnMidString(cCopy2,iFields[n][1],iFields[n][2],nFBS2);
                nFBS2 = (nFBS2 + length_string(iFields[n][1]) + length_string(iStore[i].cValue[n]));
                **
               **
          nFBS2 = find_string(cCopy2,iSubFields[2][1],nFBS2);
          if(nFBS2)
               {
               iStore[i].cModeStr = fnJSON_ReturnMidString(cCopy2,iSubFields[2][1],iSubFields[2][2],nFBS2);
               nFBS2 = (nFBS2 + length_string(iSubFields[2][1]) + length_string(iStore[i].cModeStr));
               **
          nFBS3 = 1;
          cCopy3 = iStore[i].cModeStr;
          for(y=1; y<=nLen3; y++)
               {
               STACK_VAR CHAR cCopy4[256];
               nFBS3 = find_string(cCopy3,iSubFields[4][1],nFBS3);
               if(nFBS3)
                {
                iStore[i].sModes[y].sSubMode.cSubStr = fnJSON_ReturnMidString(cCopy3,iSubFields[4][1],iSubFields[4][2],nFBS3);
                nFBS3 = (nFBS3 + length_string(iSubFields[4][1]) + length_string(iStore[i].sModes[y].sSubMode.cSubStr));
                **
               nFBS4 = 1;
               cCopy4 = iStore[i].sModes[y].sSubMode.cSubStr;
                      
               for(z=1; z<=nLen4; z++)
                {
                nFBS4 = find_string(cCopy4,iModeFields[z][1],nFBS4);
                if(nFBS4)
                 {
                 iStore[i].sModes[y].sSubMode.cValue[z] = fnJSON_ReturnMidString(cCopy4,iModeFields[z][1],iModeFields[z][2],nFBS4);
                 nFBS4 = (nFBS4 + length_string(iModeFields[z][1]) + length_string(iStore[i].sModes[y].sSubMode.cValue[z]));
                 **
                **
               **
          **
         **
    This is a PITA since it's all nested values similar to JSON.
    VAV
    Danbury, CT

  6. #6
    Senior Member
    Join Date
    Jul 2014
    Posts
    120
    Yikes. I'll stick to Python. ;)

Similar Threads

  1. Finding rollbacks in DbXmlInfo?
    By wkearney99 in forum 3rd-party Integration - RA2
    Replies: 1
    Last Post: 11-21-2021, 07:45 AM
  2. 3rdParty HTTP Device
    By sergiobaiao in forum 3rd-party Integration - HWQS
    Replies: 0
    Last Post: 02-13-2018, 05:05 PM
  3. HTTP Control from Lutron
    By Peter Licht in forum 3rd-party Integration - HWQS
    Replies: 1
    Last Post: 03-21-2016, 11:54 AM
  4. DbXmlInfo.xml format documentation?
    By wkearney99 in forum 3rd-party Integration - RA2
    Replies: 8
    Last Post: 02-29-2016, 01:50 PM
  5. Main Repeater HTTP login?
    By grork in forum General Discussion - RA2
    Replies: 3
    Last Post: 08-20-2015, 05:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •