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

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Code Samples & Tips > Additional Libraries
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Additional Libraries Users contributed libraries.
This sub-forum is only available to licensed users.

SerialEx - an "improved" Serial2 library

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-19-2008, 03:39 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default SerialEx - an "improved" Serial2 library

I produced this library to overcome a few shortcomings with the Serial2 library, in particular using it for binary data transfers. You can read what they are in the help. This library is a superset of Serial2 with additional events for errors and pin changes and is an almost complete exposure of the .NET SerialPort class.

Help and source for merging together with the libary are in the attachment. I didn't bother with a demo for this library - use one for Serial2 and expand it if you want to experiment.
Attached Files
File Type: zip SerialEx1.1.zip (28.2 KB, 391 views)

Last edited by agraham : 11-19-2008 at 07:41 PM.
Reply With Quote
  #2 (permalink)  
Old 11-24-2008, 03:43 PM
Knows the basics
 
Join Date: Jun 2008
Location: Barneveld, NL
Posts: 78
Default

Hi Andrew,

I have just transferred my app from the PC to the device and discovered that the GetPorts method does not return the full list of available ports on a device. I only got COM1, 2, 4, & 3. I had to use the Registry to do it (http://www.basic4ppc.com/forum/code-...-registry.html). This returned 1 to 8 (including the bluetooth ports)

Is there any particular reason for this? Would it be possible to merge the Registry functionality into the SerialEx dll?

David.
Reply With Quote
  #3 (permalink)  
Old 11-24-2008, 04:36 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by DaveW View Post
Is there any particular reason for this?
The .NET SerialPort GetPorts method gets its information from the Registry using the entries under HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM which is valid on both device and desktop. Erel's code uses HKEY_LOCAL_MACHINE\DRIVERS\ACTIVE which only exists on the device. I don't know what the difference is.

Quote:
Would it be possible to merge the Registry functionality into the SerialEx dll?
Possible yes, probable no - unless I have another reason to release an updated version of the library.
Reply With Quote
  #4 (permalink)  
Old 11-24-2008, 05:09 PM
Knows the basics
 
Join Date: Jun 2008
Location: Barneveld, NL
Posts: 78
Default

That's fine I just wondered

David.
Reply With Quote
  #5 (permalink)  
Old 11-24-2008, 06:08 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Quote:
Would it be possible to merge the Registry functionality into the SerialEx dll?
I don't think that it is a good idea. Currently both libraries will be merged during compilation.
__________________
Basic4android documentation
Reply With Quote
  #6 (permalink)  
Old 11-24-2008, 06:52 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by Erel View Post
I don't think that it is a good idea.
IF I ever did do it I would write the device COM port Registry search into the SerialEx.GetPorts method. I didn't mean that I would merge the two libraries into one!
Reply With Quote
  #7 (permalink)  
Old 11-30-2008, 06:46 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,313
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

StopBits=0 gives me an error stating "Enumvalue was out of Legal Range."
StopBits=1 works with no erros...

But I'm still in the configuring the com port, so I haven't even opened it yet...
Can this be a bug?
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France-Saumur
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)
B4PPC DLL Version Listing - B4Android DLL Version Listing
Reply With Quote
  #8 (permalink)  
Old 11-30-2008, 07:31 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by Cableguy View Post
Can this be a bug?
No, it seems deliberate on Microsofts part for some reason. The StopBits enumeration is documented to have (and actually has when checked with Reflector) the four values shown in the help, 0, 1, 1.5 or 2 and most hardware can support these. However when I look with Reflector inside the SerialPort class, for some reason known only to whoever wrote that software, it is deliberately programmed to only accept either 1 or 1.5 stop bits. I have no idea why this limitation exists! 1 stop bit is universal nowadays, I haven't seen 1.5 used since the days of 5 hole mechanical teletype machines.
Reply With Quote
  #9 (permalink)  
Old 11-30-2008, 07:45 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,313
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

So If I really need to set the value to zero, is there any workaround?
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France-Saumur
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)
B4PPC DLL Version Listing - B4Android DLL Version Listing
Reply With Quote
  #10 (permalink)  
Old 11-30-2008, 08:03 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

No, but I'd be very surprised (astonished even) if any modern equipment required the use of 0 stop bits.
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
Cannot start B4PP anymore on desktop: "A problem was encountered" Frank Questions (Windows Mobile) 5 11-11-2008 11:03 AM
"AddEvent" and "buttonUp/buttonDown" Byak@ Questions (Windows Mobile) 12 09-10-2008 04:04 PM
Is there any thing like Visual Basic "Tabbed dialog control" in Basic4ppc? mozaharul Questions (Windows Mobile) 6 03-23-2008 12:07 PM
calling the device's "Programs" or "settings" screens HarleyM Questions (Windows Mobile) 0 12-05-2007 03:59 AM
Network "library" agraham Additional Libraries 2 11-11-2007 10:32 AM


All times are GMT. The time now is 04:36 AM.


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