Beispiel #1
0
void Wiimote::setReportingMode(bool insideReader)
	{
	/* Assemble the data request packet: */
	unsigned char requestData[]={0x52,0x12,0x00,0x00};
	
	if(readContinuously)
		requestData[2]|=0x04;
	
	if(extensionDevice!=NONE)
		{
		if(readAccelerometers&&readIRTracking)
			requestData[3]=0x37;
		else if(readAccelerometers)
			requestData[3]=0x35;
		else if(readIRTracking)
			requestData[3]=0x36;
		else
			requestData[3]=0x32;
		}
	else
		{
		if(readAccelerometers&&readIRTracking)
			requestData[3]=0x33;
		else if(readAccelerometers)
			requestData[3]=0x31;
		else if(readIRTracking)
			requestData[3]=0x36;
		else
			requestData[3]=0x30;
		}
	
	/* Set the appropriate IR camera reporting mode for the data reporting mode: */
	if(readIRTracking)
		{
		if(insideReader)
			{
			/* Write to the camera's register area: */
			unsigned char IRMode[]={0x52,0x16,0x04,0xb0,0x00,0x33,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
			if(extensionDevice==NONE&&readAccelerometers&&readIRTracking)
				IRMode[7]=0x03;
			writePacket(IRMode,sizeof(IRMode));

			/* Wait for acknowledgment: */
			unsigned char packet[21];
			ssize_t packetSize;
			while((packetSize=read(readSocket,packet,sizeof(packet)))==0||int(packet[1])!=0x22)
				;
			}
		else
			{
			unsigned char IRMode=0x01;
			if(extensionDevice==NONE&&readAccelerometers&&readIRTracking)
				IRMode=0x03;
			uploadData(true,0xb00033,&IRMode,sizeof(unsigned char));
			}
		}
	
	/* Send the packet: */
	writePacket(requestData,sizeof(requestData));
	}
Beispiel #2
0
Response S3RESTfulService::put(const string &url, HTTPHeaders &headers, const S3VectorUInt8 &data) {
    Response response(RESPONSE_ERROR);

    headers.CreateList();
    CURLWrapper wrapper(url, headers.GetList(), this->lowSpeedLimit, this->lowSpeedTime,
                        this->debugCurl);
    CURL *curl = wrapper.curl;

    curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&response);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, RESTfulServiceWriteFuncCallback);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, this->verifyCert);

    UploadData uploadData(data);
    curl_easy_setopt(curl, CURLOPT_READDATA, (void *)&uploadData);
    curl_easy_setopt(curl, CURLOPT_READFUNCTION, RESTfulServiceReadFuncCallback);
    curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)data.size());
    curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);

    curl_easy_setopt(curl, CURLOPT_HEADERDATA, (void *)&response);
    curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, RESTfulServiceHeadersWriteFuncCallback);

    this->performCurl(curl, response);

    return response;
}
void CompactSubGeometry::activateSecondaryUVBuffer(int index, IContext* context)
{
	if (!m_activeBuffer || m_activeContext != context)
		createBuffer(context);

	if (m_activeDataInvalid)
		uploadData();

	context->setVertexBufferAt(index, m_activeBuffer, 44, VertexBufferFormat::FLOAT_2);
}
Beispiel #4
0
int main(int argc, char **argv)
{
char    *file = NULL;

    if(argc < 2){
        printUsage(argv[0]);
        return 1;
    }
    if(strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0){
        printUsage(argv[0]);
        return 1;
    }
    if(strcmp(argv[1], "-r") == 0){
        leaveBootLoader = 1;
        if(argc >= 3){
            file = argv[2];
        }
    }else{
        file = argv[1];
    }
//    startAddress = sizeof(dataBuffer);
//    endAddress = 0;
    if(file != NULL){   // an upload file was given, load the data
        memset(dataBuffer, -1, sizeof(dataBuffer));
        if(parseIntelHex(file, dataBuffer))
            return 1;
        if(startAddress[0] == endAddress[0]){
            fprintf(stderr, "No data in input file, exiting.\n");
            return 0;
        }
    }
#if 0
{

FILE    *output;
output  = fopen("uploaddata.bin", "w");
fwrite(dataBuffer, 1, sizeof(dataBuffer),output);
fclose(output);
return 0;
}
#endif
    // if no file was given, endAddress is less than startAddress and no data is uploaded


    if(uploadData(dataBuffer))
        return 1;
    return 0;
}
Beispiel #5
0
        bool Texture::upload(const void* data, const Size2& newSize)
        {
            OUZEL_UNUSED(data);

            if (!dynamic)
            {
                return false;
            }

            if (newSize.width <= 0.0f || newSize.height <= 0.0f)
            {
                return false;
            }

            return uploadData(data, newSize);
        }
Beispiel #6
0
void glInit2(GLsizei w, GLsizei h)
{
	width = w;
	height = h;
	glViewport(0, 0, w, h);
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
	glEnable(GL_DEPTH_TEST|GL_BLEND);
	glClearDepthf(1.0f);
	glDepthFunc(GL_LEQUAL);                 //Éî¶È²âÊÔ·½Ê½	

	initPerspetive();

	buildShader(&prog,VSRC_0,FSRC_0);
	uploadData();

	//fileTest();
}
Beispiel #7
0
        bool TextureD3D11::initFromBuffer(const std::vector<uint8_t>& newData, const Size2& newSize, bool newDynamic, bool newMipmaps)
        {
            free();

            std::lock_guard<std::mutex> lock(dataMutex);

            if (!Texture::initFromBuffer(newData, newSize, newDynamic, newMipmaps))
            {
                return false;
            }

            dirty = true;

            sharedEngine->getRenderer()->scheduleUpdate(shared_from_this());

            return uploadData(newData, newSize);
        }
