October 25, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Developing ActiveSync Service Providers: Desktop Part Implementation

  • October 10, 2005
  • By Alex Gusev
  • Send Email »
  • More Articles »

IReplObjectHandler Implementation

Similar to its device counterpart, the code for the desktop implements the same interface, but probably with some differences from the PDA. It doesn't make sense to discuss it here.

Registration

Finally, you have reached a point when you will register all your created stuff. The whole process will be devided into the device part and the desktop one. The PDA registration is easy:

extern "C" BOOL _declspec(dllexport) RegisterActiveSync()
{
   // register this DLL as implementing an ActiveSync service
   HKEY hKey;
   DWORD dwDisp;
   TCHAR szYourProvider[] = _T("YourProvider.dll");
   if(RegCreateKeyEx(HKEY_LOCAL_MACHINE,
      _T("Windows CE Services\Synchronization\Objects\
          YOUR_PROVIDER"),
      0, NULL, 0, 0, NULL, &hKey, &dwDisp) != 0)
      return FALSE;
   if(RegSetValueEx(hKey, _T("Store"),
                    NULL,
                    REG_SZ,
                    (LPBYTE)szYourProvider,
                    _tcslen(szYourProvider) * sizeof(TCHAR)) != 0)
      return FALSE;
   return TRUE;
}

You may call such a function from your application or add appropriate entries into the installation project.

The desktop part is a bit longer. You have to create a key with the same name as for the device because they're linked by name. The DllRegisterServer function makes all required jobs; here I just place a short 'ToDo' list of Registry keys used by ActiveSync to identify the service provider:

// + Create provider key          HKLMSOFTWAREMicrosoft
                                     Windows CE Services
                                  ServicesSynchronization
                                     ObjectsASPSimple
// + Set default value            HKLMSOFTWAREMicrosoft
                                     Windows CE Services
                                  ServicesSynchronizationObjects
                                     ASPSimpleASPSimple
// + Create "display name" key    HKCRASPSimple.ASPSimple
                                     Display Name
// + Set default value            HKCRASPSimple.ASPSimple
                                     DisplayName - SimpleFileSync
// + Set Display Name             HKCRASPSimple.ASPSimple
                                     DisplayName - SimpleFileSync
// + Set Plural Name              HKCRASPSimple.ASPSimple
                                     PluralName - SimpleFileSync Items
// + Set Store Name               HKCRASPSimple.ASPSimple
                                     Store - DeveloperCom.SimpleFileSync

Final results are below:

Conclusion

Well, you finally have dug to some outcome. You have done a huge job to get it working, but now you may use it for your pleasure. And, now is a good time to reveal a tiny mystery: Pocket PC 2003 SDK contains a wizard for desktop Visual Studio, which helps you in ASP skeleton creation. Anyway, even if it does most of the routine job for you, you have to understand what is it to successfuly focus on the meaningful parts of your project. Besides, SDK samples contain a Stock Portfolio project that illustrates the continuous data synchronization process very well.

Download

Download the accompanying code's zip file here.

About the Author

Alex Gusev started to play with mainframes in the end of the 1980s, using Pascal and REXX, but soon switched to C/C++ and Java on different platforms. When mobile PDAs seriously rose their heads in the IT market, Alex did it too. Now, he works at an international retail software company as a team leader of the Mobile R department, making programmers' lives in the mobile jungles a little bit simpler.





Page 3 of 3



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel