Example #1
0
bool Camera_INDIClass::Connect(const wxString& camId)
{
    // If not configured open the setup dialog
    if (strcmp(INDICameraName,"INDI Camera")==0) CameraSetup();
    // define server to connect to.
    setServer(INDIhost.mb_str(wxConvUTF8), INDIport);
    // Receive messages only for our camera.
    watchDevice(INDICameraName.mb_str(wxConvUTF8));
    // Connect to server.
    if (connectServer()) {
        return !ready;
    }
    else {
        // last chance to fix the setup
        CameraSetup();
        setServer(INDIhost.mb_str(wxConvUTF8), INDIport);
        watchDevice(INDICameraName.mb_str(wxConvUTF8));
        if (connectServer()) {
            return !ready;
        }
        else {
            return true;
        }
    }
}
Example #2
0
bool ScopeINDI::Connect()
{
    // If not configured open the setup dialog
    if (INDIMountName == wxT("INDI Mount")) {
        SetupDialog();
    }
    // define server to connect to.
    setServer(INDIhost.mb_str(wxConvUTF8), INDIport);
    // Receive messages only for our mount.
    watchDevice(INDIMountName.mb_str(wxConvUTF8));
    // Connect to server.
    if (connectServer()) {
        return !ready;
    }
    else {
        // last chance to fix the setup
        SetupDialog();
        setServer(INDIhost.mb_str(wxConvUTF8), INDIport);
        watchDevice(INDIMountName.mb_str(wxConvUTF8));
        if (connectServer()) {
            return !ready;
        }
        else {
            return true;
        }
    }
}
Example #3
0
bool DictEngine::sourceRequestEvent(const QString &query)
{
    // FIXME: this is COMPLETELY broken .. it can only look up one query at a time!
    //        a DataContainer subclass that does the look up should probably be made
    if (m_currentQuery == query) {
        return false;
    }

    if (m_tcpSocket) {
        m_tcpSocket->abort(); //stop if lookup is in progress and new query is requested
        m_tcpSocket->deleteLater();
        m_tcpSocket = 0;
    }

    QStringList queryParts = query.split(':', QString::SkipEmptyParts);
    if (queryParts.isEmpty()) {
        return false;
    }

    m_currentWord = queryParts.last();
    m_currentQuery = query;

    //asked for a dictionary?
    if (queryParts.count() > 1) {
        setDict(queryParts[queryParts.count()-2]);
        //default to wordnet
    } else {
        setDict(QStringLiteral("wn"));
    }

    //asked for a server?
    if (queryParts.count() > 2) {
        setServer(queryParts[queryParts.count()-3]);
        //default to wordnet
    } else {
        setServer(QStringLiteral("dict.org"));
    }

    if (m_currentWord.simplified().isEmpty()) {
        setData(m_currentWord, m_dictName, QString());
    } else {
        setData(m_currentWord, m_dictName, QString());
        m_tcpSocket = new QTcpSocket(this);
        m_tcpSocket->abort();
        connect(m_tcpSocket, &QTcpSocket::disconnected, this, &DictEngine::socketClosed);

        if (m_currentWord == QLatin1String("list-dictionaries")) {
            connect(m_tcpSocket, &QTcpSocket::readyRead, this, &DictEngine::getDicts);
        } else {
            connect(m_tcpSocket, &QTcpSocket::readyRead, this, &DictEngine::getDefinition);
        }

        m_tcpSocket->connectToHost(m_serverName, 2628);
    }

    return true;
}
Example #4
0
void configTime(int timezone, int daylightOffset_sec, const char* server1, const char* server2, const char* server3)
{
    sntp_stop();

    setServer(0, server1);
    setServer(1, server2);
    setServer(2, server3);

    sntp_set_timezone(timezone/3600);
    sntp_set_daylight(daylightOffset_sec);
    sntp_init();
}
Example #5
0
bool Contact::setAddress(const QString &address)
{
    QStringList addressParts = address.split("@");
    if (addressParts.count() == 2) {
        setServerUser(addressParts[0]);
        setServer(addressParts[1]);
    } else {
        setServerUser("");
        setServer("");
    }

}
Example #6
0
void WEAK_ATTR configTime(int timezone, int daylightOffset_sec, const char* server1, const char* server2, const char* server3)
{
    sntp_stop();

    setServer(0, server1);
    setServer(1, server2);
    setServer(2, server3);

    s_timezone_sec = timezone;
    s_daylightOffset_sec = daylightOffset_sec;
    sntp_set_timezone(timezone/3600);
    sntp_init();
}
/*************************************************
Function Name: onClickbtnLogin()
Description: 单击“登录”按钮
Input: NULL
Output: NULL
Changes: NULL
*************************************************/
void IMLoginWidget::onClickBtnLogin()
{
    setServer();

    m_leUserID->setReadOnly(true);
    m_leUserPwd->setReadOnly(true);

//      m_btnLogin->setEnabled(false);
    if (true == m_isLogin)
    {
        m_isLogin = false;
        m_btnLogin->setText(tr("取消"));

        m_closeTimer = false;
        m_timerID=startTimer(1000);//interval is 100ms

//        IMClientMessageCtrl::sm_hostAddress = address;
//        IMClientMessageCtrl::sm_hostPort = port;

        m_labelStatus->setText(tr("登录中"));

        if (m_loginCtrl == NULL)
        {
            m_loginCtrl = new IMLoginCtrl(this);
            connect(m_loginCtrl, SIGNAL(getLoginMessgae(QString,bool,const UserInformation*)),
                    this, SLOT(setLabelStatus(QString,bool,const UserInformation*)));
        }
PubSubClient::PubSubClient(const char* domain, uint16_t port, Client& client, Stream& stream) {
    this->_state = MQTT_DISCONNECTED;
    setServer(domain,port);
    setClient(client);
    setStream(stream);
    setListener(NULL);  // TOAST
}
PubSubClient::PubSubClient(IPAddress addr, uint16_t port, Client& client) {
    this->_state = MQTT_DISCONNECTED;
    setServer(addr, port);
    setClient(client);
    this->stream = NULL;
    setListener(NULL);  // TOAST
}
Example #10
0
MqttClient::MqttClient(const char* domain, uint16_t port, MQTT_CALLBACK_SIGNATURE, Nokia_MqttClientAdapter& client) {
    this->_state = MQTT_DISCONNECTED;
    setServer(domain,port);
    setCallback(callback);
    setClient(client);
    this->stream = NULL;
}
Example #11
0
MqttClient::MqttClient(IPAddress addr, uint16_t port, MQTT_CALLBACK_SIGNATURE, Nokia_MqttClientAdapter& client) {
    this->_state = MQTT_DISCONNECTED;
    setServer(addr, port);
    setCallback(callback);
    setClient(client);
    this->stream = NULL;
}
Example #12
0
PubSubClient::PubSubClient(const char* domain, uint16_t port, Client& client)
{
	this->_state = MQTT_DISCONNECTED;
	setServer(domain,port);
	setClient(client);
	this->stream = NULL;
}
Example #13
0
MqttClient::MqttClient(uint8_t *ip, uint16_t port, MQTT_CALLBACK_SIGNATURE, Nokia_MqttClientAdapter& client, Stream& stream) {
    this->_state = MQTT_DISCONNECTED;
    setServer(ip,port);
    setCallback(callback);
    setClient(client);
    setStream(stream);
}
Example #14
0
PubSubClient::PubSubClient(uint8_t *ip, uint16_t port, Client& client)
{
	this->_state = MQTT_DISCONNECTED;
	setServer(ip, port);
	setClient(client);
	this->stream = NULL;
}
Example #15
0
PubSubClient::PubSubClient(uint8_t *ip, uint16_t port, Client& client, Stream& stream) {
    this->_state = MQTT_DISCONNECTED;
    setServer(ip,port);
    setClient(client);
    setStream(stream);
    setProtocol(MQTT_VERSION);
}
Example #16
0
GameScripting::GameScripting(Server* server)
{
    setServer(server);

    // setEnv(env) is called by ScriptApiEnv::initializeEnvironment()
    // once the environment has been created

    SCRIPTAPI_PRECHECKHEADER

    if (g_settings->getBool("secure.enable_security")) {
        initializeSecurity();
    }

    lua_getglobal(L, "core");
    int top = lua_gettop(L);

    lua_newtable(L);
    lua_setfield(L, -2, "object_refs");

    lua_newtable(L);
    lua_setfield(L, -2, "luaentities");

    // Initialize our lua_api modules
    InitializeModApi(L, top);
    lua_pop(L, 1);

    // Push builtin initialization type
    lua_pushstring(L, "game");
    lua_setglobal(L, "INIT");

    infostream << "SCRIPTAPI: Initialized game modules" << std::endl;
}
Example #17
0
PubSubClient::PubSubClient(uint8_t *ip, uint16_t port, MQTT_CALLBACK_SIGNATURE, Client& client) {
    this->_state = MQTT_DISCONNECTED;
    setServer(ip, port);
    setCallback(callback);
    setClient(client);
    this->stream = NULL;
}
Example #18
0
PubSubClient::PubSubClient(const char* domain, uint16_t port, MQTT_CALLBACK_SIGNATURE, Client& client, Stream& stream) {
    this->_state = MQTT_DISCONNECTED;
    setServer(domain,port);
    setCallback(callback);
    setClient(client);
    setStream(stream);
}
Example #19
0
	MyProxy(ISocketHandler &h)
		: ProxyClient(h)
	{
		setServer("evocraft.net");

		addTimer(NULL, 1.0f, 0);
	}
Example #20
0
PubSubClient::PubSubClient(IPAddress addr, uint16_t port, MQTT_CALLBACK_SIGNATURE, Client& client, Stream& stream) {
    this->_state = MQTT_DISCONNECTED;
    setServer(addr,port);
    setCallback(callback);
    setClient(client);
    setStream(stream);
}
Example #21
0
PubSubClient::PubSubClient(const char* domain, uint16_t port, Client& client, Stream& stream) {
    this->_state = MQTT_DISCONNECTED;
    setServer(domain,port);
    setClient(client);
    setStream(stream);
    setProtocol(MQTT_VERSION);
}
Example #22
0
PubSubClient::PubSubClient(IPAddress addr, uint16_t port, Client& client, Stream& stream)
{
	this->_state = MQTT_DISCONNECTED;
	setServer(addr,port);
	setClient(client);
	setStream(stream);
}
Example #23
0
GameScripting::GameScripting(Server* server)
{
	setServer(server);

	// setEnv(env) is called by ScriptApiEnv::initializeEnvironment()
	// once the environment has been created

	//TODO add security

	luaL_openlibs(getStack());

	SCRIPTAPI_PRECHECKHEADER

	// Create the main minetest table
	lua_newtable(L);

	lua_newtable(L);
	lua_setfield(L, -2, "object_refs");

	lua_newtable(L);
	lua_setfield(L, -2, "luaentities");

	lua_setglobal(L, "minetest");

	// Initialize our lua_api modules
	lua_getglobal(L, "minetest");
	int top = lua_gettop(L);
	InitializeModApi(L, top);
	lua_pop(L, 1);

	infostream << "SCRIPTAPI: initialized game modules" << std::endl;
}
Example #24
0
PubSubClient::PubSubClient(IPAddress addr, uint16_t port, Client& client) {
    this->_state = MQTT_DISCONNECTED;
    setServer(addr, port);
    setClient(client);
    this->stream = NULL;
    setProtocol(MQTT_VERSION);
}
Example #25
0
PubSubClient::PubSubClient(uint8_t *ip, uint16_t port, Client& client, Stream& stream) {
    this->_state = MQTT_DISCONNECTED;
    setServer(ip,port);
    setClient(client);
    setStream(stream);
    setListener(NULL);  // TOAST
}
Example #26
0
PubSubClient::PubSubClient(uint8_t *ip, uint16_t port, MQTT_CALLBACK_SIGNATURE, Client& client, Stream& stream) {
    this->_state = MQTT_DISCONNECTED;
    setServer(ip,port);
    setCallback(callback);
    setClient(client);
    setStream(stream);
    setProtocol(MQTT_VERSION);
}
Example #27
0
PubSubClient::PubSubClient(const char* domain, uint16_t port, MQTT_CALLBACK_SIGNATURE, Client& client) {
    this->_state = MQTT_DISCONNECTED;
    setServer(domain,port);
    setCallback(callback);
    setClient(client);
    this->stream = NULL;
    setProtocol(MQTT_VERSION);
}
Example #28
0
PubSubClient::PubSubClient(uint8_t *ip, uint16_t port, MQTT_CALLBACK_SIGNATURE, Client& client, Stream& stream) {
    this->_state = MQTT_DISCONNECTED;
    setServer(ip,port);
    setCallback(callback);
    setClient(client);
    setStream(stream);
    setListener(NULL);  // TOAST
}
Example #29
0
PubSubClient::PubSubClient(IPAddress addr, uint16_t port, MQTT_CALLBACK_SIGNATURE, Client& client) {
    this->_state = MQTT_DISCONNECTED;
    setServer(addr, port);
    setCallback(callback);
    setClient(client);
    this->stream = NULL;
    setListener(NULL);  // TOAST
}
Example #30
0
void dlgEditProfile::openMudList ()
{
  const cMUDEntry *e = dlgMudList::getEntry (this);
  if (!e) return;
  setName (e->name);
  setServer (e->host);  // TODO: perhaps add an ability to set IP instead of name ?
  setPort (e->port);
}