Skip to content

Commit

Permalink
Added support for preconfigured sensors (inverters)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxnik committed Dec 5, 2012
1 parent 530e739 commit ff8fe4e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
19 changes: 16 additions & 3 deletions CFroniusProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ CFroniusProbe::CFroniusProbe(CInterface *SerialLine, string uuid)
pthread_mutex_init(&m_queueMutex, NULL);
}

CFroniusProbe::CFroniusProbe(CInterface *SerialLine, list<int> sensors, string uuid)
{
m_Interface = SerialLine;
m_SendingThread = m_ReceivingThread = 0;

m_connected = sensors;

pthread_mutex_init(&m_queueMutex, NULL);
}

CFroniusProbe::~CFroniusProbe()
{
Stop();
Expand Down Expand Up @@ -77,10 +87,13 @@ CFroniusProbe::Start(void)
pthread_create( &m_ReceivingThread, NULL, &CFroniusProbe::ReceivingFunction, &RecArgs);

// Check for inverters. If none is found, stop the process
if(probeInverters() == false)
if(m_connected.empty() == true)
{
Stop();
return false;
if(probeInverters() == false)
{
Stop();
return false;
}
}

// All is well.
Expand Down
1 change: 1 addition & 0 deletions CFroniusProbe.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class CFroniusProbe : public CProbe
{
public:
CFroniusProbe(CInterface *SerialLine, string uuid);
CFroniusProbe(CInterface *SerialLine, list<int> sensors, string uuid);
virtual ~CFroniusProbe();

int Start(void);
Expand Down

0 comments on commit ff8fe4e

Please sign in to comment.