Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Serial port handling

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-25-2008, 09:45 PM
Basic4ppc Expert
 
Join Date: May 2008
Location: Berkshire, UK
Posts: 810
Awards Showcase
Beta Tester 
Total Awards: 1
Default Serial port handling

I have been using the serial library with some partial success, and am looking how I may avoid data loss. This is with no lower-level handshaking, just a package protocol (actually from Garmin for their GPS).

The Help for the serial keywords doesn't say much about how they interact. For instance I assume that doing InputArray() empties the input buffer so that the same data cannot be read again.

But what is the effect of the Timeout? What actions does it influence, and how to tell if there has been a timeout event?

Regards, Mike.
Reply With Quote
  #2 (permalink)  
Old 06-26-2008, 04:52 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

InputArray reads (and empties) all the data that is waiting in the input buffer.
It is however possible that while you read the data, new data arrives.

Timeout affects the time to wait before the program raises a timeout error when you read or write data to the serial port.
The default is Infinite.
If a timeout occurs an error will be raised.
Reply With Quote
  #3 (permalink)  
Old 06-26-2008, 09:13 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by Erel View Post
The default is Infinite.
I hesitate to correct the master but on my system it is 100mS! I investigated why. See "private void SharedNew()" in the Serial object!
Reply With Quote
  #4 (permalink)  
Old 06-26-2008, 09:28 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

You are absolutely right!
Reply With Quote
  #5 (permalink)  
Old 06-26-2008, 10:36 AM
Basic4ppc Expert
 
Join Date: May 2008
Location: Berkshire, UK
Posts: 810
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Ah, thanks for correcting the "infinite" timeout; I had already tried displaying the default value and infinity might have overloaded the message box somewhat!

100mS isn't very long, so now I wonder why I haven't triggered this timeout already.

I have now started looking at ErrorLabel and exception handling...

Regards, Mike
Reply With Quote
  #6 (permalink)  
Old 06-26-2008, 10:48 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

For infinite timeout set the property to -1. Any other positive number is the timeout in mS. Any other -ve number will trigger an exception.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Send data to serial port for other application schimanski Questions (Windows Mobile) 6 04-08-2008 05:45 PM
Serial Port won't open djmrozinski Questions (Windows Mobile) 6 03-16-2008 04:25 PM
GPS and Virtual Serial Port alfcen Questions (Windows Mobile) 2 10-05-2007 01:56 PM
Serial Port Profile & Bluetooth Paul Questions (Windows Mobile) 5 07-27-2007 04:08 PM
Open serial port crashes program on device Steve Bug Reports 2 05-23-2007 09:52 PM


All times are GMT. The time now is 10:00 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0