Warning: Creating default object from empty value in /www/htdocs/harmless/hscs.php on line 239
harmless Cocoa: Finally a new version of AMSerialPort
Finally a new version of AMSerialPort 2007-07-31 18:59:10
Finally a new version of AMSerialPort.
Nick Zitzmann contributed the code for the added/removed port notifications and Sean McBride did help with the API redesign as well as the implementation and testing of all new code. Actually, I think Sean did most of the work. Many thanks, guys.
von Andreas www.harmless.de

The sample app is using a thread to read the data in parallel to the main thread as soon as it is reported by the OS. I guess you could use a smaller buffer to get smaller chunks of data. I fail to see the benefit though.

Apart from that you would have to change the way the OS buffers incoming data. I don't know how to do that - or if that's even possible.

von adam

Is there any way to get this to real time poll the serial port? I'm using the example, but it seems to be reading big chunks from the buffer at a time.

von Thomas Tempelmann

>to test for NO write
>if (!<some boolean expression>)

Nö, better (readable) is:

if (not <bool expr>)

von Andreas www.harmless.de

What does your test look like?

The code reads:

- (BOOL)DTRInputFlowControl
{
return (options->c_cflag & CDTR_IFLOW);
}

I can't see any error here, but it might not return what you think it does. Let me explain.

BOOL is defined as

typedef signed char

YES is defined as

#define YES (BOOL)1

The above method will return 0 (zero) if the CDTR_IFLOW flag is not set and CDTR_IFLOW otherwise (which happens to be 0x00040000). So you may NOT compare to YES.

I.e. instead of

if (<some boolean expression> == YES)

you should write

if (<some boolean expression>)

to test for NO write

if (!<some boolean expression>)

If that doesn't solve your problem, please send me some sample code per mail.

von Bill Myers

(Small?) bug: the AMSerialPort -(BOOL)DTRInputFlow method always returns NO.

Name:  Passwort: (1)
Email: (2)
Webseite: (3)
Kommentar:
{captcha}
Obige Zeichen eingeben: (Groß-/Kleinschreibung egal)
   

1) Bitte geben Sie möglichst Ihren echten Namen an. (Momentan gibt es keine Möglichkeit, einen festen Account anzulegen.)

2) Ihre Email-Adresse wird nie veröffentlicht werden. Die Angabe ermöglicht mir, Sie ggf. zu kontaktieren.

3) Die Adresse Ihrer Webseite wird zusammen mit Ihrem Namen veröffentlicht. Bitte kurz halten.

Ich behalte mir das Recht vor, Beiträge aus beliebigen Gründen zu löschen.
Also bitte keinen SPAM posten, beim Thema bleiben, nicht unverschämt werden, etc.