locked
Shutting down the DSS node when a service drops? RRS feed

  • Question

  • I think I saw a response to this question from George some time ago, but I've searched the forum and I can't find it now. Sorry for the re-post.

     

    Is it possible to close down the DSS node when you want a service to exit, e.g. in its Drop handler?

     

    I think the answer is "no" in this version of MSRS. However, I have noticed that if you close a simulation it seems to take everything else out with it. Does the simulator have some special access to DSS that other services don't?

     

    Trevor

     

    Monday, November 26, 2007 11:29 AM

Answers

  • It's actually quite trivial! The clue I needed from you was the Control Panel service. I spent a few minutes in the Object Browser and found it.

     

    Here it is:

     

    ControlPanelPort.Shutdown();

     

    Put that in your Drop handler and smoke it :-)

     

    Thanks George!

     

    Trevor

     

    Tuesday, November 27, 2007 8:11 AM

All replies

  • There is a actually a message you can send to the ControlPanel service, that will drop it AND make the node exit. I think its called DropWithProcessExit

     

    thanx

    g

     

    Tuesday, November 27, 2007 12:07 AM
  • It's actually quite trivial! The clue I needed from you was the Control Panel service. I spent a few minutes in the Object Browser and found it.

     

    Here it is:

     

    ControlPanelPort.Shutdown();

     

    Put that in your Drop handler and smoke it :-)

     

    Thanks George!

     

    Trevor

     

    Tuesday, November 27, 2007 8:11 AM
  • Since my previous posting I have found some other code that seems to work to shut down the DSS node. Maybe it is doing the same thing:

     

    Code Block
            // The Control Panel partner is only used to shutdown the DSS node
            [Partner("ControlPanel", Contract = cp.Contract.Identifier, CreationPolicy =
                  PartnerCreationPolicy.UseExisting, Optional = false)]
            cp.ControlPanelOperations _cpPort = new
                  Microsoft.Dss.Services.ControlPanel.ControlPanelOperations();
    ...
        _cpPort.Post(new Microsoft.Dss.Services.ControlPanel.DropProcess());

     

    This code seems to work fine on Windows XP. (I also unsubscribe and shut down a WinForm before calling the Control Panel.)

     

    However, on a PDA under Windows Mobile and on an eBox under WinCE this code does NOT shut down the DSS node. This is getting quite annoying because on the PDA you often can't kill cf.dsshost.exe and you have to resort to doing a warm restart of the PDA. On the eBox, closing the Command Prompt that cf.dsshost.exe was run from usually kills it, but occassionally it does not.

     

    Can somebodby please give me a definite answer on how to force the shutdown of a DSS node in a CF environment?

     

    Thanks,

    Trevor

     

     

     

     

    Wednesday, January 2, 2008 12:57 PM
  • DropProcess is the right message to send. Might remember that base don what services you have running, and what extra threads they started, the node might still not shutdown. We just guarantee we cleanup the DSS services and all services we created (not the child threads etc those services created afterwards).

     

    On CF you might have to resort on the a Process.Exit call after the you send the DropProcess. Use a timer to issue the process exit, since if the shutdown does work your timer will never fire and the brute force exit will not be needed

     

    Wednesday, January 2, 2008 7:38 PM
  • I still can't get this to work properly. I tried calling Kill on the current process (there is no Process.Exit), but that does not close it down. However, I've found that turning off Bluetooth on my PDA after the service has called Kill stops the node. There must be a thread somewhere holding the Bluetooth connection open, but unfortunately that is not in my code.

     

    Interestingly, I have seen timeout messages on the DropProcess message to the ControlPanel. Is that a clue that something is not working properly?

     

    Trevor

     

    Friday, January 4, 2008 4:57 AM
  • We've got same issue, cannot shutdown service initialized in our PDA.
    Solution? Instead of a soft-reset, we use ProcessExplorer application to see which is the running process so that we can kill it. Sad, but works

    Miguel
    Blog: http://lonifasiko.blogspot.com
    Tuesday, January 22, 2008 2:58 PM
  • Yes, I use ProcessExplorer too, but sometimes it says that it cannot kill the Dsshost process. Sometimes I can kill the Command Prompt and it takes Dsshost out with it, but not allways.

     

    I have found that in most cases if I close down the Bluetooth Manager, then I can kill Dsshost. It appears that opening a serial port via Bluetooth is the problem -- it does not get closed.

     

    Unfortunately, I did not write the service that is controlling the robot, so I will have to do some investigative work to try to get it to close the serial port when it is dropped.

     

    Trevor

     

     

    Wednesday, January 23, 2008 1:09 AM