From: tkummermehr Date: Fri, 14 Jul 2017 07:48:01 +0000 (+0200) Subject: Merge branch 'master' into UCS_Interface_Cleanup X-Git-Tag: 4.99.3~50^2 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=dbbd5b4964615a63205fb9433f827f67265541de;p=apps%2Fagl-service-unicens.git Merge branch 'master' into UCS_Interface_Cleanup --- dbbd5b4964615a63205fb9433f827f67265541de diff --cc ucs2-afb/ucs_binding.c index 18b1aa5,c451bf3..fc8d613 --- a/ucs2-afb/ucs_binding.c +++ b/ucs2-afb/ucs_binding.c @@@ -104,27 -104,17 +104,27 @@@ PUBLIC void UCSI_CB_OnSetServiceTimer(v } -/** Callback when ever UNICENS forms a human readable message. */ -void UCSI_CB_OnUserMessage(void *pTag, const char format[], +/** + * \brief Callback when ever an Unicens forms a human readable message. + * This can be error events or when enabled also debug messages. + * \note This function must be implemented by the integrator + * \param pTag - Pointer given by the integrator by UCSI_Init + * \param format - Zero terminated format string (following printf rules) + * \param vargsCnt - Amount of parameters stored in "..." + */ +void UCSI_CB_OnUserMessage(void *pTag, bool isError, const char format[], uint16_t vargsCnt, ...) { - //DEBUG (afbIface, format, args); - va_list args; - va_start (args, format); - vfprintf (stderr, format, args); - va_end(args); + va_list argptr; + char outbuf[300]; + pTag = pTag; + va_start(argptr, vargsCnt); + vsprintf(outbuf, format, argptr); + va_end(argptr); + if (isError) + NOTICE (afbIface, outbuf); } - // UCSI_Service cannot be call directly within Unicens context, need to reset stack through mainloop + /** UCSI_Service cannot be called directly within UNICENS context, need to service stack through mainloop */ STATIC int OnServiceRequiredCB (sd_event_source *source, uint64_t usec, void *pTag) { ucsContextT *ucsContext = (ucsContextT*) pTag; @@@ -140,10 -130,26 +140,8 @@@ PUBLIC void UCSI_CB_OnServiceRequired(v sd_event_add_time(afb_daemon_get_event_loop(afbIface->daemon), NULL, CLOCK_MONOTONIC, 0, 0, OnServiceRequiredCB, pTag); } - // Callback when ever this instance wants to send a message to INIC. - // BUGS?? Sample was returning true/false on error when integration layer expect a void [question from Fulup to Thorsten] - -/** - * \brief Callback when ever a MOST error message was received. - * \note This function must be implemented by the integrator - * \param pTag - Pointer given by the integrator by UCSI_Init - * \note All following parameters belong to the usual MOST message - */ -PUBLIC void UCSI_CB_OnMostError(void *pTag, uint16_t sourceAddr, - uint8_t fblock, uint8_t inst, uint16_t function, uint8_t op, - const uint8_t *pPayload, uint32_t payloadLen) { - - // Error to send to syslog - DEBUG (afbIface, "OnMostError source=0x%x", sourceAddr); -} - - - + /* Callback when ever this UNICENS wants to send a message to INIC. */ -PUBLIC void UCSI_CB_SendMostMessage(void *pTag, const uint8_t *pData, uint32_t len) { - +PUBLIC void UCSI_CB_OnTxRequest(void *pTag, const uint8_t *pData, uint32_t len) { - ucsContextT *ucsContext = (ucsContextT*) pTag; CdevData_t *cdevTx = &ucsContext->tx; uint32_t total = 0;