当前位置: 首页>>代码示例>>C++>>正文


C++ closePort函数代码示例

本文整理汇总了C++中closePort函数的典型用法代码示例。如果您正苦于以下问题:C++ closePort函数的具体用法?C++ closePort怎么用?C++ closePort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了closePort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: printMessage

void doubleTouchThread::threadRelease()
{
    printMessage(0,"Returning to position mode..\n");
        if (!dontgoback)
        {
            steerArmsHome();
            imodeL -> setInteractionMode(2,VOCAB_IM_STIFF);
            imodeL -> setInteractionMode(3,VOCAB_IM_STIFF);
            imodeR -> setInteractionMode(2,VOCAB_IM_STIFF);
            imodeR -> setInteractionMode(3,VOCAB_IM_STIFF);
            steerArmsHome();
        }

        delete encsR; encsR = NULL;
        delete  armR;  armR = NULL;

        delete encsL; encsL = NULL;
        delete  armL;  armL = NULL;

    printMessage(0,"Closing ports..\n");
        closePort(skinPort);
        printMessage(1,"skin port successfully closed!\n");
        closePort(outPort);
        printMessage(1,"output port successfully closed!\n");

    printMessage(0,"Closing controllers..\n");
        ddR.close();
        ddL.close();

    printMessage(0,"Closing solver..\n");
        clearTask();
}
开发者ID:robotology,项目名称:peripersonal-space,代码行数:32,代码来源:iCubDblTchThrd.cpp

示例2: printMessage

void gazeEvaluatorThread::threadRelease()
{
    printMessage(0,"Closing ports...\n");
        closePort(inPort);
        closePort(outPort);
        closePort(imgPortOutMod);
        closePort(portOutModAvg);
}
开发者ID:alecive,项目名称:gaze-stabilization,代码行数:8,代码来源:gazeEvaluatorThread.cpp

示例3: memset

// tests the open joystick file descriptor to see if it's really a JW, and set to read rawdata
bool CSensorLinuxUSBJW::testJoystick()
{
   // if made it here, then we have opened a joystick file descriptor
   m_iNumAxes = 0;
   m_iNumButtons = 0;
   memset(m_strJoystick, 0x00, 80);

   ioctl(m_fdJoy, JSIOCGAXES, &m_iNumAxes);
   ioctl(m_fdJoy, JSIOCGBUTTONS, &m_iNumButtons);
   ioctl(m_fdJoy, JSIOCGNAME(80), m_strJoystick);

//fprintf(stdout, "joystick found = %s\n", m_strJoystick);
//fflush(stdout);

   // compare the name of device, and number of buttons & axes with valid JoyWarrior values
   if (strcmp(m_strJoystick, IDSTR_JW24F8)
     || m_iNumButtons != NUM_BUTTON_JW24F8
     || m_iNumAxes != NUM_AXES_JW24F8) {
         closePort();  // this far in, we need to close the port!
         return false;
   }

   m_piAxes = (int *) calloc( m_iNumAxes, sizeof( int ) );
   memset(m_piAxes, 0x00, sizeof(int) * m_iNumAxes);
   m_strButton = (char *) calloc( m_iNumButtons, sizeof( char ) );
   memset(m_strButton, 0x00, sizeof(char) * m_iNumButtons);
  
   fcntl( m_fdJoy, F_SETFL, O_NONBLOCK );   // use non-blocking mode

   // try a read
   float x,y,z;
   // "prime" the joystick reader
   if (! read_xyz(x,y,z)) {
      closePort();  // this far in, we need to close the port!
      return false;
   }

   // if made it here, then it's a joywarrior, set to raw data mode
   struct js_corr corr[NUM_AXES_JW24F8];

   // Zero correction coefficient structure and set all axes to Raw mode 
   for (int i=0; i<NUM_AXES_JW24F8; i++) {
     corr[i].type = JS_CORR_NONE;
     corr[i].prec = 0;
     for (int j=0; j<8; j++) {
        corr[i].coef[j] = 0;
     }
   }

   if (ioctl(m_fdJoy, JSIOCSCORR, &corr)) {
      fprintf(stderr, "CSensorLinuxUSBJW:: error setting correction for raw data reads\n");
   }

   setType(SENSOR_USB_JW24F8);
   setPort(getTypeEnum());
   
   return true; // if here we can return true, i.e Joywarrior found on Linux joystick port, and hopefully set to read raw data
}
开发者ID:carlgt1,项目名称:qcn,代码行数:59,代码来源:csensor_linux_usb_jw.cpp

