示例#1
0
 def encodelong(form, h):
     secbin=dec2bin(int(form.timesecond.data),17)
     if int(form.altitude.data) >15952:
         alt='1'*10
     else:
         alt= dec2bin(round((int(form.altitude.data)+400)/float(16)),10)
     completebin = form.longSGB(h) + '0001' + secbin+alt + form.act.data + form.gnss.data+form.battery.data + '0'*9
     bch = calcBCH(completebin, 0, 202, 250)
     return bin2hex('00' + completebin + bch)
示例#2
0
    def encodelong(form, h):
        rlm_short_sig = str(form.rlm_short_signal.data.zfill(20))
        completebin = form.longSGB(h) + '0010' + '00' +\
                      form.rls_capability_auto.data+\
                      form.rls_capability_manual.data+ '0000'+\
                      form.rls_provider.data+\
                      form.beacon_feedback_t1.data+\
                      form.beacon_feedback_t2.data+\
                      rlm_short_sig+'0'*11

        bch = calcBCH(completebin, 0, 202, 250)
        return bin2hex('00' + completebin + bch)
示例#3
0
    def encodelong(form, h):

        hoursbin = dec2bin(int(form.hours.data), 6)
        if form.minutes.data == None:
            minbin = dec2bin(2047, 11)
        else:
            minbin = dec2bin(int(form.minutes.data), 11)

        if form.altitude.data == None:
            altbin = '1' * 10
        else:
            a = round((float(form.altitude.data + 400) / 16), 0)
            altbin = dec2bin(a, 10)

        completebin = form.longSGB(
            h
        ) + '0000' + hoursbin + minbin + altbin + form.hdop.data + form.vdop.data + form.act.data + form.bat.data + form.fix.data + '00'
        bch = calcBCH(completebin, 0, 202, 250)
        print(completebin)
        return bin2hex('00' + completebin + bch)
示例#4
0
    def encodelong(form, h):


        completebin = form.longSGB(h)[:-14] + '0' *14 + '1111' + '1'*42 + form.cancel_message.data
        bch = calcBCH(completebin, 0, 202, 250)
        return bin2hex('00' + completebin + bch)
示例#5
0
    def encodelong(form, h):

        nat= str(dec2bin(int(form.national_use.data))).zfill(44)
        completebin = form.longSGB(h) + '0011' + nat
        bch = calcBCH(completebin, 0, 202, 250)
        return bin2hex('00' + completebin + bch)