mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
Merge branch 'newrpc' of github.com:naves-thiago/elua into newrpc
This commit is contained in:
commit
2f97972fbf
@ -52,6 +52,9 @@ void transport_open_listener(lua_State *L, ServerHandle *handle)
|
||||
|
||||
handle->ltpt.fd = ( int )uart_id;
|
||||
handle->ltpt.tmr_id = tmr_id;
|
||||
|
||||
// Setup uart
|
||||
platform_uart_setup( (unsigned int) uart_id, 115200, 8, PLATFORM_UART_PARITY_NONE, PLATFORM_UART_STOPBITS_1 );
|
||||
}
|
||||
|
||||
// Open Connection / Client
|
||||
@ -75,6 +78,10 @@ int transport_open_connection(lua_State *L, Handle *handle)
|
||||
|
||||
handle->tpt.fd = ( int )uart_id;
|
||||
handle->tpt.tmr_id = tmr_id;
|
||||
|
||||
// Setup uart
|
||||
platform_uart_setup( (unsigned int) uart_id, 115200, 8, PLATFORM_UART_PARITY_NONE, PLATFORM_UART_STOPBITS_1 );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -132,7 +139,8 @@ void transport_write_buffer( Transport *tpt, const u8 *buffer, int length )
|
||||
TRANSPORT_VERIFY_OPEN;
|
||||
|
||||
for( i = 0; i < length; i ++ )
|
||||
platform_uart_send( CON_UART_ID, buffer[ i ] );
|
||||
platform_uart_send( tpt->fd, buffer[ i ] );
|
||||
// platform_uart_send( CON_UART_ID, buffer[ i ] );
|
||||
}
|
||||
|
||||
// Check if data is available on connection without reading:
|
||||
|
@ -1142,6 +1142,8 @@ static int rpc_connect( lua_State *L )
|
||||
handle = handle_create ( L );
|
||||
transport_open_connection( L, handle );
|
||||
|
||||
set_adispatch_buff( -1 );
|
||||
|
||||
transport_write_u8( &handle->tpt, RPC_CMD_CON );
|
||||
client_negotiate( &handle->tpt );
|
||||
}
|
||||
@ -1584,7 +1586,6 @@ static int rpc_adispatch_helper( lua_State *L, ServerHandle * handle )
|
||||
connect = 1;
|
||||
}
|
||||
|
||||
// c = platform_uart_recv( t->fd, t->tmr_id, 0 );
|
||||
c = transport_get_char( t );
|
||||
|
||||
if ( c < 0 )
|
||||
@ -1599,6 +1600,7 @@ static int rpc_adispatch_helper( lua_State *L, ServerHandle * handle )
|
||||
if ( connect ) // Are we connecting ?
|
||||
{
|
||||
// We got a connection
|
||||
set_adispatch_buff( c );
|
||||
if ( transport_read_u8( &handle->atpt ) == RPC_CMD_CON )
|
||||
server_negotiate( &handle->atpt );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user