Commit ab966bae authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Merge branch 'development' into 'master'

Checked if the write operation has been successfull.

See merge request !2
parents 9ac50207 eb7039a4
Pipeline #7148 passed with stages
in 1 minute and 16 seconds
......@@ -349,11 +349,11 @@ uint8_t CModelCarDriverBase::get_id(void)
std::list<std::string> events;
events.push_back(this->new_info_event_id);
this->send_request(ID_ARD_ACT_REQUEST,0,NULL);
try{
this->send_request(ID_ARD_ACT_REQUEST,0,NULL);
this->event_server->wait_all(events,100);
}
catch(CEventTimeoutException &e){
catch(...){
return -1;
}
......@@ -362,7 +362,7 @@ uint8_t CModelCarDriverBase::get_id(void)
void CModelCarDriverBase::send_request(uint8_t id, uint8_t data_length, uint8_t *data)
{
uint8_t req_frame_size=sizeof(uint8_t)+sizeof(uint8_t)+sizeof(TTimeStampUnion)+data_length+sizeof(uint16_t),stuffed_frame_size;
uint8_t req_frame_size=sizeof(uint8_t)+sizeof(uint8_t)+sizeof(TTimeStampUnion)+data_length+sizeof(uint16_t),stuffed_frame_size,num_written;
uint16_t crc_value;
uint8_t *frame=NULL,*stuffed_frame=NULL;
......@@ -376,10 +376,12 @@ void CModelCarDriverBase::send_request(uint8_t id, uint8_t data_length, uint8_t
this->stuff_frame(frame,req_frame_size,&stuffed_frame,stuffed_frame_size);
this->port_mutex.enter();
this->serial_port->write(stuffed_frame,stuffed_frame_size);
num_written=this->serial_port->write(stuffed_frame,stuffed_frame_size);
this->port_mutex.exit();
delete[] stuffed_frame;
delete[] frame;
if(num_written!=stuffed_frame_size)
throw CException(_HERE_,"Failed to send request");
}
void CModelCarDriverBase::stuff_frame(uint8_t *frame_in, uint8_t size_in, uint8_t **frame_out, uint8_t & size_out)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment