Skip to content

Commit

Permalink
Merged testing
Browse files Browse the repository at this point in the history
  • Loading branch information
hfedcba committed Jul 30, 2019
2 parents 3d6c0d7 + 394c088 commit 4efdc2b
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 680 deletions.
3 changes: 2 additions & 1 deletion getVersion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
dir=`mktemp -d`
cat > "$dir/libhomegear-base-version.cpp" <<-'EOF'
#include "homegear-base/BaseLib.h"
#include <iostream>
int main(int argc, char** argv)
{
std::cout << BaseLib::SharedObjects::version() << std::endl;
return 0;
}
EOF
g++ -std=c++11 -o $dir/libhomegear-base-version $dir/libhomegear-base-version.cpp -lhomegear-base -lgcrypt -lgnutls -lpthread
g++ -std=c++11 -o $dir/libhomegear-base-version $dir/libhomegear-base-version.cpp -lhomegear-base -lgcrypt -lgnutls -lpthread -latomic
chmod 755 $dir/libhomegear-base-version
$dir/libhomegear-base-version
rm -Rf $dir
8 changes: 0 additions & 8 deletions src/Interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,6 @@ void Interfaces::create()
{
GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
}

}
117 changes: 4 additions & 113 deletions src/PhysicalInterfaces/EventServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ EventServer::~EventServer()
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
}

void EventServer::setListenAddress()
Expand All @@ -94,14 +86,6 @@ void EventServer::setListenAddress()
{
_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
}

void EventServer::startListening()
Expand All @@ -125,14 +109,6 @@ void EventServer::startListening()
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
}

void EventServer::stopListening()
Expand All @@ -149,14 +125,6 @@ void EventServer::stopListening()
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
}

void EventServer::mainThread()
Expand Down Expand Up @@ -190,29 +158,13 @@ void EventServer::mainThread()
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
GD::bl->fileDescriptorManager.shutdown(clientFileDescriptor);
}
}
catch(const std::exception& ex)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
GD::bl->fileDescriptorManager.shutdown(_serverFileDescriptor);
}

Expand Down Expand Up @@ -245,7 +197,7 @@ void EventServer::readClient(std::shared_ptr<BaseLib::TcpSocket> socket, const s
}
catch(const BaseLib::SocketClosedException& ex)
{
_out.printInfo("Info: " + ex.what());
_out.printInfo("Info: " + std::string(ex.what()));
break;
}
catch(const BaseLib::SocketOperationException& ex)
Expand Down Expand Up @@ -273,7 +225,7 @@ void EventServer::readClient(std::shared_ptr<BaseLib::TcpSocket> socket, const s
}
catch(BaseLib::HttpException& ex)
{
_out.printError("Error: Could not process HTTP packet: " + ex.what() + " Buffer: " + std::string(buffer, bytesRead));
_out.printError("Error: Could not process HTTP packet: " + std::string(ex.what()) + " Buffer: " + std::string(buffer, bytesRead));
http.reset();
}

Expand Down Expand Up @@ -303,11 +255,11 @@ void EventServer::readClient(std::shared_ptr<BaseLib::TcpSocket> socket, const s
}
catch(BaseLib::SocketDataLimitException& ex)
{
_out.printWarning("Warning: " + ex.what());
_out.printWarning("Warning: " + std::string(ex.what()));
}
catch(const BaseLib::SocketOperationException& ex)
{
_out.printInfo("Info: " + ex.what());
_out.printInfo("Info: " + std::string(ex.what()));
}
break;
}
Expand Down Expand Up @@ -370,14 +322,6 @@ void EventServer::readClient(std::shared_ptr<BaseLib::TcpSocket> socket, const s
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
}

void EventServer::getSocketDescriptor()
Expand Down Expand Up @@ -450,14 +394,6 @@ void EventServer::getSocketDescriptor()
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
}

std::shared_ptr<BaseLib::FileDescriptor> EventServer::getClientSocketDescriptor(std::string& ipAddress, int32_t& port)
Expand Down Expand Up @@ -510,14 +446,6 @@ std::shared_ptr<BaseLib::FileDescriptor> EventServer::getClientSocketDescriptor(
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
return fileDescriptor;
}

Expand Down Expand Up @@ -551,14 +479,6 @@ std::string EventServer::getHttpHeader(uint32_t contentLength, std::string conte
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
return "";
}

Expand All @@ -576,14 +496,6 @@ void EventServer::getHttpError(int32_t code, std::string codeDescription, std::s
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
}

void EventServer::getHttpError(int32_t code, std::string codeDescription, std::string longDescription, std::vector<char>& content, std::vector<std::string>& additionalHeaders)
Expand All @@ -599,14 +511,6 @@ void EventServer::getHttpError(int32_t code, std::string codeDescription, std::s
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
}

void EventServer::httpGet(BaseLib::Http& http, std::vector<char>& content)
Expand Down Expand Up @@ -654,23 +558,10 @@ void EventServer::httpGet(BaseLib::Http& http, std::vector<char>& content)
getHttpError(404, http.getStatusText(404), "The requested URL " + path + " was not found on this server.", content);
return;
}
catch(BaseLib::Exception& ex)
{
getHttpError(404, http.getStatusText(404), "The requested URL " + path + " was not found on this server.", content);
return;
}
}
catch(const std::exception& ex)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
}
}
18 changes: 2 additions & 16 deletions src/Sonos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include "Interfaces.h"
#include "GD.h"

#include <iomanip>

namespace Sonos
{

Expand Down Expand Up @@ -81,14 +83,6 @@ void Sonos::createCentral()
{
GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
}

PVariable Sonos::getPairingInfo()
Expand Down Expand Up @@ -162,14 +156,6 @@ PVariable Sonos::getPairingInfo()
{
GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(BaseLib::Exception& ex)
{
GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
}
catch(...)
{
GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
}
return Variable::createError(-32500, "Unknown application error.");
}
}
Loading

0 comments on commit 4efdc2b

Please sign in to comment.