示例#1
0
    void MimetypeResource::doPATCH(Descriptor& socket, HttpMessage& request, const char* remainingPath)
    {
        Json json;
        json << request.body;

        if (json.type() != JsonType::Object) throw HttpCode::Http406;

        if (! (json.size() == 1 &&
               json.contains("defaultApplications") &&
               json["defaultApplications"].type() == JsonType::Array)) {
            throw HttpCode::Http422;
        }

        MimeappsList mimeappsList(xdg::config_home() + "/mimeapps.list");
        auto& defaultAppsForMime = mimeappsList.defaultApps[remainingPath];
        defaultAppsForMime.clear();
        json["defaultApplications"].eachElement([&socket, &defaultAppsForMime](Json& element) {
            if (element.type() != JsonType::String) {
                return sendStatus(socket, HttpCode::Http422);
            }

            defaultAppsForMime.push_back(element.toString());
        });

        mimeappsList.write();

        sendStatus(socket, HttpCode::Http204);
    }
/****************************************BEGIN OF MAIN**************************************/
main(){
    long timeOut = 0;
	//safety precaution, the motor won't spin forever
	long setTimeOut = 1000000; //default 1000000
	int *currentCommand;
	char currentSetting = 'c'; //shades always start closed.
    int k = 0;
	int i = 0;

    init_ports();


	while(1){
		       //this is a command coming from the arduino
		if((PORTB & 0b01110000) == (dataPin + parityPin)){ //initialization bracket
			currentCommand = getCommand();

			//for debug
			/* for(i=0; i<8; i){
				PORTC = 0xff;
				delay_ms(40);
				PORTC = 0x00;
				if(*(currentCommand+i) == dataPin){
					PORTA = 0b0000010;
				}
				else
					PORTA = 0b00000100;
				delay_ms(2000);
				PORTA = 0x00;
			} */

			if (*currentCommand == dataPin){   //if its 0b00000001
				openShades(setTimeOut); //Pin RA0 trips "open" relay
				currentSetting = 'o';
			}
			else if(*(currentCommand +1) == 0x00){ //0b00000000
				closeShades(setTimeOut); //Pin RA1 trips "close" relay
				currentSetting = 'c';
			}
			while(PORTB & 0b01110000);  // wait until port B is clean before continuing
		}

		else if(PORTC & 0b00000001){  //the button on the console
			delay_ms(1); //debounce
			if(PORTC & 0b00000001){  // OPEN THE SHADES
				if(currentSetting == 'c'){
					openShades(setTimeOut);
					sendStatus('o');
					currentSetting = 'o';
				}
				else if(currentSetting =='o'){
					closeShades(setTimeOut);
					sendStatus('c');
					currentSetting = 'c';
				}
			}
		}
	}
}
示例#3
0
void *YahooClient::processEvent(Event *e)
{
    if (e->type() == EventContactChanged) {
        Contact *contact = (Contact*)(e->param());
        string grpName;
        string name;
        name = contact->getName().utf8();
        Group *grp = NULL;
        if (contact->getGroup())
            grp = getContacts()->group(contact->getGroup());
        if (grp)
            grpName = grp->getName().utf8();
        ClientDataIterator it(contact->clientData, this);
        YahooUserData *data;
        while ((data = (YahooUserData*)(++it)) != NULL) {
            moveBuddy(data, grpName.c_str());
        }
    }
    if (e->type() == EventContactDeleted) {
        Contact *contact = (Contact*)(e->param());
        ClientDataIterator it(contact->clientData, this);
        YahooUserData *data;
        while ((data = (YahooUserData*)(++it)) != NULL) {
            removeBuddy(data);
        }
    }
    if (e->type() == EventTemplateExpanded) {
        TemplateExpand *t = (TemplateExpand*)(e->param());
        sendStatus(YAHOO_STATUS_CUSTOM, t->tmpl.local8Bit());
    }
    return NULL;
}
示例#4
0
void ControlReaderThread::setupRequest(void *data)
{
    struct usb_functionfs_event *e = (struct usb_functionfs_event *)data;

    /* USB Still Image Capture Device Definition, Section 5 */
    /* www.usb.org/developers/devclass_docs/usb_still_img10.pdf */

    //qDebug() << "bRequestType:" << e->u.setup.bRequestType;
    //qDebug() << "bRequest:" << e->u.setup.bRequest;
    //qDebug() << "wValue:" << e->u.setup.wValue;
    //qDebug() << "wIndex:" << e->u.setup.wIndex;
    //qDebug() << "wLength:" << e->u.setup.wLength;

    switch(e->u.setup.bRequest) {
    case PTP_REQ_GET_DEVICE_STATUS:
        if(e->u.setup.bRequestType == 0xa1)
            sendStatus(m_status);
        else
            stall((e->u.setup.bRequestType & USB_DIR_IN)>0);
        break;
    case PTP_REQ_CANCEL:
        emit cancelTransaction();
        break;
    case PTP_REQ_DEVICE_RESET:
        emit deviceReset();
        break;
    //case PTP_REQ_GET_EXTENDED_EVENT_DATA:
    default:
        stall((e->u.setup.bRequestType & USB_DIR_IN)>0);
        break;
    }
}
示例#5
0
void
CmdTask::handleMsg(Msg *msg)
{
	switch (msg->getCode()) {
	case ssechan::REQUEST_INTRINSICS:
		sendIntrinsics(msg);
		break;
	case ssechan::REQUEST_STATUS:
		sendStatus(msg);
		break;
	case ssechan::START:
		startChannelizer(msg);
		break;
	case ssechan::STOP:
		stopChannelizer(msg);
		break;
	case ssechan::SHUTDOWN:
		shutdown(msg);
		break;
	default:
		FatalStr((int32_t) msg->getCode(), "msg code");
		LogFatal(ERR_IMT, msg->getActivityId(), "code %d", msg->getCode());
		break;
	}
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->ui->b_disconnect->setEnabled(false);
    this->ui->gb_top->setEnabled(false);
    this->ui->b_send->setEnabled(false);
    this->ui->b_verify->setEnabled(false);
    this->ui->b_repeat->setEnabled(false);
    this->ui->b_reset->setEnabled(false);
    this->btl = new Bootloader();
    this->tfThread = new transferThread();

    this->lastAction = ACTION_NONE;

    this->ui->gb_top->setEnabled(true);
    QObject::connect(this->ui->b_quit,SIGNAL(clicked()),this,SLOT(Quit()));
    QObject::connect(this->ui->b_qt,SIGNAL(clicked()),qApp,SLOT(aboutQt()));
    QObject::connect(this->ui->b_connect, SIGNAL(clicked()), this, SLOT(Connect()));
    QObject::connect(this->ui->b_disconnect, SIGNAL(clicked()), this, SLOT(Disconnect()));
    QObject::connect(this->ui->b_send, SIGNAL(clicked()), this, SLOT(Send()));
    QObject::connect(this->ui->b_verify, SIGNAL(clicked()), this, SLOT(Verify()));
    QObject::connect(this->ui->b_repeat, SIGNAL(clicked()), this, SLOT(Repeat()));
    QObject::connect(this->ui->b_reset, SIGNAL(clicked()), this, SLOT(ResetMCU()));


    // Thread
    QObject::connect(this->tfThread, SIGNAL(sendProgress(quint32)), this, SLOT(updateProgress(quint32)));
    QObject::connect(this->tfThread, SIGNAL(sendStatus(QString)), this, SLOT(updateStatus(QString)));
    QObject::connect(this->tfThread, SIGNAL(sendLock(bool)), this, SLOT(lockUI(bool)));
    QObject::connect(this->ui->b_stop, SIGNAL(clicked()), this->tfThread, SLOT(halt()));
    QObject::connect(this->tfThread, SIGNAL(sendLog(QString)), this, SLOT(log(QString)));

}
示例#7
0
void QGraph::mouseReleaseEvent(QMouseEvent *e){
	pushed &= ~e->button();
	this->setCursor(QCursor(Qt::CrossCursor));
	if(e->button() == Qt::LeftButton){
		if((toViewport(press) - toViewport(e->pos())).isNull())
			return;
		
		QPoint p=toViewport(e->pos())+viewport.topLeft();
		QPoint p1=toViewport(press)+viewport.topLeft();
		
		viewport = QRect(p1, p);
		if(viewport.bottom() > viewport.top()){
			int a=viewport.bottom();
			viewport.setBottom(viewport.top());
			viewport.setTop(a);
		}
		
		if(viewport.left() > viewport.right()){
			int a=viewport.left();
			viewport.setLeft(viewport.right());
			viewport.setRight(a);
		}
		
		update_scale();
		update_points();
		sendStatus(QString("(%1, %2)-(%3, %4)").arg(viewport.left()).arg(viewport.top()).arg(viewport.right()).arg(viewport.bottom()));
	}
	this->repaint(false);
}
示例#8
0
void cLiveStreamer::sendStreamPacket(sStreamPacket *pkt)
{
  bool bReady = IsReady();

  if(!bReady || pkt == NULL || pkt->size == 0)
    return;

  // Send stream information as the first packet on startup
  if (IsStarting() && bReady)
  {
    // wait for first I-Frame (if enabled)
    if(m_waitforiframe && pkt->frametype != cStreamInfo::ftIFRAME) {
      return;
    }

    INFOLOG("streaming of channel started");
    m_last_tick.Set(0);
    m_requestStreamChange = true;
    m_startup = false;
  }

  // send stream change on demand
  if(m_requestStreamChange)
    sendStreamChange();

  // if a audio or video packet was sent, the signal is restored
  if(m_SignalLost && (pkt->content == cStreamInfo::scVIDEO || pkt->content == cStreamInfo::scAUDIO)) {
    INFOLOG("signal restored");
    sendStatus(XVDR_STREAM_STATUS_SIGNALRESTORED);
    m_SignalLost = false;
    m_requestStreamChange = true;
    m_last_tick.Set(0);
    return;
  }

  if(m_SignalLost)
    return;

  // initialise stream packet
  MsgPacket* packet = new MsgPacket(XVDR_STREAM_MUXPKT, XVDR_CHANNEL_STREAM);
  packet->disablePayloadCheckSum();

  // write stream data
  packet->put_U16(pkt->pid);
  packet->put_S64(pkt->pts);
  packet->put_S64(pkt->dts);
  if(m_protocolVersion >= 5) {
    packet->put_U32(pkt->duration);
  }

  // write frame type into unused header field clientid
  packet->setClientID((uint16_t)pkt->frametype);

  // write payload into stream packet
  packet->put_U32(pkt->size);
  packet->put_Blob(pkt->data, pkt->size);

  m_Queue->Add(packet);
  m_last_tick.Set(0);
}
示例#9
0
void Led::recieveCommand(uint8_t name, uint8_t prop, byte value){
	if(name==_name){
		if(prop == 0x01){
			_isOn = (value == 0x01);
		}
		sendStatus();
	}
}
示例#10
0
/**
 * Set media status.
 *
 * @param[in] status Media status (STATUS_LOADING, STATUS_PLAYING, STATUS_PAUSED, etc)
 *
 */
