#! /usr/bin/env python3

import twe_parser

code = b':7881150175810000380026C9000C04220200FFFFFFFFFFA7'
responce = twe_parser.parse( code )

print( responce )
print( "-- Sorce Device ID")
print( responce.SID )
print( "-- Command")
print( responce.COMMAND )
print( "-- Application Packet")
print( responce.PACKET )
print( "-- Protocol Version")
print( responce.PROTOCOL )
print( "-- LQI")
print( responce.LQI )
print( "-- Source Serial Number")
print( responce.SNumber )
print( "-- Destination Device ID")
print( responce.DID )
print( "-- Timestamp ( 1 second = 64 )")
print( responce.TIMESTAMP )
print( "-- Related flag ( Related packet is 1 )")
print( responce.RELATED )
print( "-- Device Current Voltage ( mA )")
print( responce.VOLTAGE )
print( "-- None")
print( responce.NONE )
print( "-- Digital IO")
print( responce.DIN )
print( "-- Digital IO Changed bit")
print( responce.DICANGE )
print( "-- AD1 Value ( 0-2000mV / 16 )")
print( responce.AD1 )
print( "-- AD2Value ( 0-2000mV / 16 )")
print( responce.AD2 )
print( "-- AD3 Value ( 0-2000mV / 16 )")
print( responce.AD3 )
print( "-- AD4 Value ( 0-2000mV / 16 )")
print( responce.AD4 )
print( "-- AD Valiavle Compensation Value")
print( responce.ADCOMP )
print( "-- Check SUM")
print( responce.SUM )


print( "-- Digital IN 1 status" )
print( responce.D1 )
print( "-- Digital IN 2 status" )
print( responce.D2 )
print( "-- Digital IN 3 status" )
print( responce.D3 )
print( "-- Digital IN 4 status" )
print( responce.D4 )

print( "-- dBm [dBm] ( Reference value )")
print( responce.rsrp() )