예제 #1
0
int openCommon(openni::Device& device, DeviceConfig config)
{
    g_pPlaybackControl = g_device.getPlaybackControl();

    int ret;

    ret = openStream(device, "depth", openni::SENSOR_DEPTH, config.openDepth, g_depthStream, &g_depthSensorInfo, &g_bIsDepthOn);
    if (ret != 0)
    {
        return ret;
    }

    ret = openStream(device, "color", openni::SENSOR_COLOR, config.openColor, g_colorStream, &g_colorSensorInfo, &g_bIsColorOn);
    if (ret != 0)
    {
        return ret;
    }

    ret = openStream(device, "IR", openni::SENSOR_IR, config.openIR, g_irStream, &g_irSensorInfo, &g_bIsIROn);
    if (ret != 0)
    {
        return ret;
    }

    initConstants();

    readFrame();

    return 0;
}
예제 #2
0
int XMPPClient::stateAction() {
 
  // Serial.print("State = ");
  // Serial.println(state);

  switch(state) {
    case INIT:
      openStream(server);
      break;
    case AUTH:
      authenticate(username, password);
      break;
    case AUTH_STREAM:
      openStream(server);
      break;
    case BIND:
      bindResource(resource);
      break;
    case SESS:
      openSession(server);
      break;
    case READY:
      return 1;
      break;
    case WAIT:
      break;
    default:
      return -1;
      break;
  }
  return 0;
}
예제 #3
0
/*
 * For client: connect to the shared memory.  Open incoming and
 * outgoing streams.
 */
static jint
openConnection(SharedMemoryTransport *transport, jlong otherPID, 
               SharedMemoryConnection **connectionPtr)
{
    jint error;

    SharedMemoryConnection *connection = allocConnection();
    if (connection == NULL) {
        return SYS_NOMEM;
    }

    sprintf(connection->name, "%s.%ld", transport->name, sysProcessGetID());
    error = sysSharedMemOpen(connection->name, &connection->sharedMemory,
                             &connection->shared);
    if (error != SYS_OK) {
        closeConnection(connection);
        return error;
    }

    /* This process is the client */
    connection->incoming.shared = &connection->shared->toClient;
    connection->outgoing.shared = &connection->shared->toServer;

    error = openStream(&connection->incoming);
    if (error != SYS_OK) {
        closeConnection(connection);
        return error;
    }

    error = openStream(&connection->outgoing);
    if (error != SYS_OK) {
        closeConnection(connection);
        return error;
    }

    error = sysProcessOpen(otherPID, &connection->otherProcess);
    if (error != SYS_OK) {
        fprintf(stderr,"Error accessing process, rc = %d\n", error);
        closeConnection(connection);
        return error;
    }

    /*
     * Create an event that signals that the connection is shutting 
     * down. The event is unnamed as it's process local, and is 
     * manually reset (so that signalling the event will signal
     * all threads waiting on it).
     */
    error = sysEventCreate(NULL, &connection->shutdown, JNI_TRUE); 
    if (error != SYS_OK) {
        fprintf(stderr,"Error creating unnamed event, rc = %d\n", error);
	closeConnection(connection);
	return error;
    }

    *connectionPtr = connection;
    return SYS_OK;
}
bool AlsaCtlPortConfig::sendToHW(string &error)
{
    PortConfig portConfig;
    blackboardRead(&portConfig, sizeof(portConfig));

    // If device update is needed, close all the stream
    if (isDeviceUpdateNeeded(portConfig)) {

        // Close playback and capture
        closeStream(Playback);
        closeStream(Capture);

        // Save new configuration
        _portConfig.channelNumber = portConfig.channelNumber;
        _portConfig.format = portConfig.format;
        _portConfig.sampleRate = portConfig.sampleRate;

    } else {

        // Close playback/capture streams if asked for
        if (!portConfig.isStreamEnabled[Playback]) {

            closeStream(Playback);
        }
        if (!portConfig.isStreamEnabled[Capture]) {

            closeStream(Capture);
        }
    }

    // Open and configure required streams
    if (portConfig.isStreamEnabled[Playback]) {

        if (!openStream(Playback, error)) {

            return false;
        }
    }
    if (portConfig.isStreamEnabled[Capture]) {

        if (!openStream(Capture, error)) {

            return false;
        }
    }

    // Check port configuration has been considered
    assert(!memcmp(&_portConfig, &portConfig, sizeof(_portConfig)));

    return true;
}
예제 #5
0
파일: player.c 프로젝트: gnowxilef/pianobar
/*	player thread; for every song a new thread is started
 *	@param audioPlayer structure
 *	@return PLAYER_RET_*
 */
