Example #1
0
import views
from core.urls import pattern

"""
the urls control where are the request goes!
dispatch method will return a Dicts to urlpatterns
and then,you can call 'view.register' by nickname 'register'
If you have emergency thing to do,you can reset the value of Dicts
Example, when the position run on the views.position,you want to
get terminal information,so on the linux, CTRL+Z will raise a TSTIP
signal,and then process catch it, and do some change to urlpatterns
so you can make position run on the views.terminal_info ....
"""
urlpatterns = pattern(
        ('ter_reg_req', views.register2),
        ('ser_reg_rsp', views.register),
        ('ter_aut_req', views.common),
        ('heart_beat', views.common),
        ('common', views.common),
        ('position', views.position),
        ('get_ter_info_rsp', views.terminal_info),
        ('get_ter_attr_rsp', views.terminal_attr),
)

if __name__ == '__main__':
    print urlpatterns
Example #2
0
"""
from core.urls import pattern
from core.dns import dns_key, dns_k2v
from utils.authentication import simple_auth

#AUTH_CODE = simple_auth()
AUTH_CODE = (1, 2, 3, 4)
SYSTEM_CMD = pattern(
    ('sys_ok', (1, )),
    ('sys_err', (2, )),
    ('sys_crc', (1, )),
    ('sys_auth', AUTH_CODE),
    ('sys_product', (0, 1)),
    ('sys_fixed_msg_attr', (0, 5)
     ),  # This is a fixed value ,you should calculate the msg attr yourself!
    ('sys_fixed_msg_attr2',
     (0, 6)),  # Empty message content for check terminal setting
    ('sys_msg_product', (0, 0)),
    ('register_rsp', (220, )),
    ('register_len', (0, 8)),
    ('com_serial_id', (0, 1)),
    ('auth_code', (1, 2, 3, 4)),
    ('heart_beat_attr', (0, 0)),
)
"""
ser     : server
ter     : terminal
req     : request
rsp     : response
reg     : register
aut     : authentication
Example #3
0
import views
from core.urls import pattern
"""
the urls control where are the request goes!
dispatch method will return a Dicts to urlpatterns
and then,you can call 'view.register' by nickname 'register'
If you have emergency thing to do,you can reset the value of Dicts
Example, when the position run on the views.position,you want to
get terminal information,so on the linux, CTRL+Z will raise a TSTIP
signal,and then process catch it, and do some change to urlpatterns
so you can make position run on the views.terminal_info ....
"""
urlpatterns = pattern(('load_car', views.load_car), )

if __name__ == '__main__':
    print urlpatterns
Example #4
0
"""
0x8100 Poor readability,so we need to give a name
to it.how about 'ter_reg_req' as it nickname!
"""
from core.urls import pattern
from core.dns import dns_key, dns_k2v
from utils.authentication import simple_auth

AUTH_CODE = simple_auth()
SYSTEM_CMD = pattern(
        ('sys_ok', (0,)),
        ('sys_err', (2, 0)),
        ('sys_crc', (1,)),
        ('sys_auth', AUTH_CODE),
        ('sys_product', (0, 1)),
        ('sys_fixed_msg_attr', (0, 5)),  # This is a fixed value ,you should calculate the msg attr yourself!
        ('sys_fixed_msg_attr2', (0, 0))  # Empty message content for check terminal setting
)

"""
ser     : server
ter     : terminal
req     : request
rsp     : response
reg     : register
aut     : authentication
loc     : location
com     : commonly
get     : get
info    : information
attr    : attribute
Example #5
0
"""
0x8100 Poor readability,so we need to give a name
to it.how about 'ter_reg_req' as it nickname!
"""
from core.urls import pattern
from core.dns import dns_key, dns_k2v
from utils.authentication import simple_auth

#AUTH_CODE = simple_auth()
AUTH_CODE = (1, 2)
SYSTEM_CMD = pattern(
    ('sys_ok', (1, )),
    ('sys_err', (2, )),
    ('sys_crc', (1, )),
    ('sys_auth', AUTH_CODE),
    ('sys_product', (0, 1)),
    ('sys_fixed_msg_attr', (0, 5)
     ),  # This is a fixed value ,you should calculate the msg attr yourself!
    ('sys_fixed_msg_attr2',
     (0, 6)),  # Empty message content for check terminal setting
    ('sys_msg_product', (0, 0)),
)
"""
ser     : server
ter     : terminal
req     : request
rsp     : response
reg     : register
aut     : authentication
loc     : location
com     : commonly
get     : get
Example #6
0
#!coding:utf-8
import views
from core.urls import pattern

