How to cleanly shutdown a .NET Serializer application?
Navigates to RoboticsConnection.com Home RoboticsConnection.com HomePage
RoboticsConnection User Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



How to cleanly shutdown a .NET Serializer... Expand / Collapse
Author
Message
Posted Thursday, April 24, 2008 3:28 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Wednesday, September 24, 2008 4:05 PM
Posts: 35, Visits: 142
Yes, it's me again! I am trying to cleanly shut down my Serializer C# application but I must be missing something.

I am using a Bluetooth connection to the Serializer and everything works great in terms of firing up the application, connecting to the Serializer, retrieving senors values, etc. Then I close my Windows form and issue either a Serializer Shutdown() or StopCommunication() command--or both--during the "Form Closed" or "Form Closing" event handler. The application shuts down cleanly with no complaint (I'm running this all in Debug mode within Visual Studio 2005). However, if I fire the application up again, it connects to the Serializer but no longer sees any sensor values--in other words, the fields on my form that display the sensor values all show 0. With the application still running, if I reset the Serializer using the little white push button, then the sensor values show up again. This behavior always occurs--I can never run the application twice in a row without resetting or power-cycling the Serializer.

Any thoughts?

Thanks,
patrick
Post #449
Posted Thursday, April 24, 2008 5:29 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Wednesday, September 24, 2008 4:05 PM
Posts: 35, Visits: 142
P.S. Usually, on the second attempt to launch the application (after cleaning shutting it down once), I get the following exception:

System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="RoboticsConnection.Serializer"
StackTrace:
at RoboticsConnection.Serializer.Internal.CommunicationTask.ThreadProc()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

If I then kill the application, hit the white reset button on the Serializer, then launch the application again, it works fine--or sometimes, my form comes up, but I have to do a second white-button-reset to get the sensors to start reading. Then it runs fine until I shutdown the application again.

--patrick
Post #452
Posted Thursday, April 24, 2008 7:54 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Wednesday, September 24, 2008 4:05 PM
Posts: 35, Visits: 142
Just a quick followup: if I replace the Bluetooth comm module on the Serializer with the USB module, change the COM port in my code and run it without any other changes, I don't get the shutdown/restart problem. So it appears to be related to Bluetooth communications in particular...

--patrick

Post #456
Posted Friday, April 25, 2008 10:43 AM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Today @ 6:22 AM
Posts: 277, Visits: 407
Hmm...It sounds like we need to talk w/ A7Engineering to see why the COM port for the bluetooth module isn't getting closed properly.  I don't know if it's a bluetooth driver/stack, or if it's a problem w/ the eb100 module we use on our Bluetooth modules.  I'm pretty booked this weekend, but we will look at this early to mid week next week.

I seem to recall another customer running into this last year...I guess we unfortunately let it fall through the cracks.

Best Regards,

Jason Summerour
President,
Summerour Robotics Corporation
Microsoft MVP
www.roboticsconnection.com

Post #460
Posted Friday, April 25, 2008 10:54 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Wednesday, September 24, 2008 4:05 PM
Posts: 35, Visits: 142
Hi Jason,

Thanks for your reply. Yes, it certainly seems like the A7 serial port connection is not being properly closed down. Can you think of a way to do this from the C# side? In other words, can I send some kind of reset command to the serial port from my application before shutting down the Serializer?

--patrick

Post #462
Posted Friday, May 16, 2008 9:12 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Wednesday, September 24, 2008 4:05 PM
Posts: 35, Visits: 142
Hi Jason,

Good news on the Bluetooth front. Looks like the shutdown issue is not the fault of your A7 module. I swapped out my Zonet USB Bluetooth dongle on my PC for a new one from Azio (BTD603-132) and it works perfectly. The Azio uses a driver from Toshiba which does not seem to require pairing with the A7 or entering the 0000 passcode. So I'm wondering if that's part of the secret. (To connect with the Zonet dongle, I had to pair using 0000.) In any event, if someone else runs into this problem, they might want to try a different USB/BT dongle on their PC.

--patrick

Post #509
Posted Friday, May 16, 2008 10:31 AM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Today @ 6:22 AM
Posts: 277, Visits: 407
Patrick,

That's good info to have!  We've used our built in BT radio, as well as a Linksys USBBT100 dongle with success.

Thansk for the update!

Best Regards,

Jason Summerour
President,
Summerour Robotics Corporation
Microsoft MVP
www.roboticsconnection.com

Post #510
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: jsummerour

Permissions Expand / Collapse

All times are GMT -8:00, Time now is 11:00am

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.187. 10 queries. Compression Disabled.