Re: Writing an "AT-Command" to a Modem
Re: Writing an "AT-Command" to a Modem
- Subject: Re: Writing an "AT-Command" to a Modem
- From: Andreas Mayer <email@hidden>
- Date: Tue, 23 Oct 2007 16:16:02 +0200
Am 23.10.2007 um 09:11 Uhr schrieb Stefan Lehrner:
what is the best way to send an "AT-Command" to a Modem?
There is no "best way". It depends on what you need.
Also, all “three ways“ you listed are very similar. AMSerialPort ist
based on Apple's SerialPort sample. It just wraps the necessary
procedures in Cocoa classes. And you can, of course, use the file
handle returned from AMSerialPort -open to directly write to the
serial device.
Am 23.10.2007 um 10:14 Uhr schrieb Half Activist:
Because I suppose you'll come across buffer problems with other
methods and you'd run into data you write but never comes out to
the serial port, and do quite a lot of flushing.
Why do you think so?
write( fd, [ yourData bytes ], [ yourData length ] );
Well, that's what AMSerialPort does:
- (BOOL)writeData:(NSData *)data error:(NSError **)error
{
BOOL result = NO;
const char *dataBytes = [data bytes];
unsigned dataLen = [data length];
ssize_t bytesWritten = 0;
int errorCode = kAMSerialErrorNone;
if (dataBytes && (dataLen > 0)) {
bytesWritten = write(fileDescriptor, dataBytes, dataLen);
As I said: These “different ways“ are actually quite similar.
Andreas_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden