示例#1
0
def case5():
    load()
    arr = bytearray()
    for i in range(501):
        arr.append(i & 0xff)
    req, error = dcompy.call(1, 0, 0x1234, 1, 0, arr)
    print('error:0x%x' % error)
    print_hex(req)
示例#2
0
def case1():
    lagan.load(0)
    lagan.set_filter_level(lagan.LEVEL_DEBUG)
    dcompy.set_filter_level(lagan.LEVEL_DEBUG)

    load()
    req, error = dcompy.call(0, 0, 0x1234, 1, 10000, bytearray([1, 2, 3]))
    print('0x%x' % error)
    print_hex(req)
示例#3
0
def case6():
    lagan.load(0)
    lagan.set_filter_level(lagan.LEVEL_DEBUG)
    dcompy.set_filter_level(lagan.LEVEL_DEBUG)

    load()
    arr = bytearray()
    for i in range(501):
        arr.append(i & 0xff)
    req, error = dcompy.call(1, 0, 0x1234, 1, 3000, arr)
    print('error:0x%x' % error)
    print_hex(req)
示例#4
0
def call(pipe: int, dst_ia: int, rid: int, timeout: int, req: bytearray) -> (bytearray, int):
    """
    RPC同步调用
    :param pipe: 通信管道
    :param dst_ia: 目标ia地址
    :param rid: 服务号
    :param timeout: 超时时间,单位:ms.为0表示不需要应答
    :param req: 请求数据.无数据可填bytearray()或者None
    :return: 返回值是应答字节流和错误码.错误码非0表示调用失败
    """
    if param.parent.ia == utz.IA_INVALID or not param.parent.is_conn:
        return None, dcom.SYSTEM_ERROR_RX_TIMEOUT

    if pipe >= fpipe.PIPE_NET:
        pipe = param.parent.pipe
    return dcom.call(config.PROTOCOL_NUM, pipe, dst_ia, rid, timeout, req)
示例#5
0
def case3():
    load()
    req, error = dcompy.call(0, 0, 0x1234, 1, 0, bytearray([1, 2, 3]))
    print('0x%x' % error)
    print_hex(req)