Example #1
0
int 
DapResultRequest (int sd, int id, struct DSResult *res, struct DSAPindication *di)
{
	int				  result;
	PE				  res_pe;
	struct RoSAPindication	  roi_s;
	struct RoSAPindication	* roi = &(roi_s);
	struct RoSAPpreject		* rop = &(roi->roi_preject);

	if (DapEncodeResult (&(res_pe), res) != OK) {
		LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapResultRequest: Encoding failed"));
		return (dsapreject (di, DP_INVOKE, id, NULLCP, "Failed to encode operation result"));
	}

	watch_dog ("RoResultRequest (DAP)");
	result = RoResultRequest (sd, id, res->result_type, res_pe, ROS_NOPRIO, roi);
	watch_dog_reset();

	if (result != OK) {
		if (ROS_FATAL (rop->rop_reason) || (rop->rop_reason == ROS_PARAMETER)) {
			LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapResultRequest(): Fatal rejection"));
			return (dsaplose (di, DP_INVOKE, NULLCP, "RoResultRequest failed"));
		} else {
			LLOG (log_dsap, LLOG_EXCEPTIONS, ("DapResultRequest(): Non-Fatal rejection"));
			return (dsapreject (di, DP_INVOKE, id, NULLCP, "RoResultRequest failed"));
		}
	}

	if (res_pe != NULLPE)
		pe_free (res_pe);
	return (OK);
}
Example #2
0
void timer_wait_reset(void){
  _delay_ms(10);
  watch_dog(T_WAIT);
  ///* Return when timer>2 seconds.
  while(!(TIFR & _BV(OCF1A)));
  ///* Restart timer
  timer_reset_two_sec();  
}
Example #3
0
/**
 * @brief Communication with Power
 *
 * Obtains the health monitoring data by communcicating with Power microcontroller.
 */
void power(void){
  /// Start watchdog for power tasks
  watch_dog(T_POWER);
  
  ///Every 1.5 minutes get health monitoring data from the power uC
  if(Time % 90 == 0)
  {
    get_HM_data();
  }
}