Esempio n. 1
0
void Server::incomingConnection(qintptr socketDescriptor)
{
    Client *client = new Client(socketDescriptor);
    clients->push_back(client);
    QObject::connect(client,SIGNAL(sendMessageToAll(QString)),this,SLOT(sendMessageToAll(QString)));
    QObject::connect(client,SIGNAL(showDialog(QString)),this,SLOT(onShowDialog(QString)));
    QObject::connect(client,SIGNAL(signalDisconnected(QString)),this,SLOT(onClientDisconnected(QString)));
    QObject::connect(client,SIGNAL(signalConnected(QString)),this,SLOT(onClientConnected(QString)));
    QObject::connect(client,SIGNAL(saveHistory(QString)),this,SLOT(onSaveHistory(QString)));
    QObject::connect(client,SIGNAL(getHistory()),this,SLOT(onGetHistory(Client*)));
    onGetHistory(client);
}
CTelegramAlertNotification::CTelegramAlertNotification(
        const CTelegramAlertNotificationConfig& config)
    : mConfig(config)
    , mLastSendTime(CDateTime::getSecondsSinceEpoch())
    , mIsFirstTime(true)
{
#ifdef __BUILD_TELEGRAM_BOT__
    mBot.reset(new TgBot::Bot(config.mToken));
    if (!mConfig.mToken.empty())
    {
        mBot->getEvents().onCommand({"g", "G", "get", "Get"},GetAllImages);
        mBot->getEvents().onCommand({"g", "G", "get", "Get"},GetAllImages);
        mBot->getEvents().onCommand({"write", "Write"}, writeToSerial);

        mBot->getEvents().onCommand({"HomeIn", "homeIn", "setHomeIn", "SetHomeIn"}, setHomeIn);
        mBot->getEvents().onCommand({"HomeOut", "homeOut", "setHomeout", "SetHomeOut"}, setHomeOut);

        mBot->getEvents().onCommand({"Stat", "stat", "Status", "status", "s", "S"}, getStatus);
        mBot->getEvents().onCommand({"h", "H", "help", "Help", "start"}, help);

        mBot->getEvents().onCommand({"MotionOff", "motionOff"}, motionAlarmOff);
        mBot->getEvents().onCommand({"MotionOn", "motionOn"}, motionAlarmOn);
        mBot->getEvents().onUnknownCommand(help);
        mBot->getEvents().onNonCommandMessage(help);

        std::thread bootThreadLoop(botLoop, mBot);
        bootThreadLoop.detach();

        sendMessageToAll(mBot, mConfig, "System start on " + CDateTime::getDateTimeAsString()
                         + "\n\n" + sCommands, 0, true);
    }
#endif
}
Esempio n. 3
0
void Server::onClientDisconnected(QString message)
{
    clients->removeOne((Client*)sender());
    onSaveHistory(message);
    sendMessageToAll(message);
    emit showDialog(message);
}
Esempio n. 4
0
void ofApp::soundPlayerJustStoppedPlaying(){
    if (m_bLooping){
    
        if (++m_iCurPlaylistItem >= playList.size()){
            m_iCurPlaylistItem = 0;
        }
        playWithAudio(playList[m_iCurPlaylistItem]);
        
    } else {
        if (++m_iCurPlaylistItem < playList.size()){
            playWithAudio(playList[m_iCurPlaylistItem]);
        } else {
            m_iCurPlaylistItem = 0;
                ofxOscMessage mStop;
                mStop.setAddress("/stop");
                sendMessageToAll(mStop);
                m_bSoundPlayerIsPlaying = false;
                m_bStartedSoundPlayer = false;
        }
    }
}
Esempio n. 5
0
IgnoreList::IgnoreList(QWidget* _p, const char* _n)
          : QWidget() {

	mUserList = new UserListView(true, this, "ignorelist");
	mUserList->setAcceptDrops(true);
	connect(mUserList, SIGNAL(activated(const QString&)), SIGNAL(activated(const QString&)));
	connect(mUserList, SIGNAL(dropSlsk(const QList<QUrl>&)), SLOT(slotDropSlsk(const QList<QUrl>&)));
	connect(museeq, SIGNAL(addedIgnored(const QString&, const QString&)), mUserList, SLOT(add(const QString&, const QString&)));
	connect(museeq, SIGNAL(removedIgnored(const QString&)), mUserList, SLOT(remove(const QString&)));
	connect(museeq, SIGNAL(addedIgnored(const QString&, const QString&)), this, SLOT(ignoreListChanged()));
	connect(museeq, SIGNAL(removedIgnored(const QString&)), this, SLOT(ignoreListChanged()));
	connect(museeq, SIGNAL(disconnected()), mUserList, SLOT(clear()));

	QVBoxLayout *MainLayout = new QVBoxLayout(this);
	MainLayout->addWidget(mUserList);

	QHBoxLayout *layout = new QHBoxLayout;
	MainLayout->addLayout(layout);

	QLabel *label = new QLabel(tr("Ignore a new user:"******"Add"), this);
	layout->addWidget(mAdd);

    layout->addStretch();

	mSendMessageToAll = new QPushButton(tr("Send a message to all ignored users"), this);
	mSendMessageToAll->setEnabled(false);
	layout->addWidget(mSendMessageToAll);

	connect(mEntry, SIGNAL(returnPressed()), SLOT(addIgnored()));
	connect(mAdd, SIGNAL(clicked()), SLOT(addIgnored()));
	connect(mSendMessageToAll, SIGNAL(clicked()), SLOT(sendMessageToAll()));
}
Esempio n. 6
0
/*!
*	Timing processing
*/
void clkAppCback(int clk){
	if (clk == KRN_APP_RESERVED_TIMER){
		sendMessageToAll(PRC_MESSAGE_CLK, 0, 0);
	}
}
Esempio n. 7
0
void ofApp::keyPressed(int key){

    //toggle looping(l)
    if(key == 'l' || key == 'L'){
        if(m_bLooping){
            ofxOscMessage m;
            m.setAddress("/unloop");
            sendMessageToAll(m);
        } else {
            ofxOscMessage m;
            m.setAddress("/loop");
            sendMessageToAll(m);
        }
        m_bLooping = !m_bLooping;
    }
    
    if(key == 'p' || key == 'P'){
        playAllVideos();
        //        soundPlayer.play();
    }
    
    //stop playing
    if( key == 's' || key == 'S'){
        m_bLooping = false;
        ofxOscMessage m;
        m.setAddress("/stop");
        sendMessageToAll(m);
        if (soundPlayer.isPlaying()){
            soundPlayer.stop();
        }
    }

#warning next and back may return previous file name as playing
    //play next video
    if( key == 'n' || key == 'N'){
        
        if (soundPlayer.isPlaying()){
            soundPlayerJustStoppedPlaying();
        } else {
            ofxOscMessage m;
            m.setAddress("/next");
            sendMessageToAll(m);
        }
    }
    //play previous video
    if( key == 'b' || key == 'B'){
        ofxOscMessage m;
        m.setAddress("/prev");
        sendMessageToAll(m);
    }
    //toggle info screen
    if(key == 'i' || key == 'I'){
        ofxOscMessage m;
        m.setAddress("/info");
        sendMessageToAll(m);
    }
    //quit HPlayer
    if(key == 'Q'){
        ofxOscMessage m;
        m.setAddress("/quit");
        sendMessageToAll(m);
    }
    if(key == 'c'){
        for(int i = 0; i < NUM_MSG_STRINGS; i++){
            msg_strings[i] = "";
        }
        current_msg_string = 0;
    }
}