示例#1
0
文件: GuiCHI.cpp 项目: zeitoonco/zds
void GuiCHI::onUninstall() {
	GUIConfiguration.serviceID = "";
	GUIConfiguration.save();
	lNote("Service uninstalled");
	sm.disconnect();
	lNote("Network connection closed");
}
示例#2
0
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);
}
示例#3
0
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");
	}
}
示例#4
0
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();
	}
}
示例#5
0
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);
}
示例#6
0
文件: GuiCHI.cpp 项目: zeitoonco/zds
void GuiCHI::onDisconnect() {
	lNote("-GUI Disconnected from server");
}
示例#7
0
文件: GuiCHI.cpp 项目: zeitoonco/zds
void GuiCHI::onConnect() {
	lNote("+GUI Connected to server");
}