4848
4949char mock_strings [8 ] = MOCK_STRINGS ;
5050char mock_binary [4 ] = MOCK_BINARY ;
51- #define MOCK_PEERNAME_0 "PEER0 \x00"
52- #define MOCK_PEERNAME_1 "PEER1 \x00"
51+ #define MOCK_PEERNAME_0 "TEST_MOCK_1 \x00"
52+ #define MOCK_PEERNAME_1 "TEST_MOCK_2 \x00"
5353char mock_peername_0 [6 ] = MOCK_PEERNAME_0 ;
5454char mock_peername_1 [6 ] = MOCK_PEERNAME_1 ;
5555
@@ -65,6 +65,25 @@ rob_ret_val_t mock_after_comms(bool is_sending, bool first_call)
6565 return ROB_OK ;
6666}
6767
68+ rob_ret_val_t mock_send_message (robusto_peer_t * peer ,uint8_t * data , uint32_t data_length , bool receipt )
69+ {
70+
71+ if (strcmp (peer -> name , MOCK_PEERNAME_0 ) != 0 )
72+ {
73+ ROB_LOGE ("MOCK" , "mock_send_message: The peer name it not '%s', but '%s'" , MOCK_PEERNAME_0 , peer -> name );
74+ }
75+ rob_ret_val_t ret = ROB_OK ;
76+ peer -> mock_info .last_send = r_millis ();
77+ if (receipt )
78+ {
79+ peer -> mock_info .last_sent_heartbeat = r_millis ();
80+ }
81+ ROB_LOGI ("MOCK" , "mock_send_message: Mock sending %lu bytes to peer %s" , data_length , peer -> name );
82+ rob_log_bit_mesh (ROB_LOG_INFO , "MOCK" , data , data_length );
83+ return ret ;
84+ }
85+
86+
6887
6988rob_ret_val_t mock_read_receipt (robusto_peer_t * peer , uint8_t * * dest_data )
7089{
@@ -90,26 +109,26 @@ int mock_read_data(uint8_t **rcv_data, robusto_peer_t **peer)
90109 int length = 0 ;
91110 if ((message_expectation == MMI_STRINGS ) || (message_expectation == MMI_STRINGS_ASYNC ))
92111 {
93- length = robusto_make_strings_message (MSG_MESSAGE , 0 , 0 , (uint8_t * )& mock_strings , 8 , rcv_data );
94- * peer = robusto_peers_find_peer_by_name ("TEST_MOCK " );
112+ length = robusto_make_multi_message_internal (MSG_MESSAGE , 0 , 0 , (uint8_t * )& mock_strings , 8 , NULL , 0 , rcv_data );
113+ * peer = robusto_peers_find_peer_by_name ("TEST_MOCK_1 " );
95114 if ((* peer ) != NULL ) {
96115 (* peer )-> mock_info .last_receive = r_millis ();
97116 } else {
98- ROB_LOGE ("MOCK" , "TEST_MOCK not found!" );
117+ ROB_LOGE ("MOCK" , "TEST_MOCK_1 not found!" );
99118 }
100119
101120 }
102121 else if (message_expectation == MMI_BINARY )
103122 {
104- length = robusto_make_binary_message (MSG_MESSAGE , 0 , 0 , (uint8_t * )& mock_binary , 4 , rcv_data );
123+ length = robusto_make_multi_message_internal (MSG_MESSAGE , 0 , 0 , NULL , 0 , (uint8_t * )& mock_binary , 4 , rcv_data );
105124 }
106125 else if (message_expectation == MMI_SERVICE )
107126 {
108- length = robusto_make_binary_message (MSG_MESSAGE , 1959 , 0 , (uint8_t * )& mock_binary , 4 , rcv_data );
127+ length = robusto_make_multi_message_internal (MSG_MESSAGE , 1959 , 0 , NULL , 0 , (uint8_t * )& mock_binary , 4 , rcv_data );
109128 }
110129 else if (message_expectation == MMI_MULTI )
111130 {
112- length = robusto_make_multi_message (MSG_MESSAGE , 0 , 0 , (uint8_t * )& mock_strings , 8 , (uint8_t * )& mock_binary , 4 , rcv_data );
131+ length = robusto_make_multi_message_internal (MSG_MESSAGE , 0 , 0 , (uint8_t * )& mock_strings , 8 , (uint8_t * )& mock_binary , 4 , rcv_data );
113132 }
114133 else if (message_expectation == MMI_BINARY_RESTRICTED )
115134 {
0 commit comments