Exemplo n.º 1
0
// Retrieve calibration data from device:
char BMP280::readCalibration() {
	
	if (    
		readUInt(0x88, dig_T1) &&
		readInt(0x8A, dig_T2)  &&
		readInt(0x8C, dig_T3)  &&
		readUInt(0x8E, dig_P1) &&
		readInt(0x90, dig_P2)  &&
		readInt(0x92, dig_P3)  &&
		readInt(0x94, dig_P4)  &&
		readInt(0x96, dig_P5)  &&
		readInt(0x98, dig_P6)  &&
		readInt(0x9A, dig_P7)  &&
		readInt(0x9C, dig_P8)  &&
		readInt(0x9E, dig_P9)){
#ifdef _debugSerial
		Serial.print("dig_T1="); Serial.println(dig_T1,2);
		Serial.print("dig_T2="); Serial.println(dig_T2,2);
		Serial.print("dig_T3="); Serial.println(dig_T3,2);
		Serial.print("dig_P1="); Serial.println(dig_P1,2);
		Serial.print("dig_P2="); Serial.println(dig_P2,2);
		Serial.print("dig_P3="); Serial.println(dig_P3,2);
		Serial.print("dig_P4="); Serial.println(dig_P4,2);
		Serial.print("dig_P5="); Serial.println(dig_P5,2);
		Serial.print("dig_P6="); Serial.println(dig_P6,2);
		Serial.print("dig_P7="); Serial.println(dig_P7,2);
		Serial.print("dig_P8="); Serial.println(dig_P8,2);
		Serial.print("dig_P9="); Serial.println(dig_P9,2);
#endif
#ifdef _debugTestData
		dig_T1 = 27504.0;
		dig_T2 = 26435.0;
		dig_T3 = -1000.0;
		dig_P1 = 36477.0;
		dig_P2 = -10685.0;
		dig_P3 = 3024.0;
		dig_P4 = 2855.0;
		dig_P5 = 140.0;
		dig_P6 = -7.0;
		dig_P7 = 15500.0;
		dig_P8 = -14600.0;
		dig_P9 = 6000.0;
		Serial.print("dig_T1="); Serial.println(dig_T1,2);
		Serial.print("dig_T2="); Serial.println(dig_T2,2);
		Serial.print("dig_T3="); Serial.println(dig_T3,2);
		Serial.print("dig_P1="); Serial.println(dig_P1,2);
		Serial.print("dig_P2="); Serial.println(dig_P2,2);
		Serial.print("dig_P3="); Serial.println(dig_P3,2);
		Serial.print("dig_P4="); Serial.println(dig_P4,2);
		Serial.print("dig_P5="); Serial.println(dig_P5,2);
		Serial.print("dig_P6="); Serial.println(dig_P6,2);
		Serial.print("dig_P7="); Serial.println(dig_P7,2);
		Serial.print("dig_P8="); Serial.println(dig_P8,2);
		Serial.print("dig_P9="); Serial.println(dig_P9,2);
#endif
		return (1);
	}
	else 
		return (0);
}
Exemplo n.º 2
0
int main() {
  std::string solution[100], team[100];
  for(int cas = 1;; ++cas) {
    unsigned int n = readUInt();
    if(n == 0)
      return 0;
    std::stack<char> solutionStack, teamStack;
    for(unsigned int i = 0; i < n; ++i)
      solution[i] = readLine(solutionStack);
    unsigned int m = readUInt();
    for(unsigned int i = 0; i < m; ++i)
      team[i] = readLine(teamStack);
    
    std::cout << "Run #" << cas << ": ";
    if(accept(solution, n, team, m)) {
      std::cout << "Accepted" << std::endl;
    }
    else if(pe(solutionStack, teamStack)) {
      std::cout << "Presentation Error" << std::endl;
    }
    else {
      std::cout << "Wrong Answer" << std::endl;
    }
  }
}
Exemplo n.º 3
0
uint32 copyMem(volatile uint32 *src, volatile uint32 *target, uint32 len){
	uint32 *STORE2 = (uint32 *)0x40900030;
	
	uint32 i,j;
	uint32 checkSum = 0;
	j=0;

	setLEDs(GREEN);
	for(i=0;i<len;i+=4){
		*STORE2 = i;	//store how far got if it dies

		*target = *src;
		if( *target != *src ){
			error(7, 0);
			readUInt(i);
			readUInt(*target);
			readUInt(*src);
		}		
		src++;
		checkSum += *target++;

		j++;
		if(j==20000)
			setLEDs(BLUE);
		else if(j >= 40000){
			setLEDs(GREEN);
			j=0;
		}
	}
	
	return checkSum;
}
Exemplo n.º 4
0
boolean SFE_TSL2561::getData(unsigned int &data0, unsigned int &data1)
// Retrieve raw integration results
// data0 and data1 will be set to integration results
// Returns true (1) if successful, false (0) if there was an I2C error
// (Also see getError() below)
{
    // Get data0 and data1 out of result registers
    if (readUInt(TSL2561_REG_DATA_0,data0) && readUInt(TSL2561_REG_DATA_1,data1))
        return(true);

    return(false);
}
Exemplo n.º 5
0
bool BMP180::calibrate() {
    // start the I2C interface if we haven't already
    if (! _hasStartedWire) {
        if (trace) Serial.println("BMP180: starting Wire");
        Wire.begin();
        _hasStartedWire = true;
    }
    // exit if we've already calibrated
    if (_hasCalibrated) return(true);
    if (trace) Serial.print("BMP180: calibrating...");
    lastError = 0;
    int16_t AC1, AC2, AC3, VB1, VB2, MC, MD;
    uint16_t AC4, AC5, AC6;
    // read calibration registers
    AC1 = readInt(0xAA);
    AC2 = readInt(0xAC);
    AC3 = readInt(0xAE);
    AC4 = readUInt(0xB0);
    AC5 = readUInt(0xB2);
    AC6 = readUInt(0xB4);
    VB1 = readInt(0xB6);
    VB2 = readInt(0xB8);
    MC = readInt(0xBC);
    MD = readInt(0xBE);
    // make sure we got good data
    if (lastError != 0) {
        if (trace) {
            Serial.print("ERROR ");
            Serial.println(lastError);
        }
        return(false);
    }
    // precompute calibration parameters
    double c3 = 160.0 * pow(2, -15) * AC3;
    double c4 = pow(10, -3) * pow(2, -15) * AC4;
    double b1 = pow(160, 2) * pow(2, -30) * VB1;
    _c5 = (pow(2, -15) / 160) * AC5;
    _c6 = AC6;
    _mc = (pow(2, 11) / pow(160, 2)) * MC;
    _md = MD / 160.0;
    _x0 = AC1;
    _x1 = 160.0 * pow(2, -13) * AC2;
    _x2 = pow(160, 2) * pow(2, -25) * VB2;
    _y0 = c4 * pow(2, 15);
    _y1 = c4 * c3;
    _y2 = c4 * b1;
    _p0 = (3791.0 - 8.0) / 1600.0;
    _p1 = 1.0 - 7357.0 * pow(2, -20);
    _p2 = 3038.0 * 100.0 * pow(2, -36);
    _hasCalibrated = true;
    if (trace) Serial.println("DONE");
    return(true);
}
Exemplo n.º 6
0
static TACommandVerdict crc32_cmd(TAThread thread,TAInputStream stream)
{
    uLong crc, res;
    uInt len;
    Bytef* buf;

    // Prepare
    crc = readULong(&stream);
    buf = readPointer(&stream);
    len = readUInt(&stream);

    START_TARGET_OPERATION(thread);

    res = crc32(crc, buf, len);

    END_TARGET_OPERATION(thread);

    if(buf==0)
        ta_debug_printf("res==%u\n", res);

    // Response
    writeULong(thread, res);

    sendResponse(thread);

    return taDefaultVerdict;
}
Exemplo n.º 7
0
static TACommandVerdict adler32_cmd(TAThread thread,TAInputStream stream)
{
    char* buf;
    uLong adler, res;
    uInt len;
    size_t size;
    int bufIsNull;

    // Prepare
    adler = readULong(&stream);
    readByteArray(&stream, &buf, &size);
    len = readUInt(&stream);
    bufIsNull = readInt(&stream);

    START_TARGET_OPERATION(thread);

    if(!bufIsNull)
        res = adler32(adler, (Bytef*)buf, len);
    else
        res = adler32(adler, Z_NULL, len);

    END_TARGET_OPERATION(thread);

    // Response
    writeULong(thread, res);
    sendResponse(thread);

    return taDefaultVerdict;
}
Exemplo n.º 8
0
WalkingEngineKick::Value* WalkingEngineKick::readValue(char*& buf)
{
  while(*buf == ' ' || *buf == '\t')
    ++buf;
  switch(*buf)
  {
  case '(':
  {
    ++buf;
    Value* result = readPlusFormula(buf);
    while(*buf == ' ' || *buf == '\t')
      ++buf;
    if(*buf != ')')
      throw ParseException("expected ')'");
    ++buf;
    return result;
  }
  case '$':
  {
    ++buf;
    unsigned int i = readUInt(buf);
    return new ParameterValue(i, *this);
  }
  default:
  {
    float f = readFloat(buf);
    return new ConstantValue(f, *this);
  }
  }
}
Exemplo n.º 9
0
static TACommandVerdict gzread_cmd(TAThread thread,TAInputStream stream)
{
    void* file, *buf;
    unsigned int len;
    int errnum, res;

    file = readPointer(&stream);
    buf = readPointer(&stream);
    len = readUInt(&stream);

    START_TARGET_OPERATION(thread);

    errno = 0;
    res = gzread(file, buf, len);

    END_TARGET_OPERATION(thread);

    gzerror(file, &errnum);

    writeInt(thread, errnum);
    writeInt(thread, errno);
    writeInt(thread, res);

    sendResponse(thread);

    return taDefaultVerdict;
}
Exemplo n.º 10
0
void DataConverter::read(osg::FrameStamp& fs)
{
    fs.setFrameNumber(readUInt());
    fs.setReferenceTime(readDouble());

    osg::notify(osg::NOTICE)<<"readFramestamp = "<<fs.getFrameNumber()<<" "<<fs.getReferenceTime()<<std::endl;
}
Exemplo n.º 11
0
u32 NitroFile::getUintAt(int offs)
{
    if(cached)
        return *(u32*)(cachedContents+offs);
    fseek(parent->romFile, begOffs+offs, SEEK_SET);
    return readUInt(parent->romFile);
}
Exemplo n.º 12
0
void clientei_remove(MainTreePt clientes){
    unsigned int nif;
    ClientePt tmp=NULL;
    printf("NIF do cliente > ");
    while( isUInt(nif = readUInt()) == 0 )
        printf("Erro: NIF inválido.");
    
    tmp = cliente_novo( nif, NULL, NULL, NULL );

    tree_remove(clientes, tmp, 0);
    free(tmp);
    printf("Foi removido\n");
}
Exemplo n.º 13
0
        void read(CameraPacket& cameraPacket)
        {
            cameraPacket._byte_order = readUInt();
            if (cameraPacket._byte_order != SWAP_BYTES_COMPARE)
            {
                _swapBytes = !_swapBytes;
            }

            cameraPacket._masterKilled = readUInt()!=0;

            read(cameraPacket._matrix);
            read(cameraPacket._frameStamp);

            cameraPacket._events.clear();
            unsigned int numEvents = readUInt();
            for(unsigned int i=0;i<numEvents;++i)
            {
                osgGA::GUIEventAdapter* event = new osgGA::GUIEventAdapter;
                read(*(event));
                cameraPacket._events.push_back(event);
            }
        }
Exemplo n.º 14
0
/* $(uintlist) */
int readUintList( TAInputStream * stream, unsigned int ** list_ptr ) {
    int size, i;
    verifyType_TAInputStream( stream, "uintlist" );
    size = readInt( stream );
    if ( size == -1 ) {
        * list_ptr = NULL;
    } else if ( size >= 0 ) {
        * list_ptr = (unsigned int *)ta_alloc_memory( size * sizeof( unsigned int ) );
        assertion( * list_ptr != NULL, "Can't alloc %d bytes for list", size * sizeof( unsigned int ) );
        for ( i = 0; i < size; i++ ) { (* list_ptr)[ i ] = readUInt( stream ); }
    }
    return size;
}
Exemplo n.º 15
0
void readParameters(unsigned int &size, unsigned int &p1, unsigned int &p2)
{    
    // first ask user to enter board size
    const char *sizePrompt = "Please enter the board size (3-15): ";
    size = readUInt(sizePrompt, HEXMINSIZE, HEXMAXSIZE);
    
    // ask player 1 to choose color
    unsigned int options[] = {1, 2, 3};
    p1 = readPlayerColor(1, options);
    
    options[0] = ((p1 == 1) ? 0 : 1);      // if player 1 selected 1 (blue), it is no longer available for player 2
    options[1] = ((p1 == 2) ? 0 : 2);      // if player 2 selected 2 (red), it is no longer available for player 2
    p2 = readPlayerColor(2, options);    
}
Exemplo n.º 16
0
DataInputStream::DataInputStream(std::istream* istream)
{

    unsigned int endianType ;

    _verboseOutput = false;

    _istream = istream;
    _peeking = false;
    _peekValue = 0;
    _byteswap = 0;

    if(!istream){
        throw Exception("DataInputStream::DataInputStream(): null pointer exception in argument.");
    }

    endianType = readUInt() ;

    if ( endianType != ENDIAN_TYPE) {
      // Make sure the file is simply swapped
      if ( endianType != OPPOSITE_ENDIAN_TYPE ) {
         throw Exception("DataInputStream::DataInputStream(): This file has an unreadable endian type.") ;
      }
      osg::notify(osg::INFO)<<"DataInputStream::DataInputStream: Reading a byteswapped file" << std::endl ;
      _byteswap = 1 ;
   }

    _version = readUInt();

    // Are we trying to open a binary .ive file which version are newer than this library.
    if(_version>VERSION){
        throw Exception("DataInputStream::DataInputStream(): The version found in the file is newer than this library can handle.");
    }

	m_scenery = Scenery::getInstance();

}
Exemplo n.º 17
0
/***
* Function: readRelHumidity(void)
* Description: Read relative humidity
* Params: none
* Returns: Relative humidity value
***/
float Si7020::readRelHumidity(void)
{
	byte result = 0;
	
	// Measure the relative humidity 
	result = readUInt(SI7020_CMD_MEASURE_RH_HOLD, &_rawRelativeHumidity);
	
	if (result == 0)
	{
		_rawRelativeHumidity &= 0xFFFC; // Measured value is always 0bxxxxxxxxxxxxxx10
		return (125.0 * _rawRelativeHumidity / 65536) - 6;
	}

	return 0;
}
Exemplo n.º 18
0
/***
* Function: readTemperaturePostHumidity(void)
* Description: Read temperature from the previous humidity measurement
* Params: none
* Returns: Temperature value
***/
float Si7020::readTemperaturePostHumidity(void)
{
	byte result = 0;
	
	// Measure the temperature from the previous humitidy measurement
	result = readUInt(SI7020_CMD_MEASURE_TEMP_PREV_RH, &_rawTemperaturePostHumidity);
	
	if (result == 0)
	{
		_rawTemperaturePostHumidity &= 0xFFFC; // Measured value is always 0bxxxxxxxxxxxxxx10
		return (175.25 * _rawTemperaturePostHumidity / 65536) - 46.85;
	}
	
	return 0;
}
Exemplo n.º 19
0
void clientei_modifica(MainTreePt clientes){
    char *morada=NULL;
    unsigned int nif;

    printf("Introduza o nif do cliente > ");
    while( isUInt( nif = readUInt() ) == 0 )
        printf("Número inválido.");

    printf("Introduza a nova morada > ");
    lerStr( &morada );


    cliente_substituiPeloNif( clientes, nif, morada );
    printf("Modificado!\n");
}
Exemplo n.º 20
0
void InText::readInt(int& d, PhysicalInStream& stream)
{
  skipWhitespace(stream);
  int sign = 1;
  if(!isEof(stream) && theChar == '-')
  {
    sign = -1;
    nextChar(stream);
  }
  else if(!isEof(stream) && theChar == '+')
    nextChar(stream);
  unsigned u;
  readUInt(u, stream);
  d = sign * static_cast<int>(u);
}
Exemplo n.º 21
0
/***
* Function: readTemperature(void)
* Description: Read temperature in Celsius degrees
* Params: none
* Returns: Temperature value
***/
float Si7020::readTemperature(void)
{
	byte result = 0;
	
	// Measure the temeprature
	result = readUInt(SI7020_CMD_MEASURE_TEMP_HOLD, &_rawTemperature);
	
	if (result == 0)
	{
		_rawTemperature &= 0xFFFC; // Measured value is always 0bxxxxxxxxxxxxxx10
		return (175.25 * _rawTemperature / 65536) - 46.85;
	}
	
	return 0;
}
Exemplo n.º 22
0
int readZStream(TAInputStream* stream, z_stream* strm)
{
    char* isNull;

    verifyType_TAInputStream(stream,"z_stream");

    isNull = readString(stream);

    ta_debug_printf("isNull==%s\n", isNull);

    if(isNull[1]=='U')
        return 1;

    strm->adler = readULong(stream);
    strm->avail_in=readUInt(stream);
    strm->avail_out=readUInt(stream);
    strm->data_type=readInt(stream);
    strm->msg=readString(stream);
    strm->state=readPointer(stream);

    strm->zalloc=readPointer(stream);
    strm->zfree=readPointer(stream);

    strm->opaque=readPointer(stream);

    strm->next_in=readPointer(stream);
    strm->next_out=readPointer(stream);

    strm->reserved = readULong(stream);
    strm->total_in = readULong(stream);
    strm->total_out = readULong(stream);

    ta_debug_printf("read: returning 0(not is null)...\n");

    return 0;
}
Exemplo n.º 23
0
void loop()
{
  boolean light_led = false;

  if (readUInt(true) == 271) // Check to see if we got the 71 test number
  {
    light_led = true;
  }
  
  if (light_led)
  {
    digitalWrite(LED_PIN, HIGH);
    delay(1000);
    digitalWrite(LED_PIN, LOW);
  }
}
Exemplo n.º 24
0
void clientei_insere(MainTreePt clientes){
    unsigned int nif;
    char *nome=NULL, *morada=NULL;

    printf("NIF > ");
    while( isUInt(nif = readUInt()) == 0 )
        printf("Erro: Valor inválido (veja as instruções acima)"); //erro

    printf("Nome > ");
    lerStr( &nome);
    
    printf("Morada > ");
    lerStr( &morada );

        if( tree_insert( clientes, cliente_novo(nif, nome, morada, criaListaLigada( cliente_comparaServico )) ) == 1 )
            printf("Dados introduzidos com sucesso!");
        else
            printf("Já existe um Cliente com esse NIF ou Nome");
}
Exemplo n.º 25
0
static TACommandVerdict deflateSetDictionary_cmd(TAThread thread,TAInputStream stream)
{
    z_stream strm;
    int res, is_null;
    Bytef * dictionary;
    uInt dictlen;

    is_null = readZStream(&stream, &strm);
    dictionary = (Bytef*) readPointer(&stream);
    dictlen = readUInt(&stream);

    /*ta_debug_printf( "next_in==%d\navail_in==%u\ntotal_in==%lu\nnext_out==%d\n"
            "avail_out==%u\ntotal_out==%lu\n",
            strm.next_in, strm.avail_in, strm.total_in, strm.next_out,
            strm.avail_out,strm.total_out);

    ta_debug_printf( "msg==%s\nstate==%d\nzalloc==%d\nzfree==%d\n"
            "opaque==%d\ndata_type==%d\nadler==%lu\nreserved==%lu\n",
            strm.msg, strm.state,
            strm.zalloc, strm.zfree, strm.opaque, strm.data_type, strm.adler,
            strm.reserved);*/

    START_TARGET_OPERATION(thread);

    if(!is_null)
        res = deflateSetDictionary(&strm, dictionary, dictlen);
    else
        res = deflateSetDictionary(0, dictionary, dictlen);

    END_TARGET_OPERATION(thread);

    // Response
    if(!is_null)
        writeZStream(thread, &strm);
    else
        writeZStream(thread, 0);

    writeInt(thread, res);

    sendResponse(thread);

    return taDefaultVerdict;
}
Exemplo n.º 26
0
int main()
{
  int todo = readUInt();
  int bufLen = 10 * todo;
  char *inoutBuf = (char *)malloc(bufLen);
  char *p_in = inoutBuf;
  char *p_out= inoutBuf;
  int n, i;
  char reverse[10];
  
  fread(inoutBuf, 1, bufLen, stdin);
  
  while (todo--)
    {
      // read n
      n = (*p_in) - '0';
      while (*(++p_in) != '\n')
	{
	  n = 10*n + (*p_in - '0');
	}
      p_in++;
      // compute n = z(n)
      n = z2(n);
      // write n
      i = 0;
      do 
	{
	  reverse[i++] = n%10;
	  n = n/10;
	} while (n>0);
      
      while (--i>=0)
	{
	  *(p_out++) = '0' + reverse[i];
	}
      *(p_out++) = '\n';
    }
  fwrite(inoutBuf, 1, p_out-inoutBuf, stdout);
  free(inoutBuf);
  
  return 0;
}
Exemplo n.º 27
0
void BMP180::updateTemperature() {
    lastError = 0;
    if (! _temperatureRequested) {
        if (trace) Serial.print("BMP180: requesting temperature...");
        Wire.beginTransmission(I2C_ADDR);
        Wire.write(0xF4);
        Wire.write(0x2E);
        lastError = Wire.endTransmission();
        if (lastError != 0) {
            if (trace) {
                Serial.print("ERROR ");
                Serial.println(lastError);
            }
            return;
        }
        _sinceLastTemperatureRequest = 0;
        _temperatureRequested = true;
        if (trace) Serial.println("DONE, waiting 5ms");
        return;
    }
    if (_sinceLastTemperatureRequest >= 5) {
        if (trace) Serial.print("BMP180: reading temperature...");
        _temperatureRequested = false;
        double ut = (double)readUInt(0xF6);
        if (lastError != 0) {
            Serial.print("ERROR ");
            Serial.println(lastError);
            return;
        }
        double a = _c5 * (ut - _c6);
        _temperature = a + (_mc / (a + _md));
        _sinceLastTemperature = 0;
        if (trace) {
            Serial.print("DONE (");
            Serial.print(ut);
            Serial.print(" => ");
            Serial.print(_temperature);
            Serial.println(")");
        }
    }
}
Exemplo n.º 28
0
void insereServicoInput(TabelaHashPTR localidades, MainTreePt clientesPt, MainTreePt camioes)
{
    char *localidadeorigem, *localidadedestino, *inserir;
    int nif;CamiaoPt camiao;
    LocalidadePTR localidadeA, localidadeB;

    printf("\nIntroduza o NIF do Cliente > ");
    while( isUInt (nif=readUInt())==0);
    printf("Introduza a localidade de carregamento da carga > ");
    lerStr(&localidadeorigem);
    printf("Introduza a localidade de descarregamento da carga > ");
    lerStr(&localidadedestino);

    if(((localidadeA=(crialocalidade(localidadeorigem)))==NULL)||((localidadeB=(crialocalidade(localidadedestino)))==NULL))
    {
       errorMessage(ERROR_MEMALOC);
       freeLocalidade(localidadeA);freeLocalidade(localidadeB);
       return;
    }
    if((procuraTabelaHash(localidades, localidadeA)==NULL)||(procuraTabelaHash(localidades, localidadeB)==NULL))
    {
    freeLocalidade(localidadeA);freeLocalidade(localidadeB);
       errorMessage(ERROR_LOCNOTEXIST);
       return;
    }
    if ((camiao= (CamiaoPt)camiaoMaisBarato(camioes, localidadeorigem ))==NULL) {errorMessage(ERROR_NOCAMLOC); return;}
    double custo = costCheapestPath(localidades, localidadeorigem, localidadedestino, 1);
    if (custo==-1) {errorMessage(ERROR_NOPATH);return;}
    printf("\nCusto transporte: %.2f€\nPretende registar o seviços? (sim ou [NAO]) > ", custo);
    lerStr(&inserir);
    if((strcmp(inserir,"SIM")==0)||(strcmp(inserir,"Sim")==0)||(strcmp(inserir,"sim")==0)) {
    switch(cliente_insereServico(clientesPt, nif, camiao->matricula, custo, 0, localidadeorigem,"", localidadedestino)){
        case -2: errorMessage(ERROR_MEMALOC); break;
        case 0:  errorMessage(ERROR_MEMALOC);break; 
        case -1:  errorMessage(ERROR_MEMALOC);break;
        case 1: errorMessage(ERROR_SUCCESS);
    }} 
    else errorMessage(ERROR_CANCEL);
    freeLocalidade(localidadeA);freeLocalidade(localidadeB);
}
Exemplo n.º 29
0
static TACommandVerdict if_indextoname_cmd(TAThread thread,TAInputStream stream)
{
    unsigned int ifindex;
    char * ptr;
    char * res;
    
    ifindex = readUInt(&stream);
    ptr = readPointer(&stream);
    errno = readInt(&stream);
    
    START_TARGET_OPERATION(thread);
    
    res = if_indextoname(ifindex, ptr);
    
    END_TARGET_OPERATION(thread);
    
    writePointer(thread, res);
    writeInt(thread, errno);
    sendResponse(thread);
    
    return taDefaultVerdict;
}
Exemplo n.º 30
0
 void read(osgGA::GUIEventAdapter& event)
 {
     event.setEventType((osgGA::GUIEventAdapter::EventType)readUInt());
     event.setKey(readUInt());
     event.setButton(readUInt());
     int x = readInt();
     int y = readInt();
     int width = readUInt();
     int height = readUInt();
     event.setWindowRectangle(x,y,width,height);
     float xmin = readFloat();
     float ymin = readFloat();
     float xmax = readFloat();
     float ymax = readFloat();
     event.setInputRange(xmin,ymin,xmax,ymax);
     event.setX(readFloat());
     event.setY(readFloat());
     event.setButtonMask(readUInt());
     event.setModKeyMask(readUInt());
     event.setTime(readDouble());
 }