void *BarPlayerThread (void *data) {
	assert (data != NULL);

	player_t * const player = data;
	uintptr_t pret = PLAYER_RET_OK;

	bool retry;
	do {
		retry = false;
		if (openStream (player)) {
			if (openFilter (player) && openDevice (player)) {
				player->mode = PLAYER_PLAYING;
				BarPlayerSetVolume (player);
				retry = play (player) == AVERROR_INVALIDDATA &&
						!player->interrupted;
			} else {
				/* filter missing or audio device busy */
				pret = PLAYER_RET_HARDFAIL;
			}
		} else {
			/* stream not found */
			pret = PLAYER_RET_SOFTFAIL;
		}
		player->mode = PLAYER_WAITING;
		finish (player);
	} while (retry);

	player->mode = PLAYER_FINISHED;

	return (void *) pret;
}
예제 #6
0
ChEXPORT SsrwOOStream* SsrwOOStorage::openStream(const ChCHAR1* in_name)
{
    ChLOG_DEBUG_START_FN;
    for (size_t i = 0; i <= ChStrlen(in_name); i++)
        m_pBuffer[i] = in_name[i];
    return openStream(m_pBuffer);
}
void plotly::reconnectStream(){
    while(!client.connected()){
        if(log_level<4) Serial.println(F("... Disconnected from streaming servers"));
        closeStream();
        openStream();
    }
}
예제 #8
0
int MPlayerProcess::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QProcess::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: mediaPosition((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: volumeChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: durationChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: volumeLevelChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 4: fileNameChanged((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 5: paused(); break;
        case 6: sizeChanged(); break;
        case 7: openStream((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 8: togglePlayPause(); break;
        case 9: setMediaPosition((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 10: setVolume((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 11: setLoop((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 12: setSpeed((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 13: setAudioDelay((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 14: readStandardOutput(); break;
        default: ;
        }
        _id -= 15;
    }
    return _id;
}
void SpecificWorker::initializeStreams()
{
	if (!openStream(SENSOR_DEPTH, &depth)) qFatal("OPEN DEPTH STREAM FAILED!");
	if (!openStream(SENSOR_COLOR, &color)) qFatal("OPEN COLOR STREAM FAILED!");

	IMAGE_WIDTH=depth.getVideoMode().getResolutionX();
	IMAGE_HEIGHT=depth.getVideoMode().getResolutionY();
	
	//RESIZE POINTMAP
	pointsMap.resize( IMAGE_WIDTH*IMAGE_HEIGHT);

	depthBuffer = new vector<float>(IMAGE_WIDTH*IMAGE_HEIGHT);
	colorBuffer = new vector<ColorRGB>(IMAGE_WIDTH*IMAGE_HEIGHT*3);
	depthImage = new vector<float>(IMAGE_WIDTH*IMAGE_HEIGHT);
	colorImage = new vector<Ice::Byte>(IMAGE_WIDTH*IMAGE_HEIGHT*3); //x3 para RGB888Pixel
}
void test_cftNew_should_create_cft_for_symbols_from_file(){
  Stream *in = NULL;
  CFT *cftPtr;
  int tableSize;
  CEXCEPTION_T error;
  
  Try{
  // Please check cftData.txt, inside has a lengthy string 
    in = openStream("cftData.txt","r");
    cftPtr = cftNew(in, &tableSize);
  }Catch(error){
    TEST_ASSERT_NOT_EQUAL(ERR_FILE_NOT_EXIST,error);
  }
  dumpCFT(cftPtr,0);
  dumpCFT(cftPtr,1);
  dumpCFT(cftPtr,2);
  
  TEST_ASSERT_EQUAL(3,tableSize);
  
  TEST_ASSERT_EQUAL('a', cftPtr[0].symbol);
  TEST_ASSERT_EQUAL(40, cftPtr[0].cum_Freq);
  TEST_ASSERT_EQUAL(40, cftPtr[0].occurNo);

  TEST_ASSERT_EQUAL('b', cftPtr[1].symbol);
  TEST_ASSERT_EQUAL(41, cftPtr[1].cum_Freq);
  TEST_ASSERT_EQUAL(1, cftPtr[1].occurNo);

  TEST_ASSERT_EQUAL('c', cftPtr[2].symbol);
  TEST_ASSERT_EQUAL(50, cftPtr[2].cum_Freq);
  TEST_ASSERT_EQUAL(9, cftPtr[2].occurNo);
  
  if(in != NULL){
    closeStream(in);
  }
}
예제 #11
0
파일: speech.c 프로젝트: junwuwei/brltty
static int
spk_construct (volatile SpeechSynthesizer *spk, char **parameters) {
  spk->setRate = spk_setRate;

  festivalParameters = parameters;
  festivalRate = 0.0;
  return openStream();
}
예제 #12
0
CiOSReadFileStream *
CiOSReadFileStream::openAssets(const char * path, const char * home)
{
    return openStream(path, home);
#if 0
    CiOSReadFileStream * pStream = 0;
    try {
        pStream = new CiOSReadFileStream();
        if(!pStream) {
            return 0;
        }
        pStream->m_fullpath = 0;

        CiOSPathConv& pathconv = CiOSPathConv::getInstance();
        pStream->m_fullpath = pathconv.fullpath(path);

        if(!pStream->m_fullpath) {
            // ファイルが見つからなかった
            pStream->m_eStat = NOT_FOUND;
            return pStream;
        }
        // 物理パスができたので、ファイルをオープンする。
        pStream->m_fd = open(pStream->m_fullpath, O_RDONLY);
        if(pStream->m_fd < 0) {
            // オープンに失敗
            pStream->m_eStat = NOT_FOUND;
#ifdef DEBUG_MEMORY
            CPFInterface& pfif = CPFInterface::getInstance();
            CiOSReadFileStream * p = ms_pBegin;
            while(p) {
                pfif.platform().logging("not closed stream: %s", p->m_fullpath);
                p = p->m_pNext;
            }
            pfif.platform().logging("errno = %d", errno);
#endif
            return pStream;
        }

        // fopen 系関数を使うために fdopen で m_fp も作っておく
        pStream->m_fp = fdopen(pStream->m_fd, "rb");
        if(!pStream->m_fp) {
            close(pStream->m_fd);
            pStream->m_fd = -1;
            pStream->m_eStat = NOT_FOUND;
            return pStream;
        }
        
        // オープンに成功したので正常終了ステータスにする。
        pStream->m_decrypter.decryptSetup((const u8*)pStream->m_fullpath);
        pStream->m_eStat = NORMAL;
        return pStream;
        
    } catch(std::bad_alloc& ex) {
        delete pStream;
        return 0;
    }
#endif
}
예제 #13
0
 void NodeDataInterface::streamToOutput(AbstractWriteFacet &write_to_storeentity) {
         static char readBuffer[4096];
         size_t bytesRead;
         openStream(); 
         while((bytesRead = streamRead(readBuffer, 4096)) > 0){
              write_to_storeentity(readBuffer, bytesRead);
         }
         closeStream();
 }
예제 #14
0
void PacketReceiver::init()
{
	initAVLibs();
	mainWindow->log("Oeffne Stream...", INFO);
	openStream();
	mainWindow->log("Stream goeffnet", INFO);
	createPictureConverter();
	createFrames();
}
예제 #15
0
 Config(ConfigData const &data)
         : m_data(data),
           m_stream(openStream()) {
     if (!data.testsOrTags.empty()) {
         TestSpecParser parser(ITagAliasRegistry::get());
         for (std::size_t i = 0; i < data.testsOrTags.size(); ++i)
             parser.parse(data.testsOrTags[i]);
         m_testSpec = parser.testSpec();
     }
 }
예제 #16
0
// open video file
void VideoFFmpeg::openFile (char *filename)
{
	if (openStream(filename, NULL, NULL) != 0)
		return;

	if (m_codecCtx->gop_size)
		m_preseek = (m_codecCtx->gop_size < 25) ? m_codecCtx->gop_size+1 : 25;
	else if (m_codecCtx->has_b_frames)
		m_preseek = 25;	// should determine gopsize
	else
		m_preseek = 0;

	// get video time range
	m_range[0] = 0.0;
	m_range[1] = (double)m_formatCtx->duration / AV_TIME_BASE;

	// open base class
	VideoBase::openFile(filename);

	if (
		// ffmpeg reports that http source are actually non stream
		// but it is really not desirable to seek on http file, so force streaming.
		// It would be good to find this information from the context but there are no simple indication
		!strncmp(filename, "http://", 7) ||
		!strncmp(filename, "rtsp://", 7) ||
		(m_formatCtx->pb && !m_formatCtx->pb->seekable)
		)
	{
		// the file is in fact a streaming source, treat as cam to prevent seeking
		m_isFile = false;
		// but it's not handled exactly like a camera.
		m_isStreaming = true;
		// for streaming it is important to do non blocking read
		m_formatCtx->flags |= AVFMT_FLAG_NONBLOCK;
	}

	if (m_isImage)
	{
		// the file is to be treated as an image, i.e. load the first frame only
		m_isFile = false;
		// in case of reload, the filename is taken from m_imageName, no need to change it
		if (m_imageName.Ptr() != filename)
			m_imageName = filename;
		m_preseek = 0;
		m_avail = false;
		play();
	}
	// check if we should do multi-threading?
	if (!m_isImage && BLI_system_thread_count() > 1)
	{
		// never thread image: there are no frame to read ahead
		// no need to thread if the system has a single core
		m_isThreaded =  true;
	}
}
예제 #17
0
void FileLogger::writeChannelData(QString datablock)
{
    if(!log) return;

    if(!instream)
    {   
      openStream();
    }
    if(instream)
      fprintf(instream, "%s", datablock.latin1());
}
void test_arithmeticEncoder_to_encode_acba_with_cftData_txt_should_generate_a_tag(){
  Stream *cft = NULL, *in = NULL, *out = NULL;
  CFT *cftPtr;
  int dataLength = 0, tableSize;
  CEXCEPTION_T error;
  
  Try{
  // Please check cftData.txt, inside has a lengthy string 
    cft = openStream("cftData.txt","r");
    cftPtr = cftNew(cft,&tableSize);
    TEST_ASSERT_EQUAL(3,tableSize);
  }Catch(error){
    TEST_ASSERT_NOT_EQUAL(ERR_FILE_NOT_EXIST,error);
  }
  
  Try{
  /* Please check encodeACBA.txt contain the encode data
   * tag.txt/.bin will store the tag generate from encode data
   * acba will encode into 1100 0101 0110 1101 0101 1100 1111 1001 1100 000
   *
   * Unfortunately, editor cannot show the actual result as it show chinese character
   * To see the final result, using a hex editor to open the tag file and compare with
   * print statement at streamFlush.
   */
    in = openStream("encodeACBA.txt","r");
    out = openStream("tag.bin","w");
    arithmeticEncode(in, &dataLength, cftPtr,tableSize,out);
  }Catch(error){
    TEST_ASSERT_NOT_EQUAL(ERR_FILE_NOT_EXIST,error);
  }
  TEST_ASSERT_EQUAL(4,dataLength);
  if(in != NULL){
    closeStream(in);
  }if(out != NULL){
    closeStream(out);
  }if(cft != NULL){
    closeStream(cft);
  }
}
예제 #19
0
int main(int argc, char *argv[])
{
	int fd, bytes_read;
	uint8_t packet_buffer[TS_PACKET_SIZE];
	int n_packets = 0;
	
	TSParser tsParser;
	memset(&tsParser, 0, sizeof(TSParser));
	
	fd = openStream(argv[1]);
	if(fd<0)
	{
		printf("Error opening the stream\nSyntax: tsunpacket FileToParse.ts\n");
		return -1;
	}
	
	while(1)
	{
		bytes_read = readData(fd, packet_buffer, TS_PACKET_SIZE);
			
		if(packet_buffer[0] == TS_DISCONTINUITY)
		{
			printf("Discontinuity detected!\n");
			signalDiscontinuity(&tsParser, 0);
		}
		else if(bytes_read < TS_PACKET_SIZE)
		{
			printf("End of file!\n");
			break;
		}
		else if(packet_buffer[0] == TS_SYNC)
		{
			ABitReader bitReader;
			initABitReader(&bitReader, packet_buffer, bytes_read);
			
			parseTSPacket(&tsParser, &bitReader);			
			
			n_packets++;
		}
		
		
	}
	
	printf("Number of packets: %d\n", n_packets);
	printf("Finishing application\n");
	close(fd);
	
	freeParserResources(&tsParser);
	
	return 0;
}
예제 #20
0
파일: speech.c 프로젝트: junwuwei/brltty
static int
writeString (const char *string, int reopen) {
  if (!festivalStream) {
    if (!reopen) return 0;
    if (!openStream()) return 0;
  }

  fputs(string, festivalStream);
  if (!ferror(festivalStream)) return 1;

  logSystemError("fputs");
  closeStream();
  return 0;
}
예제 #21
0
I8KView::I8KView(KSim::PluginObject *parent, const char *name)
   : KSim::PluginView(parent, name),
     m_timer( 0L ), m_procFile( 0L ), m_procStream( 0L )
{
  initGUI();

  m_timer = new QTimer( this );

  m_reData = new QRegExp( "\\S+\\s+\\S+\\s+\\S+\\s+(\\d+)\\s+\\S+"
        "\\s+\\S+\\s+(\\d+)\\s+(\\d+)\\s+\\S+\\s+\\S+" );

  openStream();
  reparseConfig();
}
예제 #22
0
void test_writeStuffedByte_given_0x0A_should_only_write_0x0A(void){
  CEXCEPTION_T error;
  Stream *fileStream = NULL;
  
  Try{
    fileStream = openStream("test/Data/StuffedByte_write", "wb");
  }Catch(error){
    TEST_ASSERT_EQUAL(ERR_END_OF_FILE, error);
  }
  
  writeStuffedByte(fileStream, 0x0A);
  
  closeStream(fileStream);
}
void test_arithmeticDecoder_to_decode_tag_with_cftData_txt_should_generate_acba(){
  Stream *cft = NULL, *in = NULL, *out = NULL;
  CFT *cftPtr;
  uint32 tag = 0;
  int tableSize, dataLength = 4;
  CEXCEPTION_T error;
  
  Try{
  // Please check cftData.txt, inside has a lengthy string 
    cft = openStream("cftData.txt","r");
    cftPtr = cftNew(cft,&tableSize);
    TEST_ASSERT_EQUAL(3,tableSize);
  }Catch(error){
    TEST_ASSERT_NOT_EQUAL(ERR_FILE_NOT_EXIST,error);
  }
  
  Try{
  /* 1100 0101 0110 1101 0101 1100 1111 1001 1100 000 will decode back into acba
   * tag.txt/.bin will store the tag generate from encode data
   * acba store into decodeSymbol.txt
   */
    in = openStream("tag.bin","r");
    out = openStream("decodedSymbol.txt","w");
    tagReader(in,&tag);
    arithmeticDecode(dataLength, &tag, cftPtr, tableSize, out, in);
  }Catch(error){
    TEST_ASSERT_NOT_EQUAL(ERR_FILE_NOT_EXIST,error);
  }
  
  if(in != NULL){
    closeStream(in);
  }if(out != NULL){
    closeStream(out);
  }if(cft != NULL){
    closeStream(cft);
  }
}
예제 #24
0
void TreeWidget::displayMenu(const QPoint &pos)
{
    QModelIndex current = view->currentIndex();
    if(current.isValid())
    {
        QMenu menu(this);

        QAction *copyAction = nullptr;
        if(!currentItem().clipboardValue().isNull()) {
            copyAction = menu.addAction("Copy Value");
        }

        QAction *followLinkAction = nullptr;
        if (currentItem().hasLinkTo()) {
            followLinkAction = menu.addAction("Follow link");
        }

        QAction *openStreamAction = nullptr, *dumpStreamAction = nullptr;
        if(currentItem().hasStream()) {
            openStreamAction = menu.addAction("Open Stream");
            dumpStreamAction = menu.addAction("Dump Stream");
        }

        QAction *dumpToFileAction = menu.addAction("Dump to File");

        QAction *closeFileAction = menu.addAction("Close File");

        QAction *trigeredAction = menu.exec(view->viewport()->mapToGlobal(pos));

        if (!trigeredAction) {
            return;
        }

        if (trigeredAction == copyAction) {
            copy();
        } else if (trigeredAction == followLinkAction) {
            emit positionChanged(currentItem().linkTo(), 1);
            //model->updateByFilePosition(currentItem().linkTo()/8);
        } else if (trigeredAction == openStreamAction) {
            openStream();
        } else if (trigeredAction == dumpStreamAction) {
            dumpStreamToFile();
        } else if (trigeredAction == closeFileAction) {
            closeFile();
        } else if (trigeredAction == dumpToFileAction) {
            dumpToFile();
        }
    }
}
예제 #25
0
void ResourceCompressor::compress(const std::string &outputFile, bool verbose)
{
    openStream(outputFile);
    
    int offset = writeHeader();
    for (Entries::iterator i = entries.begin(); i != entries.end(); i++) {
        Entry &e = *i;
        compressEntry(e, offset);
        if (verbose)
            showEntryStat(e);
    }
    writeFooter(offset);

    closeStream();
}
예제 #26
0
파일: resource.cpp 프로젝트: bSr43/scummvm
bool Archive::openFile(const Common::String &fileName) {
	Common::File *file = new Common::File();

	if (!file->open(fileName)) {
		delete file;
		return false;
	}

	if (!openStream(file)) {
		close();
		return false;
	}

	return true;
}
void test_tagReader_should_read_in_32bit_of_tag_value(){
  Stream *in = NULL;
  uint32 tag = 0;
  CEXCEPTION_T error;
  
  Try{
    in = openStream("tag.bin","r");
    tagReader(in,&tag);
  }Catch(error){
    TEST_ASSERT_NOT_EQUAL(ERR_FILE_NOT_EXIST,error);
  }
  TEST_ASSERT_EQUAL(0xC56D5CF9,tag);
  if(in != NULL){
    closeStream(in);
  }
}
예제 #28
0
void test_readStuffedByte_given_0xFF_and_0x00_should_only_read_0xFF(void){
  CEXCEPTION_T error;
  Stream *fileStream = NULL;
  unsigned char result[5];
  
  Try{
    fileStream = openStream("test/Data/StuffedByte_write2", "rb");
  }Catch(error){
    TEST_ASSERT_EQUAL(ERR_END_OF_FILE, error);
  }
  
  result[0] = readStuffedByte(fileStream);
  
  TEST_ASSERT_EQUAL(0xFF, result[0]);
  
  closeStream(fileStream);
}
예제 #29
0
void test_writeStuffedByte_given_few_bytes_should_stuff_0xFF_with_0x00(void){
  CEXCEPTION_T error;
  Stream *fileStream = NULL;
  
  Try{
    fileStream = openStream("test/Data/StuffedByte_write3", "wb");
  }Catch(error){
    TEST_ASSERT_EQUAL(ERR_END_OF_FILE, error);
  }
  
  writeStuffedByte(fileStream, 0x32);
  writeStuffedByte(fileStream, 0xAB);
  writeStuffedByte(fileStream, 0xFF);
  writeStuffedByte(fileStream, 0x5C);
  
  closeStream(fileStream);
}
예제 #30
0
void I8KView::updateView()
{
  kdDebug( 2003 ) << "i8k: Updating..." << endl;
  int cputemp=0, rightspeed=0, leftspeed=0;

  if ( m_procStream )
  {
    fseek( m_procFile, 0L, SEEK_SET );

    QString line = m_procStream->read();

    if ( line.isEmpty() )
    {
      // i8k module is no longer available, is it possible?
      closeStream();
      openStream();
      return;
    }

    if ( m_reData->search( line ) > -1 )
    {
      QStringList matches = m_reData->capturedTexts();

      cputemp = matches[ 1 ].toInt();
      leftspeed = matches[ 2 ].toInt();
      rightspeed = matches[ 3 ].toInt();

      if ( m_unit == "F" )
        cputemp = ( cputemp*9/5 ) + 32;
    }
  }

  if ( rightspeed > 0 )
    m_fan1Label->setText( i18n( "Right fan: %1 RPM" ).arg( rightspeed ) );
  else
    m_fan1Label->setText( i18n( "Right fan: Off" ) );

  if ( leftspeed > 0 )
    m_fan2Label->setText( i18n( "Left fan: %1 RPM" ).arg( leftspeed ) );
  else
    m_fan2Label->setText( i18n( "Left fan: Off" ) );

  m_tempLabel->setText( i18n( "CPU temp: %1°%2" ).arg( cputemp )
      .arg( m_unit ) );
}