Beispiel #8
0
Response S3RESTfulService::deleteRequest(const string &url, HTTPHeaders &headers) {
    Response response(RESPONSE_ERROR);

    headers.CreateList();
    CURLWrapper wrapper(url, headers.GetList(), this->lowSpeedLimit, this->lowSpeedTime,
                        this->debugCurl);
    CURL *curl = wrapper.curl;

    curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&response);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, RESTfulServiceAbortFuncCallback);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, this->verifyCert);
    curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");

    S3VectorUInt8 data;
    UploadData uploadData(data);
    curl_easy_setopt(curl, CURLOPT_READDATA, (void *)&uploadData);
    curl_easy_setopt(curl, CURLOPT_READFUNCTION, RESTfulServiceReadFuncCallback);
    curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)data.size());

    this->performCurl(curl, response);

    return response;
}
Beispiel #9
0
void BufferObject::uploadData(uint32_t bufferTarget, const std::vector<T> & data, uint32_t usageHint) {
	uploadData(bufferTarget, reinterpret_cast<const uint8_t*>(data.data()),static_cast<GLsizeiptr>(data.size() * sizeof(T)),usageHint);
}
Beispiel #10
0
void BufferObject::allocateData(uint32_t bufferTarget, std::size_t numberOfElements, uint32_t usageHint) {
	uploadData(bufferTarget, nullptr, static_cast<GLsizeiptr>(numberOfElements * sizeof(T)), usageHint);
}
AddRecording::AddRecording(int id,QString *filter,QWidget *parent)
  : QDialog(parent,"",true,Qt::WStyle_Customize|Qt::WStyle_DialogBorder)
{
  setCaption("");

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  //
  // Generate Fonts
  //
  QFont button_font=QFont("Helvetica",12,QFont::Bold);
  button_font.setPixelSize(12);
  QFont label_font=QFont("Helvetica",12,QFont::Bold);
  label_font.setPixelSize(12);
  QFont day_font=QFont("Helvetica",12,QFont::Normal);
  day_font.setPixelSize(12);

  add_id=id;
  add_filter=filter;

  //
  // Title Label
  //
  QLabel *label=new QLabel(tr("Schedule a:"),this,"title_label");
  label->setGeometry(0,0,sizeHint().width(),30);
  label->setFont(label_font);
  label->setAlignment(AlignCenter);

  //
  //  Recording Button
  //
  QPushButton *button=new QPushButton(this,"recording_button");
  button->setGeometry(10,30,sizeHint().width()-20,50);
  button->setFont(button_font);
  button->setText(tr("&Recording"));
  button->setDisabled(true);
  QString sql=QString("select CHANNEL from DECKS \
                       where (CARD_NUMBER>=0)&&(CHANNEL>0)&&(CHANNEL<=9)");
  RDSqlQuery *q=new RDSqlQuery(sql);
  if(q->first()) {
    button->setEnabled(true);
  }
  delete q;
  connect(button,SIGNAL(clicked()),this,SLOT(recordingData()));

  //
  //  Playout Button
  //
  button=new QPushButton(this,"playout_button");
  button->setGeometry(10,80,sizeHint().width()-20,50);
  button->setFont(button_font);
  button->setText(tr("&Playout"));
  button->setDisabled(true);
  sql=QString("select CHANNEL from DECKS where (CARD_NUMBER>=0)&&")+
    "(PORT_NUMBER>=0)&&(CHANNEL>128)&&(CHANNEL<=137)";
  q=new RDSqlQuery(sql);
  if(q->first()) {
    button->setEnabled(true);
  }
  delete q;
  connect(button,SIGNAL(clicked()),this,SLOT(playoutData()));

  //
  //  Download Event Button
  //
  button=new QPushButton(this,"download_button");
  button->setGeometry(10,130,sizeHint().width()-20,50);
  button->setFont(button_font);
  button->setText(tr("&Download"));
  connect(button,SIGNAL(clicked()),this,SLOT(downloadData()));

  //
  //  Upload Event Button
  //
  button=new QPushButton(this,"upload_button");
  button->setGeometry(10,180,sizeHint().width()-20,50);
  button->setFont(button_font);
  button->setText(tr("&Upload"));
  connect(button,SIGNAL(clicked()),this,SLOT(uploadData()));

  //
  //  Macro Event Cart Button
  //
  button=new QPushButton(this,"macro_button");
  button->setGeometry(10,230,sizeHint().width()-20,50);
  button->setFont(button_font);
  button->setText(tr("&Macro Cart"));
  connect(button,SIGNAL(clicked()),this,SLOT(macroData()));

  //
  //  Switch Event Cart Button
  //
  button=new QPushButton(this,"switch_button");
  button->setGeometry(10,280,sizeHint().width()-20,50);
  button->setFont(button_font);
  button->setText(tr("&Switch Event"));
  connect(button,SIGNAL(clicked()),this,SLOT(switchData()));

  //
  //  Cancel Button
  //
  button=new QPushButton(this,"cancel_button");
  button->setGeometry(10,350,sizeHint().width()-20,50);
  button->setFont(button_font);
  button->setText(tr("&Cancel"));
  button->setDefault(true);
  connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));
}