示例4: openPort

bool SerialPort::verifyFreeEMS(QString portname)
{
	openPort(portname,115200,false);
	unsigned char ret = 0x0D;
	int writei =0;
#ifdef Q_OS_WIN32
	::WriteFile(m_portHandle, (void*)&ret, (DWORD)1, (LPDWORD)&writei, NULL);
#else
	writei = write(m_portHandle,&ret,1);
#endif
	if (writei <= 0)
	{
		qDebug() << "Error writing to verify FreeEMS";
		return false;
	}
	unsigned char buf[3];
#ifdef Q_OS_WIN32
	Sleep(100);
#else
	usleep(100000);
#endif
	//msleep(100);
	int count = 0;
#ifdef Q_OS_WIN32
	::ReadFile(m_portHandle,(LPVOID)buf,3,(LPDWORD)&count,NULL);
#else
	count = read(m_portHandle,buf,3);
#endif
	if (count > 0)
	{
		qDebug() << "Verify:" << QString::number(buf[0],16);
		qDebug() << "Verify:" << QString::number(buf[1],16);
		if (buf[0] == 0xE0 || buf[0] == 0xE1)
		{
			if (count > 1)
			{
				qDebug() << "Verify:" << QString::number(buf[2],16);
				if (buf[2] == 0x3E)
				{
					//Serial monitor running
					closePort();
					return false;
				}
				else
				{
					//Probably not;
					closePort();
					return true;
				}
			}
		}
	}
	//nothing on the port here either.
	closePort();
	return true;
}
开发者ID:BenFenner,项目名称:emstudio,代码行数:56,代码来源:serialport.cpp

示例5: printMessage

void imuIdentifierThread::threadRelease()
{
    printMessage(0,"Putting head in home position..\n");
        goHome();

    printMessage(0,"Closing controllers..\n");
        ddH.close();

    printMessage(0,"Closing ports...\n");
        closePort(inIMUPort);
        closePort(outPort);
}
开发者ID:alecive,项目名称:gaze-stabilization,代码行数:12,代码来源:imuIdentifierThread.cpp

示例6: main

int main(void) {
  CEXCEPTION_T err;
  Tlv_Session *session = NULL;
  User_Session *userSession = NULL;
  
  displayOptionMenu();
  
  Try {
    if(session == NULL) session = tlvCreateSession();
    while(!IS_HOST_EXIT(session)) {
      Try {
        tlvService(session);
        hostInterpreter(session);
        // 
        // Receive packet and handle it here
        //
      } Catch(err) {
        HOST_CHANGE_STATE(session, HOST_WAIT_USER_COMMAND);
        displayErrorMessage(err);
      }
    }
  } Catch(err) {
    displayErrorMessage(err);
  }
  
  printf("Closing port\n");
  closePort(session);

  return 0;
}
开发者ID:chaosAD,项目名称:SWD-for-ARM-Cortex-M4,代码行数:30,代码来源:main.c

示例7: closePort

 SerialPort::~SerialPort()
 {
     if(_port_is_open)
     {
         closePort();
     }
 }
开发者ID:Anuragch,项目名称:kraken_3.0,代码行数:7,代码来源:SerialPort.cpp

示例8: QWidget

QespTest::QespTest(QWidget *parent)
    : QWidget(parent)

