// -------------------------------------------------------------------------- // // * TDCLIOKitSerialPort( void ) // -------------------------------------------------------------------------- // TDCLIOKitSerialPort::TDCLIOKitSerialPort( IDCLThreads* inThreadsIntf, KUInt32 inIndex, long inBaud /* = 38400 */ ) : TDCLFDSerialPort( inThreadsIntf, nil, inBaud ) { // R�cup�ration. CFStringRef theBSDPathAsCFString = GetSerialPortPath( inIndex ); // V�rification que le port existe. if (theBSDPathAsCFString == nil) { throw DCLNotAvailable; } // Traduction. char* theBSDPath = CFStringRefToCStr( theBSDPathAsCFString ); // Lib�ration. ::CFRelease( theBSDPathAsCFString ); // Initialisation. Init( theBSDPath ); // Lib�ration. ::free( theBSDPath ); }
int FindSerialPortNames(char** pNames, int iMaxNames) { int iActiveNameCount = 0 ; kern_return_t kernResult; // on PowerPC this is an int (4 bytes) io_iterator_t serialPortIterator; kernResult = FindSerialPorts(&serialPortIterator); iActiveNameCount = GetSerialPortPath(serialPortIterator, pNames, iMaxNames, MAXPATHLEN); IOObjectRelease(serialPortIterator); // Release the iterator. return iActiveNameCount ; }