예제 #1
0
void CFE_ES_FormCDSName(char *FullCDSName, const char *CDSName, uint32 ThisAppId)
{
    char AppName[OS_MAX_API_NAME];

    CFE_ES_GetAppName(AppName, ThisAppId, OS_MAX_API_NAME);

    /* Ensure that AppName is null terminated */
    AppName[OS_MAX_API_NAME-1] = '\0';

    /* Complete formation of processor specific table name */
    sprintf(FullCDSName, "%s.%s", AppName, CDSName);

    return;
}   /* End of CFE_ES_FormCDSName() */
예제 #2
0
/*
**             Function Prologue
**
** Function Name:      EVS_SendEventInternal
** from: cfe_evs_utils.c in cFE 3.1, originally named EVS_SendEvent
**
** Purpose:  This routine sends an EVS event message out the software bus and all
**           enabled output ports if the calling application has been determined to
**           be registered and the event message is unfiltered
**
** Assumptions and Notes:
*/
int32 EVS_SendEventInternal(uint32 AppID, CFE_TIME_SysTime_t Time, uint16 EventID, uint16 EventType, char *EventString)
{
   int32              Status = CFE_SUCCESS;
   CFE_EVS_Packet_t   EVS_Packet;
   boolean            IsFiltered = FALSE;

   if(Status == CFE_SUCCESS)
   {
      if (!(IsFiltered))
      {
         /* Initialize CCSDS event packet */
         CFE_SB_InitMsg(&(EVS_Packet), CFE_EVS_EVENT_MSG_MID, sizeof(CFE_EVS_Packet_t), FALSE);

         /* Set the packet timestamp */
         CFE_SB_SetMsgTime((CFE_SB_Msg_t *) &EVS_Packet, Time);

         /* Initialize event message string */
         EVS_Packet.Message[0] = '\0';

         /* Obtain task and system information */
     /*    EVS_Packet.PacketID.SpacecraftID = OS_BSPGetSpacecraftId(); */
         CFE_ES_GetAppName(EVS_Packet.PacketID.AppName, AppID, OS_MAX_API_NAME);
      /*   EVS_Packet.PacketID.ProcessorID  = OS_BSPGetProcessorId(); */
         EVS_Packet.PacketID.EventID      = EventID;
         EVS_Packet.PacketID.EventType    = EventType;

         /* Copy message string to event packet message buffer */
         strncpy(EVS_Packet.Message, EventString, CFE_EVS_MAX_MESSAGE_LENGTH);

         /* Ensure that the packet is always terminated by a null character */
         EVS_Packet.Message[CFE_EVS_MAX_MESSAGE_LENGTH-1] = '\0';

         /* send event out software bus */
         Status = CFE_SB_SendMsg((CFE_SB_Msg_t *) &EVS_Packet);
      }
   }

   return Status;

} /* End EVS_SendEventInternal */
예제 #3
0
/*
**             Function Prologue
**
** Function Name:      CFE_EVS_SendEvent
**
** Purpose:  This routine sends an event message, with message ID containing the current 
**           processor/box and task ID as well as the eventID.
**
** Assumptions and Notes:
*/
int32 CFE_EVS_SendEvent (uint16 EventID, uint16 EventType, const char *Spec, ... )
{
	int32               Status = CFE_SUCCESS;
   char                BigBuf[CFE_EVS_MAX_MESSAGE_LENGTH];
   char                GTBigBuf[CFE_EVS_MAX_MESSAGE_LENGTH + 2];
   va_list             Ptr;
   CFE_EVS_Packet_t    EVS_Packet;
   uint32              AppID = 0xFFFFFFFF;

   /* Handle Preset Return Code */
   if (cfe_evs_api_return_value[CFE_EVS_SENDEVENT_PROC] !=  UTF_CFE_USE_DEFAULT_RETURN_CODE)
   {
      return cfe_evs_api_return_value[CFE_EVS_SENDEVENT_PROC];
   }

   /* Get application identifier */
   Status = CFE_ES_GetAppID(&AppID);

   if (Status == CFE_SUCCESS)
   {
	  if(UTF_AppID_Registered == FALSE)
      {
		char warning_text[120];
		strcpy (warning_text,"UTF WARNING: CFE_EVS_SendEvent called by application which is not ");
	 	strcat(warning_text,"registered for event services.\n");
        /* if the application is not registered for event services do not perform event service */
		UTF_put_text(warning_text);
      }

	  /* Obtain task and system information */
      /*EVS_Packet.PacketID.SpacecraftID = OS_BSPGetSpacecraftId();*/
      CFE_ES_GetAppName(EVS_Packet.PacketID.AppName, AppID, OS_MAX_API_NAME);
      /* EVS_Packet.PacketID.ProcessorID  = OS_BSPGetProcessorId();*/
      EVS_Packet.PacketID.EventID      = EventID;
      EVS_Packet.PacketID.EventType    = EventType;

      /* Copy message to event packet if long format is enabled */
      if (UTF_Long_Events_Enabled == TRUE)
      {
         va_start(Ptr, Spec);
         vsnprintf(GTBigBuf, CFE_EVS_MAX_MESSAGE_LENGTH +2, Spec, Ptr);
         va_end(Ptr);

         if(strlen(GTBigBuf) > CFE_EVS_MAX_MESSAGE_LENGTH)
		 {
			UTF_put_text ("Max Event Message Size Exceeded. Permitted %d; Actual %d\n",
			CFE_EVS_MAX_MESSAGE_LENGTH, strlen(GTBigBuf));
		 }

		 strncpy(BigBuf,GTBigBuf,CFE_EVS_MAX_MESSAGE_LENGTH);
		 if (EventType == CFE_EVS_DEBUG)
			 UTF_put_text("DEBUG EVENT ID=%d %s\n",EventID, BigBuf);
		 else if (EventType == CFE_EVS_INFORMATION)
			 UTF_put_text("INFO EVENT ID=%d %s\n",EventID, BigBuf);
		 else if (EventType == CFE_EVS_ERROR)
			 UTF_put_text("ERROR EVENT ID=%d %s\n",EventID, BigBuf);
		 else if (EventType == CFE_EVS_CRITICAL)
			 UTF_put_text("CRITICAL EVENT ID=%d %s\n",EventID, BigBuf);
		 else
			 UTF_put_text("Invalid Event Type %d ID=%d %s\n",EventType,EventID, BigBuf);
      }
      else
      {
         /* Send an empty message if short format is enabled */
         strcpy(EVS_Packet.Message, "\0");
      }

      return CFE_SUCCESS;
   }
   
   return Status;

} /* End CFE_EVS_SendEvent */