Announcement

Collapse
No announcement yet.

MAC Address format in VB for SNAPConnect

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • MAC Address format in VB for SNAPConnect

    PLEASE HELP, ANYONE!

    I am fairly new to SNAPConnect though I have had my license for over a y ear now. Am just now getting to SNAP-Connect related part of the project and need some help with one final hang-up on the application (I hope):

    1) User enters basic remote note data for each remote note (i.e. name, index id, MAC, etc.) in windows dialog.

    2) User Data goes to table in app as well as exterior .MDB database linked with the table

    3) App pulls MAC(String) from DB to call on node. App Uses following code to convert string to Byte :
    Public Function UnicodeStringToBytes(ByVal str As String) As Byte()
    Return System.Text.Encoding.Unicode.GetBytes(str)

    (This function called elsewhere similar to x = UNICODESTRINGTOBYTE (MACString variable)

    4) Resultant Byte (x) used in subsequent RPC to remote node. I.E... proxy.rpc(clientaddress, x, New object{})
    where x = the result of the unicode conversion function shown in item 3 above

    5) SNAPConnect Console displays MAC as a 24 digits (4 per character in MAC) such as 3500610036003700320034004100. I believe this is UNICODE if I am not mistaken but the function in ITEM 3 is supposed to change that in the receiving variable.

    6) Error received after issuing RPC to poll remote node with MAC Extracted from DB. I use the MAC in string from user input and DB for ease of handling and wait to convert before using the data to issue RPC to remote.

    There is limited example and documentation on using SNAPConnect with Visual Basic in my humble opinion so I am unsure where to look for an answer. I believe the problem is in the encoding or my choice of conversion formatting for the MAC address before using it in the subsequent RPC command. I keep getting errors after issuing the RPC and I am near certain that it is at least in part due to an incorrect data format for the remote Node's MAC Address used in the RPC arguments.

  • #2
    topherness54,

    You are correct the actual RPC expects a hex-string (as opposed to ASCII) for the SNAP address. This SNAP address is only three bytes long (Ex. 0xaabbcc).

    There are a VB example that installs with SNAP Connect (see the XML-RPC Client Examples). However, for this version of SNAP Connect (ver 2.x using XML-RPC), the client-server interact is based purely on the XML-RPC standard (see www.xmlrpc.org).


    NOTE: Later version of SNAP Connect (3.x and forward) have transitioned to become a Python-only library.
    sigpic
    Proven Solutions for the Internet of Things
    www.synapse-wireless.com

    Comment


    • #3
      SNAP Connect & Visual Basic RPC

      I did see the VB example which I used bits & pieces of as a starting point with my app for a go-by. My situation involves extracting a string from a DB and then trying to convert it to the HEX String. I need to dig into conversion routines available in VB it sounds like, specifically one for a HEX string. Why didn't I think of that ? Thanks, that will get me back on the right track as far as picking which conversion formats to aim for.

      I have seen many references to this "Python" version of SNAP Connect. Truthfully I haven't had the time recently to investigate the main differences and how they manifest when constructing a real application. I would be very interested in learning more. I have already downloaded the docs and did note some differences when reading (not realizing it related to vast changes in a revamped version intended to be different from the prior version). One more peice to the puzzle that will help that make more sense next time I read through the manual for the Python version that I keep reading vague references to.

      Comment


      • #4
        The quick and dirty story:

        SNAP Connect Version 2.1:


        - XML-RPC based
        - You can use any language that supports the XML-RPC standard
        - Slow and a bit cumbersome to implement
        - all RPCs must be unbundled/bundled before processing.
        - no direct access to the functionality (must go through the XML-RPC pipe first)


        SNAP Connect Version 3.x (and 2.4 on E10):

        - Purely for Python language
        - Allows you to import the functionality directly to your Python application
        - More robust, faster and much easier to develop with.
        - Supports true SNAP over TCP/IP (no XML-RPC required)
        - What comes inside the E10 device
        - What we use at Synapse for our internet access and GUI needs (Ex. SNAP-Lighting.com)
        sigpic
        Proven Solutions for the Internet of Things
        www.synapse-wireless.com

        Comment

        X