예제 #1
0
파일: dpr.py 프로젝트: AlexKano/pmax
def prox(long_id, short_id, tag_id=0, action=3, partition_bitmap=0):
    """action_id = 3
    if action.lower() == "away":
        action_id = 3
    elif action.lower() == "home":
        action_id = 2
    elif action.lower() == "disarm":
        action_id = 1
    elif action.lower() == "away_latchkey":
        action_id = 4
    elif action.lower() == "arm_part":
        action_id = 5
    elif action.lower() == "quick_away":
        action_id = 6
    elif action.lower() == "quick_home":
        action_id = 7
    elif action.lower() == "arm_instant":
        action_id = 8
    elif action.lower() == "check_code":
        action_id = 9
    else:
        print "Wrong event was specified for TAG"
        sys.exit(0)
    """
    packet = prutils.make_device_packet(
        long_id,
        short_id,
        Config.SET,
        73,
        chr(partition_bitmap) + chr(action) + "\x28\x00\x00\x00\x00" + chr(tag_id) + "\x00\x00\x00",
    )
    return packet
예제 #2
0
파일: dpr.py 프로젝트: AlexKano/pmax
def hello(long_id, short_id, command, notification_period):
    # command:
    #   0 - Ping
    #   1 - Check if enrolled

    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 64, chr(command), notification_period)
    return packet
예제 #3
0
파일: dpr.py 프로젝트: AlexKano/pmax
def volume(long_id, short_id, level):
    # level:
    #   1   - lowest level
    #   254 - highest level

    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 96, chr(level))
    return packet
예제 #4
0
파일: dpr.py 프로젝트: AlexKano/pmax
def power_mode(long_id, short_id, mode):
    # mode:
    #   0 - Power Save
    #   1 - Active

    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 238, chr(mode))
    return packet
예제 #5
0
def hello(long_id, short_id, command, notification_period):
    # command:
    #   0 - Ping
    #   1 - Check if enrolled

    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 64,
                                        chr(command), notification_period)
    return packet
예제 #6
0
def volume(long_id, short_id, level):
    # level:
    #   1   - lowest level
    #   254 - highest level

    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 96,
                                        chr(level))
    return packet
예제 #7
0
파일: dpr.py 프로젝트: AlexKano/pmax
def change_transmission_privileges(long_id, short_id, restricted_bitmap, timeout_sec):
    # restricted_bitmap - bitmap of restricted slots (8 bytes):
    #   0   - not restricted
    #   1   - slot is restricted for transmission

    # timeout_sec need to be 2 bytes length
    timeout_sec = prutils.num_to_chars(timeout_sec, 2)
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 63, restricted_bitmap + timeout_sec)
    return packet
예제 #8
0
def file_info(long_id, short_id, film_id, row, file_status,  prime_file_id, secondary_file_id, frame_number, file_type,\
        film_type, time_stamp, crc, index, zone, file_size, sequence=-1):

    data = chr(film_id) + chr(row) +  chr(file_status) + chr(prime_file_id) + chr(secondary_file_id) + chr(frame_number) + \
        chr(file_type) + chr(film_type) + prutils.num_to_chars(time_stamp, 4, 0) + prutils.num_to_chars(crc, 2 ,0) + \
        chr(index) + chr(zone) + prutils.num_to_chars(file_size, 2, 0)
    packet = prutils.make_device_packet(long_id, short_id, Config.REPLY, 181,
                                        data, 0, 0, 0, 0, 1, 4, sequence)
    return packet
예제 #9
0
파일: dpr.py 프로젝트: AlexKano/pmax
def change_listen_mode(long_id, short_id, mode, timeout_sec):
    # mode:
    #   0   - Notification Only
    #   1   - Always Open
    #   255 - Default

    # timeout_sec need to be 2 bytes length
    timeout_sec = prutils.num_to_chars(timeout_sec, 2)
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 61, chr(mode) + timeout_sec)
    return packet
