Struggling with message format for Sigfox transmission



  • Re: Data format for Sigfox transmission

    So i'm continuing to have issues with what must be a simple task. Below is my code... simply trying to send the variable data1 via Sigfox.

    A message is received but the data is always represented as "21030490058604" from the Sigfox back end which I assume is an error code of some form as its always the same irrelevant of the content of my variable.

    The content is encoded from 2315051001 to b'\xf9\xdf\xfc\x89'. But I'm unclear if this is how the data should be prepared for sigfox? As ever any help appreciated.

    from network import Sigfox
    import socket
    from time import sleep
    import _thread
    import array
    import ustruct
    
    
    # init Sigfox for RCZ1 (Europe)
    sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1)
    
    # create a Sigfox socket
    s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW)
    
    # make the socket blocking
    s.setblocking(True)
    
    # configure it as uplink only
    s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, False)
    
    # send some bytes
    data1 = 2315051001
    print (data1)
    data1 = ustruct.pack('i', data1)
    
    
    while True:
            try:
                    s.send(data1)
                    print (data1)
            except:
                    print ("fail")
                    pass
            sleep(900)```

Log in to reply
 

Pycom on Twitter