locked
ActiveSync connectivity after relogin RRS feed

  • Question

  • hello,

    i am using AS version 4.5 (on XP SP3) which is, as far as i know, the latest version. there is one problem i am struggling with since i am developing apps for smart devices. use case is as follows:

    when the device is cradled it should always be connected to the host machine to receive (custom) updates and have access to a sqlserver on another machine. that's no problem as long nobody logs off which unfortunatley happens automatically after a certain period of time with no interaction. so when you log on again AS tries to reconnect but fails after some time. on a WinCE 5.0 device i discovered that when there's no connection, repllog.exe is not running on the device. starting it programatically did the trick. but now i am stuck with a WM 6.5 (MC55) and there repllog.exe runs always independently from the connection state. what i found out is, that the prior build up connection stays active even during log off. in the registry there's an entry at HKLM\Comm\Tcpip\Hosts\ppp_peer\ipaddress and even at the host machine there is an active ip connection. both have the same ip (169.254.2.2). pinging is possible but i can't get further or browse the device --> AS-symbol is grey. so i stumbled upon a workaround which is deactivating/activating "settings > Connections > USB to PC > network Functions". it initiates a new connection. so what i am doing now is calling that controlpanel via code (coredll.dll) which works so far. my only problem is, that i can't determine if the device is in that messy state or not (like checking repllog.exe). i just can try to ping or execute a query on the sqlserver (that's the only machine i know in the network) an see if it succeeds which is an unreliable indicator because it is legitime that sqlserver is not reachable. thus it always keeps up an sql-connection due to the cyclic connectivity check.

    so in a nutshell: is there a way to determine (on device side) if AS-connection is up --> symbol is green. or is there a way to make AS lose the connection entirely during log off so that a relogin initiates a new connection thats actually working?

     

    thanks in advance

    _qwertz_

    Friday, March 25, 2011 9:26 AM

Answers

  • On Mon, 28 Mar 2011 14:31:08 +0000, qwertz wrote:

    Problem is that PC doesnt know if pda is actually in the cradle. pda does due to power_notify_events...

    An app running on the PC has at least 3 ways to determine whether a pda is connected:

    1) Call CeRapiInit. This function will not return until a connection is made, so it can be
    used to make an application sleep until a pda connects.

    2) Call CeRapiInitEx. This function returns immediately, and its return value indicates
    whether a pda is connected

    3) When ActiveSync detects a connection, it automatically starts each
    executable listed as a string value in the registry key:
       HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE
    Services\AutoStartOnConnect
    The name of the value doesn't matter.

    • Marked as answer by Jesse Jiang Wednesday, April 6, 2011 7:30 AM
    Monday, March 28, 2011 7:04 PM
  • you need do something on your PC client, not mobile client


    NEU_ShieldEdge
    • Marked as answer by Jesse Jiang Wednesday, April 6, 2011 7:30 AM
    Thursday, March 31, 2011 9:54 AM

All replies

  •  

    I think you should do all thing on PC side, there is no event in mobile client. When someone logs off, you should close the connect from PC client.


    NEU_ShieldEdge
    Monday, March 28, 2011 8:36 AM
  • Problem is that PC doesnt know if pda is actually in the cradle. pda does due to power_notify_events...
    Monday, March 28, 2011 2:31 PM
  • On Mon, 28 Mar 2011 14:31:08 +0000, qwertz wrote:

    Problem is that PC doesnt know if pda is actually in the cradle. pda does due to power_notify_events...

    An app running on the PC has at least 3 ways to determine whether a pda is connected:

    1) Call CeRapiInit. This function will not return until a connection is made, so it can be
    used to make an application sleep until a pda connects.

    2) Call CeRapiInitEx. This function returns immediately, and its return value indicates
    whether a pda is connected

    3) When ActiveSync detects a connection, it automatically starts each
    executable listed as a string value in the registry key:
       HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE
    Services\AutoStartOnConnect
    The name of the value doesn't matter.

    • Marked as answer by Jesse Jiang Wednesday, April 6, 2011 7:30 AM
    Monday, March 28, 2011 7:04 PM
  • thanks for the info. AutoStartOnConnect event i am already using for update purposes. it fires when a new connection is made which unfortunately doesnt happen during a relogin. old connection persists (useless).

    CeRapiInit would do the trick but my problem is that a new connection can only be initiated from the device with the above described "hack" --> calling the controlpanel in that certain manner. restarting the AS-processes (wcescomm.exe, rapimgr.exe, wcesmgr.exe) on the machine does not work. that's what happens when one logs in again --> AS tries to connect and fails. therefore i need to determine connection state on device-side...

    but thanks anyway. any hint is appreciated

    Wednesday, March 30, 2011 11:24 AM
  • you need do something on your PC client, not mobile client


    NEU_ShieldEdge
    • Marked as answer by Jesse Jiang Wednesday, April 6, 2011 7:30 AM
    Thursday, March 31, 2011 9:54 AM
  • I don't mean to hi-jack the thread but...

    @Luke-Skywalker: I think you should do all thing on PC side, there is no event in mobile client. When someone logs off, you should close the connect from PC client.

    how exactly do you close the ActiveSync connection from code?


    the real JeZteR Check out my Blog: Titan Blog
    Monday, October 10, 2011 9:19 PM
  • Hey _qwertz_,

    did you ever resolve this completely?  I see a few post marked as answer, but they don't really answer your question - which is the same as mine:

    How to get app to connect to mobile device after log off/on

    If so, could you please share what you did to resolve this?

     

    Thanks

     


    the real JeZteR
    Check out my Blog: Titan Blog
    Check my unanswered questions: JeZteR's Unanswered Questions
    Thursday, December 15, 2011 8:59 PM