void GuiCHI::onUninstall() { GUIConfiguration.serviceID = ""; GUIConfiguration.save(); lNote("Service uninstalled"); sm.disconnect(); lNote("Network connection closed"); }
void WebSocketPort::on_close(websocketpp::connection_hdl hdl) { lNote("WS Connection Removed"); int ID = this->connectionList.at(hdl); this->connectionList.erase(hdl); if (_onClientDisconnect != NULL) _onClientDisconnect(ID); }
void WebSocketPort::receivedThreads(websocketpp::connection_hdl client, std::string data) { try { int ID = this->connectionList.at(client); if (_onMessage == NULL) { return; } _onMessage(ID, data); for (unsigned int i = 0; i < this->threadsList.size(); i++) { if (this_thread::get_id() == this->threadsList[i]->get_id()) {//fixme:free memory of thread? this->threadsList.erase(this->threadsList.begin() + i); } } } catch (exceptionEx &ex) { lNote("WSR.Error.OnReceive: " + std::string(ex.what())); } catch (exception &ex) { lNote("WSR.Error.OnReceive: " + std::string(ex.what())); } catch (...) { lNote("WSR.Error.OnReceive: UNKNOWN"); } }
void TNotesResource1::GetItem(TEndpointContext* AContext, TEndpointRequest* ARequest, TEndpointResponse* AResponse) { try { String lItem = ARequest->Params->Values["item"]; std::auto_ptr<TNote> lNote(new TNote()); CheckNotesManager(AContext); if(FNotesStorage->GetNote(lItem, lNote.get())) { TJSONObject * jsonObj = TNoteJSON::NoteToJSON(lNote.get()); AResponse->Body->SetValue(jsonObj, true); } else { AResponse->RaiseNotFound(String().sprintf(L"\"%s\" not found", lItem.c_str())); } } catch (...) { HandleException(); } }
void WebSocketPort::on_open(websocketpp::connection_hdl hdl) { lNote("New Client " + std::to_string(conIDCounter + 1)); this->connectionList[hdl] = ++conIDCounter; if (_onClientConnect != NULL) _onClientConnect(conIDCounter); }
void GuiCHI::onDisconnect() { lNote("-GUI Disconnected from server"); }
void GuiCHI::onConnect() { lNote("+GUI Connected to server"); }