Esempio n. 1
0
 void IoGPIO::setup(const StringMap & settings)
 {
     Io::setup(settings);
     setOutputPin(std::atoi(settings.at("ios.GPIO.pin").c_str()));
     setPeriods(std::atoi(settings.at("ios.GPIO.periods").c_str()));
     setPeriodTime(std::atoi(settings.at("ios.GPIO.periodTime").c_str()));
 }
 void RectangleExpositor::setup(const StringMap & settings)
 {
     Expositor::setup(settings);
     int x1 = std::atoi(settings.at("expositors.Rectangle.region.x1").c_str());
     int y1 = std::atoi(settings.at("expositors.Rectangle.region.y1").c_str());
     int x2 = std::atoi(settings.at("expositors.Rectangle.region.x2").c_str());
     int y2 = std::atoi(settings.at("expositors.Rectangle.region.y2").c_str());
     setCoordinates(x1, y1, x2, y2);
 }
Esempio n. 3
0
    void IoTCP::setup(const StringMap & settings)
    {
        Io::setup(settings);

        // ----------------------------------
        // TODO: set server credentials
        
        setIp(settings.at("ios.TCPSocket.server").c_str());
        setPort(std::atoi(settings.at("ios.TCPSocket.port").c_str()));
        setMessage(settings.at("ios.TCPSocket.message").c_str());
    }
Esempio n. 4
0
    void IoGPIO::setup(const StringMap & settings)
    {
        Io::setup(settings);
        setOutputPin(std::atoi(settings.at("ios.GPIO.pin").c_str()));
        setPeriods(std::atoi(settings.at("ios.GPIO.periods").c_str()));
        setPeriodTime(std::atoi(settings.at("ios.GPIO.periodTime").c_str()));

        // -------------
        // Set throttler

        throttle.setRate(std::stoi(settings.at("ios.GPIO.throttler")));
    }
Esempio n. 5
0
 void IoWebhook::setup(const StringMap & settings)
 {
     Io::setup(settings);
     
     // --------------------------
     // Get name from instance
     
     std::string instanceName = settings.at("name");
     setInstanceName(instanceName);
     
     // -------
     // Get url
     
     setUrl(settings.at("ios.Webhook.url").c_str());
 }
Esempio n. 6
0
int MeiqueCache::readMeiqueConfig(lua_State* L)
{
    MeiqueCache* self = getSelf(L);
    StringMap opts;
    readLuaTable(L, lua_gettop(L), opts);
    lua_pop(L, 1);
    try {
        self->m_sourceDir = OS::normalizeDirPath(opts.at("sourceDir"));
        self->m_buildType = opts.at("buildType") == "debug" ? Debug : Release;
        self->m_compilerId = opts.at("compiler");
        self->m_installPrefix = opts["installPrefix"];
    } catch (std::out_of_range&) {
        luaError(L, MEIQUECACHE " file corrupted or created by a old version of meique.");
    }
    return 0;
}
Esempio n. 7
0
 void IoDisk::setup(const StringMap & settings)
 {
     Io::setup(settings);
     
     // --------------------------
     // Get name from instance
     
     std::string instanceName = settings.at("name");
     setInstanceName(instanceName);
     
     // -------------------------------------------------------------
     // Filemanager is mapped to a directory and is used by an image
     // to save to the correct directory.
     
     setFileFormat(settings.at("ios.Disk.fileFormat"));
     m_fileManager.setBaseDirectory(settings.at("ios.Disk.directory"));
 }
Esempio n. 8
0
    void Counter::setup(const StringMap & settings)
    {
        std::vector<std::string> coordinates;
        
        // Set incoming coordinates
        helper::tokenize(settings.at("heuristics.Counter.markers"), coordinates, "|");
        for(int i = 0; i < 2; i++)
        {
            std::vector<std::string> fromAndTo;
            helper::tokenize(coordinates[i], fromAndTo, ",");
            int from = std::atoi(fromAndTo[0].c_str());
            int to = std::atoi(fromAndTo[1].c_str());
            cv::Point p(from ,to);
            m_in.push_back(p);
        }
        
        // Set outgoing coordinates

        for(int i = 2; i < 4; i++)
        {
            std::vector<std::string> fromAndTo;
            helper::tokenize(coordinates[i], fromAndTo, ",");
            int from = std::atoi(fromAndTo[0].c_str());
            int to = std::atoi(fromAndTo[1].c_str());
            cv::Point p(from ,to);
            m_out.push_back(p);
        }

        setMinimumChanges(std::atoi(settings.at("heuristics.Counter.minimumChanges").c_str()));
        setNoMotionDelayTime(std::atoi(settings.at("heuristics.Counter.noMotionDelayTime").c_str()));
        setAppearance(std::atoi(settings.at("heuristics.Counter.appearance").c_str()));
        setMaxDistance(std::atoi(settings.at("heuristics.Counter.maxDistance").c_str()));
        setMinArea(std::atoi(settings.at("heuristics.Counter.minArea").c_str()));
        setOnlyTrueWhenCounted((settings.at("heuristics.Counter.onlyTrueWhenCounted") == "true"));
    }
Esempio n. 9
0
    void IoDisk::setup(const StringMap & settings)
    {
        Io::setup(settings);
        
        // --------------------------
        // Get name from instance
        
        std::string instanceName = settings.at("name");
        setInstanceName(instanceName);

        // --------------------------
        // Check if need to draw timestamp
        
        bool drawTimestamp = (settings.at("ios.Disk.markWithTimestamp") == "true");
        setDrawTimestamp(drawTimestamp);
        cv::Scalar color = getColor(settings.at("ios.Disk.timestampColor"));
        setTimestampColor(color);
        
        std::string timezone = settings.at("timezone");
        std::replace(timezone.begin(), timezone.end(), '-', '/');
        std::replace(timezone.begin(), timezone.end(), '$', '_');
        setTimezone(timezone);
        
        // -------------------------------------------------------------
        // Filemanager is mapped to a directory and is used by an image
        // to save to the correct directory.
        
        setFileFormat(settings.at("ios.Disk.fileFormat"));
        m_fileManager.setBaseDirectory(settings.at("ios.Disk.directory"));
    }
Esempio n. 10
0
 void Sequence::setup(const StringMap & settings)
 {
     setMinimumChanges(std::atoi(settings.at("heuristics.Sequence.minimumChanges").c_str()));
     setSequenceDuration(std::atoi(settings.at("heuristics.Sequence.minimumDuration").c_str()));
     setNoMotionDelayTime(std::atoi(settings.at("heuristics.Sequence.noMotionDelayTime").c_str()));
 }