Skip to content

Commit

Permalink
MeOS version 3.6.1069
Browse files Browse the repository at this point in the history
  • Loading branch information
erikmelin committed May 11, 2019
1 parent e8e5e49 commit 55d526c
Show file tree
Hide file tree
Showing 59 changed files with 2,283 additions and 545 deletions.
29 changes: 23 additions & 6 deletions code/RestService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,21 @@ void RestService::save(oEvent &oe, gdioutput &gdi) {

int xport = gdi.getTextNo("Port");
if (xport > 0 && xport < 65536) {
oe.setProperty("ServicePort", xport);

port = xport;
server->startService(port);
}
else
throw meosException("Invalid port number");
}

if (gdi.isChecked("MapRoot")) {
rootMap = gdi.recodeToNarrow(gdi.getText("RootMap"));
server->setRootMap(rootMap);
oe.setProperty("ServiceRootMap", gdi.getText("RootMap"));
}

if (gdi.isChecked("AllowEntry")) {
RestServer::EntryPermissionType pt = (RestServer::EntryPermissionType)gdi.getSelectedItem("PermissionPerson").first;
RestServer::EntryPermissionClass pc = (RestServer::EntryPermissionClass)gdi.getSelectedItem("PermissionClass").first;
Expand All @@ -66,10 +74,11 @@ void RestService::save(oEvent &oe, gdioutput &gdi) {

void ListIpAddresses(vector<string>& ip);

void RestService::settings(gdioutput &gdi, oEvent &oe, bool created) {
if (port == -1)
port = oe.getPropertyInt("ServicePort", 2009);

void RestService::settings(gdioutput &gdi, oEvent &oe, bool created) {
if (port == -1) {
port = oe.getPropertyInt("ServicePort", 2009);
rootMap = oe.getPropertyString("ServiceRootMap", "");
}
settingsTitle(gdi, "MeOS Informationsserver REST-API");

//gdi.fillRight();
Expand All @@ -87,10 +96,15 @@ void RestService::settings(gdioutput &gdi, oEvent &oe, bool created) {
bool disablePermisson = true;
gdi.popX();

startCancelInterval(gdi, "Save", created, IntervalNone, L"");
gdi.addCheckbox("MapRoot", "Mappa rootadresssen (http:///localhost:port/) till funktion:", nullptr, !rootMap.empty()).setHandler(this);
gdi.addInput("RootMap", gdi.recodeToWide(rootMap));
gdi.setInputStatus("RootMap", !rootMap.empty());

if (!server)
startCancelInterval(gdi, "Save", created, IntervalNone, L"");

if (!server) {
gdi.addInput("Port", itow(port), 10, 0, L"Port:", L"#http://localhost:[PORT]/meos");
}
else {
gdi.addString("", 0, "Server startad på X#" + itos(port));
auto per = server->getEntryPermission();
Expand Down Expand Up @@ -180,6 +194,9 @@ void RestService::handle(gdioutput &gdi, BaseInfo &info, GuiEventType type) {
gdi.setInputStatus("PermissionPerson", gdi.isChecked(bi.id));
gdi.setInputStatus("PermissionClass", gdi.isChecked(bi.id));
}
else if (bi.id == "MapRoot") {
gdi.setInputStatus("RootMap", gdi.isChecked(bi.id));
}
}
else if (type == GUI_LINK) {
wstring url = ((TextInfo &)info).text;
Expand Down
2 changes: 1 addition & 1 deletion code/RestService.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class RestService :
{
int port;
shared_ptr<RestServer> server;

string rootMap;
public:

void save(oEvent &oe, gdioutput &gdi) override;
Expand Down
2 changes: 1 addition & 1 deletion code/TabAuto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ void PunchMachine::process(gdioutput &gdi, oEvent *oe, AutoSyncType ast)
auto pc = r->getCourse(false);
if (radio < 10 || pc->hasControlCode(radio)) {
pp.clear();
oe->getPunchesForRunner(r->getId(), pp);
oe->getPunchesForRunner(r->getId(), false, pp);
bool hit = false;
for (auto p : pp) {
if (p->getTypeCode() == radio)
Expand Down
Loading

0 comments on commit 55d526c

Please sign in to comment.