예제 #10
0
def change_transmission_privileges(long_id, short_id, restricted_bitmap,
                                   timeout_sec):
    # restricted_bitmap - bitmap of restricted slots (8 bytes):
    #   0   - not restricted
    #   1   - slot is restricted for transmission

    # timeout_sec need to be 2 bytes length
    timeout_sec = prutils.num_to_chars(timeout_sec, 2)
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 63,
                                        restricted_bitmap + timeout_sec)
    return packet
예제 #11
0
def change_listen_mode(long_id, short_id, mode, timeout_sec):
    # mode:
    #   0   - Notification Only
    #   1   - Always Open
    #   255 - Default

    # timeout_sec need to be 2 bytes length
    timeout_sec = prutils.num_to_chars(timeout_sec, 2)
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 61,
                                        chr(mode) + timeout_sec)
    return packet
예제 #12
0
파일: dpr.py 프로젝트: AlexKano/pmax
def change_notification_period(long_id, short_id, mode, timeout_sec):
    # mode:
    #   0   - 1 second
    #   1   - 2 seconds
    #   2   - 4 seconds
    #   3   - 8 seconds
    #   4   - 16 seconds
    #   5   - 32 seconds
    #   6   - 64 seconds
    #   255 - Default

    # timeout_sec need to be 2 bytes length
    timeout_sec = prutils.num_to_chars(timeout_sec, 2)
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 62, chr(mode) + timeout_sec)
    return packet
예제 #13
0
def change_notification_period(long_id, short_id, mode, timeout_sec):
    # mode:
    #   0   - 1 second
    #   1   - 2 seconds
    #   2   - 4 seconds
    #   3   - 8 seconds
    #   4   - 16 seconds
    #   5   - 32 seconds
    #   6   - 64 seconds
    #   255 - Default

    # timeout_sec need to be 2 bytes length
    timeout_sec = prutils.num_to_chars(timeout_sec, 2)
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 62,
                                        chr(mode) + timeout_sec)
    return packet
예제 #14
0
def change_panel_state(long_id, short_id, part_bitmap, action, user_code):
    # part_bitmap - Partition (bitmap):
    #   0 - no Partition
    # action:
    #   1 - Disarm
    #   2 - Arm Home
    #   3 - Arm Away
    #   4 - Arm Latchkey
    #   5 - Arm Part
    #   6 - Quick Away
    #   7 - Quick Home
    #   8 - Arm Instant
    #   9 - Check Code
    # user_code - 4 digits user code:
    #   1st digit sent 1st, example - user code 1234: code byte 0: 0x12, code byte 1: 0x34
    #   0xAAAA - no user code

    user_code = prutils.str_to_bcd(str(user_code))
    packet = prutils.make_device_packet(
        long_id, short_id, Config.REPORT, 69,
        chr(part_bitmap) + chr(action) + user_code)
    return packet
예제 #15
0
파일: dpr.py 프로젝트: AlexKano/pmax
def change_panel_state(long_id, short_id, part_bitmap, action, user_code):
    # part_bitmap - Partition (bitmap):
    #   0 - no Partition
    # action:
    #   1 - Disarm
    #   2 - Arm Home
    #   3 - Arm Away
    #   4 - Arm Latchkey
    #   5 - Arm Part
    #   6 - Quick Away
    #   7 - Quick Home
    #   8 - Arm Instant
    #   9 - Check Code
    # user_code - 4 digits user code:
    #   1st digit sent 1st, example - user code 1234: code byte 0: 0x12, code byte 1: 0x34
    #   0xAAAA - no user code

    user_code = prutils.str_to_bcd(str(user_code))
    packet = prutils.make_device_packet(
        long_id, short_id, Config.REPORT, 69, chr(part_bitmap) + chr(action) + user_code
    )
    return packet
