/*
µRtWare is a lightweight publish/subscribe middleware for real-time
applications. It was developed as part of the software habitat for the
Autonomous Mini Robot [1] (AMiRo) but can be used for other purposes as well.
Copyright (C) 2018..2020 Thomas Schöpping et al.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#include
/******************************************************************************/
/* LOCAL DEFINITIONS */
/******************************************************************************/
/******************************************************************************/
/* EXPORTED VARIABLES */
/******************************************************************************/
/******************************************************************************/
/* LOCAL TYPES */
/******************************************************************************/
/******************************************************************************/
/* LOCAL VARIABLES */
/******************************************************************************/
/******************************************************************************/
/* LOCAL FUNCTIONS */
/******************************************************************************/
/******************************************************************************/
/* EXPORTED FUNCTIONS */
/******************************************************************************/
/**
* @brief Initalize the service.
*
* @param[in] service The service to initialize. Must not be NULL.
* @param[in] id Unique, numeric identifier of the service.
* @param[in] callback Callback function to be executed by this service. Must not be NULL.
*
* @return Returns URT_STATUS_OK on success.
* Returns URT_STATUS_SERVICE_DUPLICATE if another service with the same identifier already exists.
*/
urt_status_t urtServiceInit(urt_service_t* service, urt_serviceid_t id, urt_servicefunc_t* callback)
{
urt_service_t.next = NULL;
urt_service_t.id = id;
//add later: urtmutex init
urt_service_t.callback = callback;
#if (URT_CFG_RPC_PROFILING)
urt_service_t.sumDurations = 0;
urt_service_t.numCalls = 0;
urt_service_t.numTimeouts = 0;
urt_service_t.minDuration = 0;
urt_service_t.maxDuration 0;
#endif /* URT_CFG_RPC_PROFILING */
//add later: lock core,...
return URT_STATUS_OK;
}
/**
* @brief Calls a service.
*
* @param[in] service The service to call. Must not be NULL.
* @param[in] arg Optional argument for the service call. May be NULL if the service expects no arguments.
* @param[in] ret Pointer to an optional output value. May be NULL.
* @param[in] timeout Timeout delay to be propagated to the callback function.
* Whether timeout is considered depends on the callback function.
*
* @return Returns the exact output status of the service call.
*/
urt_status_t urtServiceCall(urt_service_t* service, void* arg, void* ret, urt_delay_t timeout) {return URT_STATUS_OK;}