def gen_msg(to, text, empty=False): # Note we are constructing a RPDU which encapsulates a TPDU. ref = str(SMS_Helper.to_hex2(random.randint(0, 255))) rp_header = gen_rp_header(ref, empty) tpdu = gen_tpdu(ref, to, text, empty) tp_len = len("".join(tpdu)) / 2 # In octets. body = rp_header + [SMS_Helper.to_hex2(tp_len)] + tpdu return "".join(body)
def gen_msg(to, text, empty=False): # note we are constructing a RPDU which encapsulates a TPDU ref = str(SMS_Helper.to_hex2(random.randint(0,255))) rp_header = gen_rp_header(ref, empty) tpdu = gen_tpdu(ref, to, text, empty) tp_len = len("".join(tpdu)) / 2 #in octets body = rp_header + [SMS_Helper.to_hex2(tp_len)] + tpdu return "".join(body)
def gen_rp_header(ref, empty): # If 'empty' is true, generates for Empty SMS rp_header = ["00" #Message Type = ms->n , ref #Message Reference , "00" #RP-originator Address (zero length, no data) , SMS_Helper.encode_num("0000")] #RP-destination address return rp_header
def gen_rp_header(ref, empty): # If 'empty' is true, generates for Empty SMS # GSM 4.11: 8.21, 8.22 rp_header = [ "01", # Message Type = n -> ms ref, # Message Reference SMS_Helper.encode_num("0000"), "00", ] # RP-destination address for Service Center return rp_header
def gen_rp_header(ref, empty): # If 'empty' is true, generates for Empty SMS # GSM 4.11: 8.21, 8.22 rp_header = [ "01", # Message Type = n -> ms ref, # Message Reference SMS_Helper.encode_num("0000"), "00" # RP-destination address for Service Center ] return rp_header