31 lines
705 B
C++
31 lines
705 B
C++
//
|
|
// FILE: FastclockScanner.h
|
|
// VERSION: 1.0
|
|
// PURPOSE: Scans the broadcasts for clocks and returns the clocknames found
|
|
//
|
|
//
|
|
|
|
#include <string.h>
|
|
#include "mgos.h"
|
|
#include "FastclockScanner.h"
|
|
#include "appDebug.h"
|
|
|
|
|
|
const char *FastclockScanner::knownClocks[MAX_CLOCKS];
|
|
int FastclockScanner::numberOfKnownClocks = 0;
|
|
|
|
void FastclockScanner::addClock(const char *clockName) {
|
|
for (int i=0; i<numberOfKnownClocks; ++i) {
|
|
if (strcmp(clockName, knownClocks[i]) == 0) return;
|
|
}
|
|
if (numberOfKnownClocks < MAX_CLOCKS) {
|
|
knownClocks[numberOfKnownClocks] = strdup(clockName);
|
|
++numberOfKnownClocks;
|
|
LOG(LL_DEBUG, ("Added new clock with name=%s", clockName));
|
|
}
|
|
logHeap();
|
|
}
|
|
|
|
|
|
|