This commit is contained in:
Thomas Kunze 2019-06-29 00:50:08 +02:00
parent 4ab96db96e
commit b405bff672

View File

@ -32,6 +32,19 @@ static void loop()
static std::thread workerThread; static std::thread workerThread;
static void Prepare(int argc, char** argv)
{
platform = new LinuxPlatform(argc, argv);
bau = new Bau57B0(*platform);
}
static void Destroy()
{
delete platform;
delete bau;
platform = 0;
bau = 0;
}
static void Start() static void Start()
{ {
@ -64,17 +77,26 @@ static void Stop()
static bool ProgramMode(bool value) static bool ProgramMode(bool value)
{ {
if (!bau)
return false;
bau->deviceObject().progMode(value); bau->deviceObject().progMode(value);
return bau->deviceObject().progMode(); return bau->deviceObject().progMode();
} }
static bool ProgramMode() static bool ProgramMode()
{ {
if (!bau)
return false;
return bau->deviceObject().progMode(); return bau->deviceObject().progMode();
} }
static bool Configured() static bool Configured()
{ {
if (!bau)
return false;
return bau->configured(); return bau->configured();
} }
@ -91,9 +113,27 @@ PYBIND11_MODULE(knx, m)
m.def("ProgramMode", (bool(*)())&ProgramMode, "get programing mode active."); m.def("ProgramMode", (bool(*)())&ProgramMode, "get programing mode active.");
m.def("ProgramMode", (bool(*)(bool))&ProgramMode, "Activate / deactivate programing mode."); m.def("ProgramMode", (bool(*)(bool))&ProgramMode, "Activate / deactivate programing mode.");
m.def("Configured", (bool(*)())&Configured, "get configured status."); m.def("Configured", (bool(*)())&Configured, "get configured status.");
m.def("FlashFilePath", []() { return platform->flashFilePath(); }); m.def("FlashFilePath", []()
m.def("FlashFilePath", [](std::string path) { platform->flashFilePath(path); }); {
m.def("GetGroupObject", [](uint16_t goNr) { return bau->groupObjectTable().get(goNr); }); if(!platform)
return std::string("");
return platform->flashFilePath();
});
m.def("FlashFilePath", [](std::string path)
{
if(!platform)
return;
platform->flashFilePath(path);
});
m.def("GetGroupObject", [](uint16_t goNr)
{
if(!bau)
return GroupObject();
return bau->groupObjectTable().get(goNr);
});
py::class_<GroupObject>(m, "GroupObject", py::dynamic_attr()) py::class_<GroupObject>(m, "GroupObject", py::dynamic_attr())
.def(py::init()) .def(py::init())