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)
Esempio n. 2
0
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)