"""
the urls control where are the request goes!
dispatch method will return a Dicts to urlpatterns
and then,you can call 'view.register' by nickname 'register'
If you have emergency thing to do,you can reset the value of Dicts
Example, when the position run on the views.position,you want to
get terminal information,so on the linux, CTRL+Z will raise a TSTIP
signal,and then process catch it, and do some change to urlpatterns
so you can make position run on the views.terminal_info ....
"""
# 定义了 消息类型,所对应的应答函数
urlpatterns = pattern(
        ('load_car', views.load_car),
        ('actual_msg_report', views.actual_msg_report),
        ('reissue_msg_report', views.actual_msg_report),
        ('logout_car', views.logout_car),
        ('ter_cor_time', views.ter_cor_time),
        ('heartbeat', views.heartbeat),
        ('err_return', views.err_return),
        ('ter_register', views.ter_register)
)

if __name__ == '__main__':
    print urlpatterns
Example #7
0
import views
from core.urls import pattern
"""
the urls control where are the request goes!
dispatch method will return a Dicts to urlpatterns
and then,you can call 'view.register' by nickname 'register'
If you have emergency thing to do,you can reset the value of Dicts
Example, when the position run on the views.position,you want to
get terminal information,so on the linux, CTRL+Z will raise a TSTIP
signal,and then process catch it, and do some change to urlpatterns
so you can make position run on the views.terminal_info ....
"""
urlpatterns = pattern(
    ('load_car', views.load_car),
    ('actual_msg_report', views.actual_msg_report),
    ('reissue_msg_report', views.actual_msg_report),
    ('logout_car', views.logout_car),
    ('terminal_correcting_time', views.terminal_correcting_time),
    ('heartbeat', views.heartbeat),
    #('err_return', views.err_return),
)

if __name__ == '__main__':
    print urlpatterns
Example #8
0
def hey_fun(request):
    print 'the request is ', request
    request.sendall('hey! see you again!')


def bye_fun(request):
    print 'bye, see you !'
    request.sendall('okay!see you')


"""
You can see,each function have a nickname!
"""
urlpatterns = pattern(
        ('hey', hey_fun),
        ('bye', bye_fun)
)


def reflect(flag, request):
    urlpatterns[flag](request)


"""
flag is a key of function Dicts!
"""


def dispatch_sample(flag, request):
    if flag:
        reflect(flag, request)
Example #9
0
to it.how about 'ter_reg_req' as it nickname!
"""
from core.urls import pattern
from core.dns import dns_key, dns_k2v
from utils.authentication import simple_auth

#AUTH_CODE = simple_auth()
AUTH_CODE = (1, 2)
SYSTEM_CMD = pattern(
    ('sys_com_rsp', (238, )),
    ('sys_fixed_msg_attr3', (0, 32)),
    ('sys_ok', (0, )),
    ('err_code', (0, 0, 0, 0)),
    ('sys_inf_code', (1, 1)),
    ('sys_crc', (1, )),
    ('sys_auth', AUTH_CODE),
    ('sys_product', (0, 1)),
    ('sys_fixed_msg_attr', (0, 4)
     ),  # This is a fixed value ,you should calculate the msg attr yourself!
    ('sys_fixed_msg_attr2',
     (0, 6)),  # Empty message content for check terminal setting
    ('sys_msg_product', (0, 0)),
)
"""
ser     : server
ter     : terminal
req     : request
rsp     : response
reg     : register
aut     : authentication
loc     : location
Example #10
0
import views
from core.urls import pattern
"""
the urls control where are the request goes!
dispatch method will return a Dicts to urlpatterns
and then,you can call 'view.register' by nickname 'register'
If you have emergency thing to do,you can reset the value of Dicts
Example, when the position run on the views.position,you want to
get terminal information,so on the linux, CTRL+Z will raise a TSTIP
signal,and then process catch it, and do some change to urlpatterns
so you can make position run on the views.terminal_info ....
"""
urlpatterns = pattern(
    ('t_register', views.t_register),
    ('t_login', views.t_login),
    ('t_logout', views.t_logout),
    ('t_relogin', views.t_relogin),
    ('t_keep_active', views.t_keep_active),
    ('t_err_rep', views.t_actual_msg_rep),
    ('t_actual_msg_rep', views.t_actual_msg_rep),
    ('t_E_call', views.t_E_call),
    ('t_UBI_rep', views.t_UBI_rep),
    ('t_update', views.t_update),
)