void MediaPluginBase::setStatus(EStatus status)
{
    if(mStatus != status)
    {
        mStatus = status;
        sendStatus();
    }
}
示例#11
0
void CommunObject::decrypt(const QString &key, const QString &info) {
    qDebug() << "Key: " << key;
    qDebug() << "info: " << info;
    try {
        CryptoWrapper crypto(key, info);
        QString results;
        crypto.decrypt(results);
        emit sendResults(results);
        emit sendStatus("completed the Decryption operations");
        qDebug() << "Results: " << results;
    }
    catch (...) {
        const QString message = "Error occurred while Decrypting";
        emit sendStatus(message);
        qWarning() << message;
    }
}
示例#12
0
void YahooClient::setInvisible(bool bState)
{
    if (bState == getInvisible())
        return;
    TCPClient::setInvisible(bState);
    if (getState() != Connected)
        return;
    sendStatus(data.owner.Status.value, data.owner.AwayMessage.ptr);
}
示例#13
0
文件: ofApp.cpp 项目: husk00/phi
//--------------------------------------------------------------
void ofApp::update(){
	 //sequencing time
	      if(!pausa){
	       if(ofGetElapsedTimeMillis() - elapsedTime > 3000.0) {
	          nextStep = true;
	          elapsedTime = ofGetElapsedTimeMillis();
	          enviado = false;
	          }
	    }
	  //active step
	  for(int i=0;i < 8; i++){
	      if(myStep[i]->inside(ofGetMouseX(), ofGetMouseY())){
	      whichStep =  i;
	      }
	    }

	  //activeStep
	  for(int i=0;i <8; i++){
	      if(myStep[i]->active) activeStep = myStep[i]->id;
	  }
	  // send fx
	  int fxCollection[4];
	  for(int i=0;i <4; i++){
	    fxCollection[i] = fxState[(activeStep*4)+i];
	    }
	  sendFX(fxCollection);

	  //colorize active step
	  if(nextStep == true){
	      counter +=1;
	      nextStep = false;
	      if(counter > 7){
	        counter = 0;
	      }
	  }
		  for(int j = 0; j < 32; j++){
	              pattern[j]->update();
	              if(pattern[j]->isSelected) movingPattern = pattern[j]->id-1;
	        }
	  for(int i=0;i < 8; i++){
	      myStep[i]->update(counter);
	    }
	  //chacking buttons state
	  if(myButton[0]->action[0] == true){
	      reset();
	      myButton[0]->action[0] = false;
	   }

	  if(myButton[1]->action[1] == true){
	      random();
	      myButton[1]->action[1] = false;
	   }
	  if(myButton[2]->action[2] == true){
	      sendStatus();
	      myButton[2]->action[2] = false;
	   }
}
/*****************************************************************************
*
* Handle the processing of a HEAD request type.
*
* file:		client socket stream 
* url:		unverified url requested in the GET request
*
*****************************************************************************/
static int reqHead(FILE *file, char *url)
{
	++headCount;

	/* Special processing for status requests */
	if (!strcmp(url, "/status"))
		return(sendStatus(file, 0));

	return(sendHeader(file, url));
}
示例#15
0
void CommunObject::copy2clipboard(const QString& results) {
    qDebug() << "copy2clipboard: " << results;
    //if (results == "") return false;

    QClipboard* clipboard = QGuiApplication::clipboard();
    clipboard->setText(results);
    const QString originalText = clipboard->text();

    // debug
    emit sendStatus("Clipboard text: " + originalText);
}
示例#16
0
void scene::setSize(int wS, int hS, int s, bool **f)
{
    sp = 100 * 10/s;
    m_game = new game(wS, hS, f);
    m_game->newGame();
    sendStatus();
    m_timer.start( sp );
    w = wS * 10.0f;
    h = hS * 10.0f;
    paintGL();
}
示例#17
0
void ICQClient::setStatus(unsigned short status)
{
    if (status == ICQ_STATUS_OFFLINE){
        switch (m_state){
        case Reconnect:{
                m_reconnectTime = 0;
                m_state = Logoff;
                ICQEvent e(EVENT_STATUS_CHANGED, Uin);
                process_event(&e);
                break;
            }
        case Logoff:
            break;
        default:
            close();
            uStatus = ICQ_STATUS_OFFLINE;
            if (m_state == ForceReconnect){
                m_state = Reconnect;
                time_t reconnect;
                time(&reconnect);
                reconnect += RECONNECT_TIMEOUT;
                if (m_reconnectTime < reconnect) m_reconnectTime = reconnect;
            }else{
                m_state = Logoff;
            }
            ICQEvent e(EVENT_STATUS_CHANGED, Uin);
            process_event(&e);
            time_t now;
            time(&now);
            list<ICQUser*>::iterator it;
            for (it = contacts.users.begin(); it != contacts.users.end(); it++){
                if ((*it)->uStatus == ICQ_STATUS_OFFLINE) continue;
                (*it)->setOffline();
                ICQEvent e(EVENT_STATUS_CHANGED, (*it)->Uin);
                process_event(&e);
            }
        }
        return;
    }
    if (m_fd == -1){
        m_nSequence = rand() & 0x7FFFF;
        m_nMsgSequence = 1;
        m_reconnectTime = 0;
        m_state = Uin ? Connect : Register;
        ICQEvent e(EVENT_STATUS_CHANGED, Uin);
        process_event(&e);
        connect(ServerHost.c_str(), ServerPort());
    }
    if (m_state != Logged){
        m_nLogonStatus = status;
        return;
    }
    sendStatus(status);
}
示例#18
0
int Q3DGraph::setFuncMML(QString TextMML){
	int ret = func3d.setTextMML(TextMML);
	if(func3d.err.isEmpty())
		return load();
	else {
		sendStatus(i18n("Error: %1").arg(func3d.err));
		tefunc=false;
		this->repaint();
		return ret;
	}
}
示例#19
0
void XxxForm::saveAction(void) {
	if (!save()) {
		errorStatus(qApp->tr("Failure trying to register the record."));
	} else {
		if (xXxModel->getId() > 0) {
			emit formChanged();
			emit sendStatus(QString(qApp->tr(
					"The xxx \"%1\" was changed successfully.")).arg(
					xXxModel->getName()), 0);
		} else {
			emit formAdded();
			emit sendStatus(QString(qApp->tr(
					"The xxx \"%1\" was added successfully.")).arg(
					xXxModel->getName()), 0);
		}
		updateModels();
		updateForms();
		close();
	}
}
示例#20
0
void QGraph::mouseMoveEvent(QMouseEvent *e){
	mark=calcImage(fromWidget(e->pos()));
	
	if(pushed & Qt::MidButton && ant != toViewport(e->pos())){
		QPoint rel = e->pos() - press - (toWidget(.5,.5)-toWidget(0.,0.));
		rel = toViewport(rel);
		viewport.setLeft(viewport.left() - rel.x()); viewport.setRight(viewport.right() - rel.x());
		viewport.setTop(viewport.top() - rel.y()); viewport.setBottom(viewport.bottom() - rel.y());
		
		update_points();
		press = e->pos();
		ant = toViewport(e->pos());
		valid=false;
		sendStatus(QString("(%1, %2)-(%3, %4)").arg(viewport.left()).arg(viewport.top()).arg(viewport.right()).arg(viewport.bottom()));
	} else if(pushed == Qt::LeftButton) {
		last = e->pos();
	} else if(pushed==0)
		sendStatus(QString("x=%1 y=%2") .arg(mark.x(),3,'f',2).arg(mark.y(),3,'f',2));
	
	this->repaint(false);
}
示例#21
0
void QGraph::wheelEvent(QWheelEvent *e){
	int d = e->delta()>0 ? -1 : 1;
	if(viewport.left()-d < 1 && viewport.top()+d > 1 && viewport.right()+d > 1 && viewport.bottom()-d < 1) {
		viewport.setLeft(viewport.left() - d);
		viewport.setTop(viewport.top() + d);
		viewport.setRight(viewport.right() + d);
		viewport.setBottom(viewport.bottom() - d);
		update_scale();
		update_points();
	}
	sendStatus(QString("(%1, %2)-(%3, %4)").arg(viewport.left()).arg(viewport.top()).arg(viewport.right()).arg(viewport.bottom()));
}
示例#22
0
void Button::init(System &system, int pin, uint8_t name)
{
	_system = system;
	_pin = pin;
	pinMode(_pin, INPUT);

	_isOn = (_isTest1 = _isTest2 = digitalRead(_pin));
	_name = name;
	
	sendStatus();
	
}
示例#23
0
int Q3DGraph::load() {
	func3d.vars.modifica("x", 0);
	func3d.vars.modifica("y", 0);
	func3d.Calcula();
	
	if(func3d.err.isEmpty()) {
		QTime t;
		t.restart();
		mem();
		tefunc=true;
		crea();
		this->repaint();
		sendStatus(i18n("Done: %1ms").arg(t.elapsed()));
		return 0;
	} else {
		sendStatus(i18n("<b>Error:</b> %1").arg(func3d.err));
		tefunc=false;
		this->repaint();
		return -1;
	}
}
示例#24
0
void RemoteBlockReader::readNextPacket() {
    assert(position >= size);
    lastHeader = readPacketHeader();
    int dataSize = lastHeader->getDataLen();
    int64_t pendingAhead = 0;

    if (!lastHeader->sanityCheck(lastSeqNo)) {
        THROW(HdfsIOException, "RemoteBlockReader: Packet failed on sanity check for block %s from Datanode %s.",
              binfo.toString().c_str(), datanode.formatAddress().c_str());
    }

    assert(dataSize > 0 || lastHeader->getPacketLen() == sizeof(int32_t));

    if (dataSize > 0) {
        int chunks = (dataSize + chunkSize - 1) / chunkSize;
        int checksumLen = chunks * checksumSize;
        size = checksumLen + dataSize;
        assert(size == lastHeader->getPacketLen() - static_cast<int>(sizeof(int32_t)));
        buffer.resize(size);
        in->readFully(&buffer[0], size, readTimeout);
        lastSeqNo = lastHeader->getSeqno();

        if (lastHeader->getPacketLen() != static_cast<int>(sizeof(int32_t)) + dataSize + checksumLen) {
            THROW(HdfsIOException, "Invalid Packet, packetLen is %d, dataSize is %d, checksum size is %d",
                  lastHeader->getPacketLen(), dataSize, checksumLen);
        }

        if (verify) {
            verifyChecksum(chunks);
        }

        /*
         * skip checksum
         */
        position = checksumLen;
        /*
         * the first packet we get may start at the position before we required
         */
        pendingAhead = cursor - lastHeader->getOffsetInBlock();
        pendingAhead = pendingAhead > 0 ? pendingAhead : 0;
        position += pendingAhead;
    }

    /*
     * we reach the end of the range we required, send status to datanode
     * if datanode do not sending data anymore.
     */

    if (cursor + dataSize - pendingAhead >= endOffset && readTrailingEmptyPacket()) {
        sendStatus();
    }
}
示例#25
0
void scene::slotUpdate()
{
    snake::Status status = m_game->status();

    switch( status ) {
    case snake::LIVE:
        break;
    case snake::INCREASED:
        sendStatus();
        break;
    case snake::DEAD:
        m_timer.stop();
        sendStatus();
        break;
    case snake::WIN:
        m_timer.stop();
        sendStatus();
        return;
    }

    m_game->tick();
    update();
}
void	savethread::run() {
	debug(LOG_DEBUG, DEBUG_LOG, 0, "download thread starts running");
	std::list<std::pair<std::string, int> >::const_iterator	i;
	for (i = _images.begin(); i != _images.end(); i++) {
		std::string	reponame = i->first;
		int	imageid = i->second;
		if (_stopProcess) {
			debug(LOG_DEBUG, DEBUG_LOG, 0, "process abort request");
			emit downloadAborted();
			return;
		}
		QString	r(i->first.c_str());
		downloadstatus	s(r, i->second);
		emit sendStatus(s);
		// now download image
		debug(LOG_DEBUG, DEBUG_LOG, 0, "image %d from repo %s", 
			imageid, reponame.c_str());

		// get image
		snowstar::RepositoryPrx repository
			= _repositories->get(reponame);
		snowstar::ImageInfo	info = repository->getInfo(imageid);
		std::string	filename = astro::stringprintf("%s/%s",
			_directory.c_str(), info.filename.c_str());
		snowstar::ImageFile	image = repository->getImage(imageid);
		astro::image::ImagePtr	imageptr = snowstar::convertfile(image);

		// get the file name from the image
	
                debug(LOG_DEBUG, DEBUG_LOG, 0, "filename: %s",
			filename.c_str());

		// write image
                astro::io::FITSout      out(filename);
                if (out.exists()) {
                        out.unlink();
                }
                try {
                        out.write(imageptr);
                } catch (astro::io::FITSexception& x) {
			_errormsg = astro::stringprintf("cannot write image "
				"%d to %s: %s", imageid, filename.c_str(),
				x.what());
			emit downloadAborted();
			return;
		}
	}
	debug(LOG_DEBUG, DEBUG_LOG, 0, "download complete");
	emit downloadComplete();
}
void LLPathfindingNavMesh::handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
	llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
	llassert(mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion());
	mNavMeshStatus = pNavMeshStatus;
	if (mNavMeshRequestStatus == kNavMeshRequestChecking)
	{
		llassert(!mNavMeshData.empty());
		setRequestStatus(kNavMeshRequestCompleted);
	}
	else
	{
		sendStatus();
	}
}
void LLPathfindingNavMesh::handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
	llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
	if (mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion())
	{
		mNavMeshStatus = pNavMeshStatus;
		sendStatus();
	}
	else
	{
		mNavMeshData.clear();
		mNavMeshStatus = pNavMeshStatus;
		setRequestStatus(kNavMeshRequestNeedsUpdate);
	}
}
void LLFacebookStatusPanel::onSend()
{
	LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookStatusPanel"); // just in case it is already listening
	LLEventPumps::instance().obtain("FacebookConnectState").listen("LLFacebookStatusPanel", boost::bind(&LLFacebookStatusPanel::onFacebookConnectStateChange, this, _1));
	
	// Connect to Facebook if necessary and then post
	if (LLFacebookConnect::instance().isConnected())
	{
		sendStatus();
	}
	else
	{
		LLFacebookConnect::instance().checkConnectionToFacebook(true);
	}
}
示例#30
0
void Status::tick()
{
    // Si on a de la place sur le buffer de sortie, alors on accepte
    if (Serial.availableForWrite() < sizeof(struct Payload)) {
        // Il faut attendre pendant au moins ce temps
        this->nextTick = UTime::now() + (sizeof(struct Payload) + 2) * CHAR_XMIT_DELAY;
        return;
    }
    sendStatus();
    if (motor.isMoving() || filterWheelMotor.isMoving()) {
        this->nextTick += MS(250);
    } else {
        this->nextTick += LongDuration::seconds(10);
    }
}