Announcement

Collapse
No announcement yet.

Address Conversion to Hex

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

  • Address Conversion to Hex

    Does anyone have a function that will convert an address in the form "23:4D:3E" (a string) to the form required for the rpc method?

    n = int(mac.replace(':', ''), 16) doesn't seem to work as all the functions are not allowed.

    I have also tried something like:
    tmpAddrStr = AddrStr[0:1] & AddrStr[3:4] & AddrStr[6:7]
    tmpConvertedHexAddr = int(tmpAddrStr, 16)
    rpc(tmpConvertedHexAddr,"waitForData","Hello")

    This results in an Allocation Failed in Function stdInEvent....

    I've also tried:
    tmpAddrStr = chr(int(tmpAddrStr[0:1],16)) + chr(int(tmpAddrStr[3:4],16)) + chr(int(tmpAddrStr[6:7],16))

    I would think that should work... there are no errors, but using the resulting address does not appear to call the remote synapse module.

    Any help would be appreciated.

    Thank you.
    Last edited by teamsp; 06-11-2015, 03:22 PM.

  • #2
    Anybody have any thoughts on this one?

    Comment


    • #3
      I would suggest seacrhing the forum for hex support also the attached files should help
      Attached Files

      Comment


      • #4
        Thank you.

        Comment


        • #5
          The issue is slicing

          If I understand your problem: using slice [3:4] for example, will only return the byte/character at location 3. You have to use [3:5] to get elements 3 and 4. I got bit by this myself until I got Python slicing down.

          Comment

          Working...
          X