Exemplo n.º 1
0
/**Prepare status response packet*/
int srv_prepare_status_resp(srv_t *srv) {
  char details;
  details = 0;

  form_status_resp(srv->resp,srv->status,0x0D);

  //FILLERS FOR RADAR STATE PARAMS ->
  form_status_temps(srv->resp,
                    -1,-2,-3);
//		    (unsigned short)(((double)rand()/USHRT_MAX)*30.0),
//		    (unsigned short)(((double)rand()/USHRT_MAX)*30.0),
//		    (unsigned short)(((double)rand()/USHRT_MAX)*30.0));
  form_status_amperage(srv->resp,
                       4,5,6);
//		       (unsigned short)(((double)rand()/USHRT_MAX)*30.0),
//		       (unsigned short)(((double)rand()/USHRT_MAX)*30.0),
//		       (unsigned short)(((double)rand()/USHRT_MAX)*30.0));
  form_status_voltage(srv->resp,
                      -7,-8,9,10);
//		      (unsigned short)(((double)rand()/USHRT_MAX)*30.0),
//		      (unsigned short)(((double)rand()/USHRT_MAX)*30.0),
//		      (unsigned short)(((double)rand()/USHRT_MAX)*30.0),
//		      (unsigned short)(((double)rand()/USHRT_MAX)*30.0));
  //<-
  return sizeof(status_resp_t);
}
Exemplo n.º 2
0
int srv_prepare_status_resp(srv_t *srv) {  
  form_status_resp(srv->resp,srv->status,0);  
  
  form_status_temps(srv->resp,
		    (unsigned short)(((double)rand()/INT_MAX)*30.0),
		    (unsigned short)(((double)rand()/INT_MAX)*30.0),
		    (unsigned short)(((double)rand()/INT_MAX)*30.0));
  form_status_amperage(srv->resp,
		       (unsigned short)(((double)rand()/INT_MAX)*30.0),
		       (unsigned short)(((double)rand()/INT_MAX)*30.0),
		       (unsigned short)(((double)rand()/INT_MAX)*30.0));
  form_status_voltage(srv->resp,
		      (unsigned short)(((double)rand()/INT_MAX)*30.0),
		      (unsigned short)(((double)rand()/INT_MAX)*30.0),
		      (unsigned short)(((double)rand()/INT_MAX)*30.0),
		      (unsigned short)(((double)rand()/INT_MAX)*30.0));
  
  return sizeof(status_resp_t);
}