From: Axel M. R. <rub...@ro...> - 2008-02-11 15:49:24
|
Hi, I want to incorporate Obj-C classes from AMSerialPort <http://www.harmless.de/cocoa.php> in my RubyCocoa project. The problem is that these refer to IOkit classes, and use CoreFoundation char* string constants (kIOSerialBSDModemType), which are not available in Ruby. The reference in Obj-C is: #import <IOKit/serial/IOSerialKeys.h> // note: the constants are C strings, so use '@' or CFSTR to convert, for example: // NSArray *ports = [[AMSerialPort sharedPortList] serialPortsOfType:@kIOSerialBSDModemType]; // NSArray *ports = [[AMSerialPort sharedPortList] serialPortsOfType:(NSString*)CFSTR(kIOSerialBSDModemType)]; How do I do this in RubyCocoa? I can try to hack around these for now, but I would prefer a more portable solution. Is it possible to easily add IOKit or CoreFoundation support to RubyCocoa? Or is it better to make an Obj-C bridge class in my project that interfaces with the AMSerialPort class? Oh, and I tried to use the really old ruby SerialPort <http://ruby-serialport.rubyforge.org/> implementation, but multi-threading that to get serial input does not seem to work as well as the AMSerialPort class. Thanks Axel -- _________________________ Axel Roest axelloroestello@{AIM/MSN} - Skype:axellofono - XOIP: 084-8749988 |