{
    //modify the port settings on your own
#ifdef Q_OS_UNIX
    port = new QextSerialPort(QLatin1String("/dev/ttyS0"), QextSerialPort::Polling);
#else
    port = new QextSerialPort(QLatin1String("COM1"), QextSerialPort::Polling);
#endif /*Q_OS_UNIX*/
    port->setBaudRate(BAUD19200);
    port->setFlowControl(FLOW_OFF);
    port->setParity(PAR_NONE);
    port->setDataBits(DATA_8);
    port->setStopBits(STOP_2);
    //set timeouts to 500 ms
    port->setTimeout(500);

    message = new QLineEdit(this);

    // transmit receive
    QPushButton *transmitButton = new QPushButton(tr("Transmit"));
    connect(transmitButton, SIGNAL(clicked()), SLOT(transmitMsg()));
    QPushButton *receiveButton = new QPushButton(tr("Receive"));
    connect(receiveButton, SIGNAL(clicked()), SLOT(receiveMsg()));
    QHBoxLayout *trLayout = new QHBoxLayout;
    trLayout->addWidget(transmitButton);
    trLayout->addWidget(receiveButton);

    //CR LF
    QPushButton *CRButton = new QPushButton(tr("CR"));
    connect(CRButton, SIGNAL(clicked()), SLOT(appendCR()));
    QPushButton *LFButton = new QPushButton(tr("LF"));
    connect(LFButton, SIGNAL(clicked()), SLOT(appendLF()));
    QHBoxLayout *crlfLayout = new QHBoxLayout;
    crlfLayout->addWidget(CRButton);
    crlfLayout->addWidget(LFButton);

    //open close
    QPushButton *openButton = new QPushButton(tr("Open"));
    connect(openButton, SIGNAL(clicked()), SLOT(openPort()));
    QPushButton *closeButton = new QPushButton(tr("Close"));
    connect(closeButton, SIGNAL(clicked()), SLOT(closePort()));
    QHBoxLayout *ocLayout = new QHBoxLayout;
    ocLayout->addWidget(openButton);
    ocLayout->addWidget(closeButton);

    received_msg = new QTextEdit();

    QVBoxLayout *myVBox = new QVBoxLayout;
    myVBox->addWidget(message);
    myVBox->addLayout(crlfLayout);
    myVBox->addLayout(trLayout);
    myVBox->addLayout(ocLayout);
    myVBox->addWidget(received_msg);
    setLayout(myVBox);

    qDebug("isOpen : %d", port->isOpen());
}
开发者ID:420174953,项目名称:qgroundcontrol,代码行数:59,代码来源:QespTest.cpp

示例9: closePort

RtMidiInNet :: ~RtMidiInNet()
{
    // Close a connection if it exists.
    closePort();
    // Cleanup.
    NetworkMidiData *data = (NetworkMidiData *) inputData_.apiData ;
    delete data;
}
开发者ID:svn2github,项目名称:vmpk,代码行数:8,代码来源:RtMidiNet.cpp

示例10: Java_com_sun_midp_io_j2me_comm_Protocol_native_1close

/**
 * Close a serial port.
 *
 * @param hPort handle to a native serial port
 *
 * @exception  IOException  if an I/O error occurs
 */
KNIEXPORT KNI_RETURNTYPE_VOID
    Java_com_sun_midp_io_j2me_comm_Protocol_native_1close() {

    int hPort = (int)KNI_GetParameterAsInt(1);

    closePort(hPort);
    KNI_ReturnVoid();
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:15,代码来源:commProtocol.c

示例11: closePort

int
QuarqdClient::quit(int code)
{
    // event code goes here!
    closePort();
    exit(code);
    return 0; // never gets here obviously but shuts up the compiler!
}
开发者ID:27sparks,项目名称:GoldenCheetah,代码行数:8,代码来源:QuarqdClient.cpp

示例12: closePort

int Arduino::destroy()
{
    int rv = 0;
    if (fd >= 0)
    {
        rv = closePort();
    }
    return rv;
}
开发者ID:azwing,项目名称:indi,代码行数:9,代码来源:arduino.cpp

示例13: closePort

void ofxPDSPMidiIn::linkToMidiIn(ofxMidiIn &midiInput){
    if(connected){
        closePort();
    }
    
    midiIn_p = &midiInput;
    midiIn_p->addListener(this); // add ofApp as a listener
    connected = true;
}
开发者ID:npisanti,项目名称:ofxPDSP,代码行数:9,代码来源:ofxPDSPMidiIn.cpp

示例14: yDebug

void utManagerThread::threadRelease()
{
    yDebug("Deleting target from the iCubGui..\n");
        deleteGuiTarget();

    yDebug("Closing ports..\n");
        closePort(motionCUTBlobs);
        printMessage(1,"    motionCUTBlobs successfully closed!\n");
}
开发者ID:towardthesea,项目名称:peripersonal-space,代码行数:9,代码来源:utManagerThread.cpp

示例15: closePort

RtMidiOut :: ~RtMidiOut()
{
  // Close a connection if it exists.
  closePort();

  // Cleanup.
  WinMidiData *data = static_cast<WinMidiData *> (apiData_);
  delete data;
}
开发者ID:JamesLinus,项目名称:pianobooster,代码行数:9,代码来源:RtMidi.cpp


注:本文中的closePort函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。