diff --git a/inc/Services/FunctionManagementService.hpp b/inc/Services/FunctionManagementService.hpp index 1c2f74e6ef4b7e28b3638cc2d647d46a38077ef4..8fb7bce530bd548a7491013c47f06a6058e38bf0 100644 --- a/inc/Services/FunctionManagementService.hpp +++ b/inc/Services/FunctionManagementService.hpp @@ -42,22 +42,22 @@ * Usage of the include() function: * * @code - * void foo(String<MAXARGLENGTH> b) { + * void foo(String<MAX_ARG_LENGTH> b) { * std::cout << "SPAAAACE!" << std::endl; * } * - * void bar(String<MAXARGLENGTH> b) { + * void bar(String<MAX_ARG_LENGTH> b) { * std::cout << "I HAZ A CUBESAT THAT SNAPS PIX!" << std::endl; * } * - * void baz(String<MAXARGLENGTH> b) { + * void baz(String<MAX_ARG_LENGTH> b) { * std::cout << "QWERTYUIOP" << std::endl; * } * * FunctionManagementService::FunctionManagementService() { - * include(String<FUNCNAMELENGTH>("foo"), &foo); - * include(String<FUNCNAMELENGTH>("bar"), &bar); - * include(String<FUNCNAMELENGTH>("baz"), &baz); + * include(String<FUNC_NAME_LENGTH>("foo"), &foo); + * include(String<FUNC_NAME_LENGTH>("bar"), &bar); + * include(String<FUNC_NAME_LENGTH>("baz"), &baz); * } */ @@ -97,11 +97,11 @@ public: * TC [8,1] message. After inclusion it returns an unneeded int signalling insertion success * (0) or failure (2). These returns are there for testing purposes only. * - * @param funcName the function's name. Max. length is MAXFUNCNAMELENGTH bytes. - * @param ptr pointer to a function of void return type and a MAXARGLENGTH-lengthed byte + * @param funcName the function's name. Max. length is FUNC_NAME_LENGTH bytes. + * @param ptr pointer to a function of void return type and a MAX_ARG_LENGTH-lengthed byte * string as argument (which contains the actual arguments of the function) */ - int include(String<FUNCNAMELENGTH> funcName, void(*ptr)(String<MAXARGLENGTH>)); + int include(String<FUNC_NAME_LENGTH> funcName, void(*ptr)(String<MAX_ARG_LENGTH>)); }; #endif //ECSS_SERVICES_FUNCTIONMANAGEMENTSERVICE_HPP diff --git a/src/Services/FunctionManagementService.cpp b/src/Services/FunctionManagementService.cpp index 252bd4fc5c0eacee24d9189de46a5f6a7a5ef665..88e912216a4ebc1139ed9e74be8636ab7a9edcbf 100644 --- a/src/Services/FunctionManagementService.cpp +++ b/src/Services/FunctionManagementService.cpp @@ -9,13 +9,13 @@ int FunctionManagementService::call(Message& msg) { ErrorHandler::assertInternal(msg.messageType == 1 && msg.serviceType == 8, ErrorHandler::InternalErrorType::UnacceptablePacket); - uint8_t funcName[FUNCNAMELENGTH]; // the function's name - uint8_t funcArgs[MAXARGLENGTH]; // arguments for the function + uint8_t funcName[FUNC_NAME_LENGTH]; // the function's name + uint8_t funcArgs[MAX_ARG_LENGTH]; // arguments for the function - msg.readString(funcName, FUNCNAMELENGTH); - msg.readString(funcArgs, MAXARGLENGTH); + msg.readString(funcName, FUNC_NAME_LENGTH); + msg.readString(funcArgs, MAX_ARG_LENGTH); - if (msg.dataSize > FUNCNAMELENGTH + MAXARGLENGTH) { + if (msg.dataSize > FUNC_NAME_LENGTH + MAX_ARG_LENGTH) { /** * @todo Send failed start of execution (too long message) */ @@ -23,9 +23,9 @@ int FunctionManagementService::call(Message& msg) { } // locate the appropriate function pointer - String<FUNCNAMELENGTH> name(funcName); + String<FUNC_NAME_LENGTH> name(funcName); FunctionMap::iterator iter = funcPtrIndex.find(name); - void (*selected)(String<MAXARGLENGTH>); + void (*selected)(String<MAX_ARG_LENGTH>); if (iter != funcPtrIndex.end()) { selected = *iter->second; @@ -41,8 +41,8 @@ int FunctionManagementService::call(Message& msg) { return 0; } -int FunctionManagementService::include(String<FUNCNAMELENGTH> funcName, void(*ptr) - (String<MAXARGLENGTH>)) { +int FunctionManagementService::include(String<FUNC_NAME_LENGTH> funcName, void(*ptr) + (String<MAX_ARG_LENGTH>)) { if (funcPtrIndex.full()) { /** @@ -51,7 +51,7 @@ int FunctionManagementService::include(String<FUNCNAMELENGTH> funcName, void(*pt return 2; // arbitrary, for testing purposes } - funcName.append(FUNCNAMELENGTH - funcName.length(), '\0'); + funcName.append(FUNC_NAME_LENGTH - funcName.length(), '\0'); funcPtrIndex.insert(std::make_pair(funcName, ptr)); return 0;