예제 #16
0
파일: dpr.py 프로젝트: AlexKano/pmax
def file_info(
    long_id,
    short_id,
    film_id,
    row,
    file_status,
    prime_file_id,
    secondary_file_id,
    frame_number,
    file_type,
    film_type,
    time_stamp,
    crc,
    index,
    zone,
    file_size,
    sequence=-1,
):

    data = (
        chr(film_id)
        + chr(row)
        + chr(file_status)
        + chr(prime_file_id)
        + chr(secondary_file_id)
        + chr(frame_number)
        + chr(file_type)
        + chr(film_type)
        + prutils.num_to_chars(time_stamp, 4, 0)
        + prutils.num_to_chars(crc, 2, 0)
        + chr(index)
        + chr(zone)
        + prutils.num_to_chars(file_size, 2, 0)
    )
    packet = prutils.make_device_packet(long_id, short_id, Config.REPLY, 181, data, 0, 0, 0, 0, 1, 4, sequence)
    return packet
예제 #17
0
파일: dpr.py 프로젝트: AlexKano/pmax
def film_info(
    long_id,
    short_id,
    film_id,
    film_status,
    film_type,
    pre_alarm_length,
    post_alarm_length,
    frame_rate,
    time_stamp,
    index,
    zone,
    files_amount,
):

    # film_status:
    #   0   does not exist
    #   1   existing, closed and permitted for delete
    #   2   existing, opened film
    #   3   existing, closed film
    #   4   error
    # print long_id, short_id, film_id, film_status, film_type, pre_alarm_length, post_alarm_length,\
    #     frame_rate, time_stamp, index, zone, files_amount
    # return
    data = chr(film_id)
    data += chr(film_status)
    data += chr(film_type)
    data += chr(pre_alarm_length)
    data += chr(post_alarm_length)
    data += chr(frame_rate)
    data += prutils.num_to_chars(time_stamp, 4, 0)
    data += chr(index)
    data += chr(zone)
    data += chr(files_amount)
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 180, data, 0, 1, 1, 1, 0)
    return packet
예제 #18
0
def passive_motion_with_index(long_id, short_id, index):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 19,
                                        chr(Config.VIOLATED) + chr(index))
    return packet
예제 #19
0
def fire_alarm(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 34,
                                        chr(open))
    return packet
예제 #20
0
파일: dpr.py 프로젝트: AlexKano/pmax
def gas_sensor_trouble(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 52, chr(open))
    return packet
예제 #21
0
파일: dpr.py 프로젝트: AlexKano/pmax
def jamming(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 48, chr(open))
    return packet
예제 #22
0
파일: dpr.py 프로젝트: AlexKano/pmax
def ac_fail(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 41, chr(open))
    return packet
예제 #23
0
파일: dpr.py 프로젝트: AlexKano/pmax
def clear_alarm_memory(long_id, short_id):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 239, chr(Config.NO_VALUE))
    return packet
예제 #24
0
파일: dpr.py 프로젝트: AlexKano/pmax
def partition(long_id, short_id, partition_bitmap=0):
    packet = prutils.make_device_packet(long_id, short_id, Config.SET, 118, chr(partition_bitmap))
    return packet
예제 #25
0
def supervision(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 116,
                                        chr(open))
    return packet
예제 #26
0
def tamper(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 39,
                                        chr(open))
    return packet
예제 #27
0
def aux_simple(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.SET, 74,
                                        chr(open))
    return packet
예제 #28
0
def low_battery(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 40,
                                        chr(open))
    return packet
예제 #29
0
def ac_fail(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 41,
                                        chr(open))
    return packet
예제 #30
0
def smoke_trouble(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 46,
                                        chr(open))
    return packet
예제 #31
0
def jamming(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 48,
                                        chr(open))
    return packet
예제 #32
0
def flood(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 16,
                                        chr(open))
    return packet
예제 #33
0
def heat_sensor(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 10,
                                        chr(open))
    return packet
예제 #34
0
def partition(long_id, short_id, partition_bitmap=0):
    packet = prutils.make_device_packet(long_id, short_id, Config.SET, 118,
                                        chr(partition_bitmap))
    return packet
예제 #35
0
파일: dpr.py 프로젝트: AlexKano/pmax
def device_type(long_id, short_id, type, subtype):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 237, chr(type) + chr(subtype))
    return packet
