Skip to content

Commit

Permalink
Emulator actual embodiment: misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
divanchykhin committed May 12, 2015
1 parent 76d233e commit 1c95c74
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion tests/emulator/sa_client_central_unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ int main_loop()
case COMMLAYER_RET_TIMEOUT:
{
// regular processing will be done below in the next block
printf( "no reply from comm stack received; the last message (if any) will be resent by timer\n" );
printf( "just waiting...\n" );
zepto_response_to_request( MEMORY_HANDLE_MAIN_LOOP );
goto wait_for_comm_event;
break;
Expand Down Expand Up @@ -130,6 +130,7 @@ int main_loop()
zepto_response_to_request( MEMORY_HANDLE_MAIN_LOOP );

send_command:
printf( "=============================================Msg is about to be sent; rq_size: %d, rsp_size: %d\n", ugly_hook_get_request_size( MEMORY_HANDLE_MAIN_LOOP ), ugly_hook_get_response_size( MEMORY_HANDLE_MAIN_LOOP ) );
send_to_commm_stack( MEMORY_HANDLE_MAIN_LOOP );
}

Expand Down
2 changes: 2 additions & 0 deletions tests/emulator/sa_client_comm_stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ int main_loop()
wait_for_comm_event:
ret_code = wait_for_communication_event( MEMORY_HANDLE_MAIN_LOOP, timer_val*100 ); // TODO: recalculation
zepto_response_to_request( MEMORY_HANDLE_MAIN_LOOP );
printf( "=============================================Msg wait event; ret = %d, rq_size: %d, rsp_size: %d\n", ret_code, ugly_hook_get_request_size( MEMORY_HANDLE_MAIN_LOOP ), ugly_hook_get_response_size( MEMORY_HANDLE_MAIN_LOOP ) );

switch ( ret_code )
{
Expand Down Expand Up @@ -314,6 +315,7 @@ int main_loop()

// 5. SAGDP
client_received:
printf( "@client_received: rq_size: %d, rsp_size: %d\n", ugly_hook_get_request_size( MEMORY_HANDLE_MAIN_LOOP ), ugly_hook_get_response_size( MEMORY_HANDLE_MAIN_LOOP ) );
sa_get_time( &(tact.tv) ); tact.action = 0;
ret_code = handler_sagdp_receive_hlp( &tact, NULL, MEMORY_HANDLE_MAIN_LOOP, &sagdp_data );
if ( ret_code == SAGDP_RET_NEED_NONCE )
Expand Down
4 changes: 2 additions & 2 deletions tests/emulator/sa_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Copyright (C) 2015 OLogN Technologies AG
*******************************************************************************/


#define MODEL_IN_EFFECT 1
//#define MODEL_IN_EFFECT 2
//#define MODEL_IN_EFFECT 1
#define MODEL_IN_EFFECT 2


#include "sa-common.h"
Expand Down
8 changes: 6 additions & 2 deletions tests/emulator/sa_test_control_prog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,15 @@ uint8_t default_test_control_program_accept_reply_continue( void* control_prog_s
}
else
{
assert( ps->chain_ini_size == 2 );
// assert( ps->chain_ini_size == 2 );
// need to add explicit exit command to specify packet status-in-chain of the reply
zepto_write_uint8( reply, ZEPTOVM_OP_EXIT );
zepto_write_uint8( reply, (uint8_t)SAGDP_P_STATUS_TERMINATING ); // TODO: if padding is required, add necessary data here
reply_sz = zepto_writer_get_response_size( reply );
}
uint8_t hdr = SACCP_NEW_PROGRAM; //TODO: we may want to add extra headers
zepto_write_prepend_byte( reply, hdr );
zepto_write_prepend_byte( reply, SAGDP_P_STATUS_FIRST );
zepto_write_prepend_byte( reply, SAGDP_P_STATUS_INTERMEDIATE );


// return status
Expand Down
4 changes: 2 additions & 2 deletions tests/emulator/saccp_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ uint8_t handler_sacpp_continue_chain( MEMORY_HANDLE mem_h, void* control_prog_st
uint8_t hdr = SACCP_NEW_PROGRAM; //TODO: we may want to add extra headers
zepto_write_prepend_byte( mem_h, hdr );
zepto_write_prepend_byte( mem_h, SAGDP_P_STATUS_FIRST );*/
default_test_control_program_start_new( control_prog_state, mem_h );
default_test_control_program_accept_reply_continue( control_prog_state, mem_h );
return SACCP_RET_PASS_LOWER;
}

uint8_t saccp_control_program_process_incoming( MEMORY_HANDLE mem_h, parser_obj* po, uint16_t sz, void* control_prog_state )
{
{assert(0);
// TODO: process
/* uint8_t buff[100];
memset( buff, '?', 99 );
Expand Down

0 comments on commit 1c95c74

Please sign in to comment.