if __name__ == '__main__':
    print urlpatterns
Example #11
0
AUTH_CODE = (1, 2)
SYSTEM_CMD = pattern(
    ('sys_ok', (0, )),
    ('sys_err', (1, )),
    ('sys_call_back_num',
     (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)),
    ('sys_reg_ACK_len', (0, 21)),
    ('sys_bid', (1, 2, 3, 4)),
    ('sys_reg_result_ok', (121, )),
    ('sys_reg_result_err', (168, )),
    ('sys_reg_req_mid', (2, )),
    ('login_mid_cha', (2, )),
    ('login_mid_err', (4, )),
    ('login_mid_ok', (5, )),
    ('login_cha_md5', (5, )),
    ('login_random', (5, )),
    ('login_aesrandom', (16, )),
    ('login_serial', (1, )),
    ('login_time', (8, )),
    ('login_work_win', (8, )),
    ('login_link_hb', (8, )),
    ('sys_crc', (1, )),
    ('sys_auth', AUTH_CODE),
    ('sys_product', (0, 1)),
    ('sys_fixed_msg_attr', (0, 5)
     ),  # This is a fixed value ,you should calculate the msg attr yourself!
    ('sys_fixed_msg_attr2',
     (0, 6)),  # Empty message content for check terminal setting
    ('sys_msg_product', (0, 0)),
)
"""
Example #12
0
import views
from core.urls import pattern

"""
the urls control where are the request goes!
dispatch method will return a Dicts to urlpatterns
and then,you can call 'view.register' by nickname 'register'
If you have emergency thing to do,you can reset the value of Dicts
Example, when the position run on the views.position,you want to
get terminal information,so on the linux, CTRL+Z will raise a TSTIP
signal,and then process catch it, and do some change to urlpatterns
so you can make position run on the views.terminal_info ....
"""
urlpatterns = pattern(
        ('ser_reg_rsp', views.register),
        ('ter_aut_req', views.auth),
        ('position', views.position),
        ('get_ter_info_rsp', views.terminal_info),
        ('get_ter_attr_rsp', views.terminal_attr)
)

if __name__ == '__main__':
    print urlpatterns
Example #13
0
import views
from core.urls import pattern
"""
the urls control where are the request goes!
dispatch method will return a Dicts to urlpatterns
and then,you can call 'view.register' by nickname 'register'
If you have emergency thing to do,you can reset the value of Dicts
Example, when the position run on the views.position,you want to
get terminal information,so on the linux, CTRL+Z will raise a TSTIP
signal,and then process catch it, and do some change to urlpatterns
so you can make position run on the views.terminal_info ....
"""
urlpatterns = pattern(
    ('actual_msg_report', views.actual_msg_report),
    ('load_car', views.load_car),
    ('err_rep', views.err_rep),
    ('regular_err_rep', views.regular_err_rep),
    ('log', views.log),
    ('heart_beat', views.heart_beat),
)

if __name__ == '__main__':
    print urlpatterns