예제 #36
0
def device_type(long_id, short_id, type, subtype):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 237,
                                        chr(type) + chr(subtype))
    return packet
예제 #37
0
def probe_disconnected(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 50,
                                        chr(open))
    return packet
예제 #38
0
def clear_alarm_memory(long_id, short_id):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 239,
                                        chr(Config.NO_VALUE))
    return packet
예제 #39
0
파일: dpr.py 프로젝트: AlexKano/pmax
def smoke_trouble(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 46, chr(open))
    return packet
예제 #40
0
def update(long_id, short_id):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 253,
                                        chr(Config.NO_VALUE))
    return packet
예제 #41
0
파일: dpr.py 프로젝트: AlexKano/pmax
def probe_disconnected(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 50, chr(open))
    return packet
예제 #42
0
def glass_break(long_id, short_id):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 6,
                                        chr(Config.VIOLATED))
    return packet
예제 #43
0
def emergency(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 35,
                                        chr(open))
    return packet
예제 #44
0
파일: dpr.py 프로젝트: AlexKano/pmax
def aux(long_id, short_id, open):
    bMask = 0xFF * open  # Open all 8 auxilary inputs, according to mask 0b11111111 = 0xFF
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 17, chr(bMask))
    return packet
예제 #45
0
def temperature(long_id, short_id, temperature):
    temperature = int(((temperature + 40.0) * 2) + 1)
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 24,
                                        chr(temperature))
    return packet
예제 #46
0
파일: dpr.py 프로젝트: AlexKano/pmax
def passive_motion_with_index(long_id, short_id, index):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 19, chr(Config.VIOLATED) + chr(index))
    return packet
예제 #47
0
def aux(long_id, short_id, open):
    bMask = 0xFF * open  #Open all 8 auxilary inputs, according to mask 0b11111111 = 0xFF
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 17,
                                        chr(bMask))
    return packet
예제 #48
0
파일: dpr.py 프로젝트: AlexKano/pmax
def temperature(long_id, short_id, temperature):
    temperature = int(((temperature + 40.0) * 2) + 1)
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 24, chr(temperature))
    return packet
예제 #49
0
파일: dpr.py 프로젝트: AlexKano/pmax
def aux_simple(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.SET, 74, chr(open))
    return packet
예제 #50
0
파일: dpr.py 프로젝트: AlexKano/pmax
def fire_alarm(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 34, chr(open))
    return packet
예제 #51
0
파일: dpr.py 프로젝트: AlexKano/pmax
def supervision(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 116, chr(open))
    return packet
예제 #52
0
파일: dpr.py 프로젝트: AlexKano/pmax
def emergency(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 35, chr(open))
    return packet
예제 #53
0
파일: dpr.py 프로젝트: AlexKano/pmax
def show_locally_link_quality(long_id, short_id, enable):
    action = Config.ENABLE
    if enable == 0:
        action = Config.DISABLE
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 142, chr(action))
    return packet
예제 #54
0
파일: dpr.py 프로젝트: AlexKano/pmax
def tamper(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 39, chr(open))
    return packet
예제 #55
0
def switch_magnetic(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 8,
                                        chr(open))
    return packet
예제 #56
0
파일: dpr.py 프로젝트: AlexKano/pmax
def low_battery(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 40, chr(open))
    return packet
예제 #57
0
파일: dpr.py 프로젝트: AlexKano/pmax
def update(long_id, short_id):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 253, chr(Config.NO_VALUE))
    return packet
예제 #58
0
def gas_sensor_trouble(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 52,
                                        chr(open))
    return packet
예제 #59
0
파일: dpr.py 프로젝트: AlexKano/pmax
def flood(long_id, short_id, open):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 16, chr(open))
    return packet
예제 #60
0
def active_barrier(long_id, short_id):
    packet = prutils.make_device_packet(long_id, short_id, Config.REPORT, 4,
                                        chr(Config.VIOLATED))
    return packet