Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/api-v2.0.2-cxx-dev' into develop…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
AJIOB committed Aug 30, 2017
2 parents fd28679 + 6db1d2a commit 5e3db33
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions code/c++/cxx-api/CommandsEnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ enum CommunicationCommands {
*/
enum StartCommands {
startBasicAPI = 1, //default API v1
APIWithAnswer = 2 //API v2
};

#endif /* _COMMANDS_ENUM_H_ */
3 changes: 1 addition & 2 deletions code/c++/cxx-api/TCPIP_Connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,4 @@ TCPIP_Connector::~TCPIP_Connector()
#ifdef _WIN32
WSACleanup();
#endif
}

}
2 changes: 1 addition & 1 deletion code/c++/cxx-api/TrackPlatform_BasicConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const std::string TrackPlatform_BasicConnector::connectedAnswer = "OK";

void TrackPlatform_BasicConnector::sendStartCommand()
{
std::string command = std::string() + static_cast<char>(communicationControllerID) + static_cast<char>(startCommunicationCommand) + static_cast<char>(startBasicAPI);
std::string command = std::string() + static_cast<char>(communicationControllerID) + static_cast<char>(startCommunicationCommand) + static_cast<char>(APIWithAnswer);
isConnectedToArduino = true;
for (auto i = 0; i < timesToAutoreconnect; ++i)
{
Expand Down
3 changes: 3 additions & 0 deletions code/c++/cxx-api/TrackPlatform_BasicManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@ void TrackPlatform_BasicManagement::sendMove(const std::string& additionalInfo)
{
readWriteAtomicMutex.lock();
connector->sendOneCommand(static_cast<char>(movementControllerID) + additionalInfo);
auto answer = connector->readOneAnswer();
readWriteAtomicMutex.unlock();
}

void TrackPlatform_BasicManagement::sendSensors(const std::string& additionalInfo)
{
readWriteAtomicMutex.lock();
connector->sendOneCommand(static_cast<char>(sensorsControllerID) + additionalInfo);
auto answer = connector->readOneAnswer();
readWriteAtomicMutex.unlock();
}

void TrackPlatform_BasicManagement::sendServo(const std::string& additionalInfo)
{
readWriteAtomicMutex.lock();
connector->sendOneCommand(static_cast<char>(servoControllerID) + additionalInfo);
auto answer = connector->readOneAnswer();
readWriteAtomicMutex.unlock();
}

Expand Down

0 comments on commit 5e3db33

Please sign in to comment.