⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 363-366.html

📁 WindowsCE.[Essential Windows CE Application Programming].Jon Wiley & Son.zip
💻 HTML
📖 第 1 页 / 共 2 页
字号:

		</td>
		
<!-- PUB PARTNERS END -->
<!-- END LEFT NAV -->

<td rowspan="8" align="right" valign="top"><img src="/images/iswbls.gif" width=1 height=400 alt="" border="0"></td>
<td><img src="/images/white.gif" width="5" height="1" alt="" border="0"></td>
<!-- end of ITK left NAV -->

<!-- begin main content -->
<td width="100%" valign="top" align="left">


<!-- END SUB HEADER -->

<!--Begin Content Column -->

<FONT FACE="Arial,Helvetica" SIZE="-1">
To access the contents, click the chapter and section titles.
</FONT>
<P>
<B>Essential Windows CE Application Programming</B>
<FONT SIZE="-1">
<BR>
<I>(Publisher: John Wiley & Sons, Inc.)</I>
<BR>
Author(s): Robert Burdick
<BR>
ISBN: 0471327476
<BR>
Publication Date: 03/01/99
</FONT>
<P>
<form name="Search" method="GET" action="http://search.earthweb.com/search97/search_redir.cgi">

<INPUT TYPE="hidden" NAME="Action" VALUE="Search">
<INPUT TYPE="hidden" NAME="SearchPage" VALUE="http://search.earthweb.com/search97/samples/forms/srchdemo.htm">
<INPUT TYPE="hidden" NAME="Collection" VALUE="ITK">
<INPUT TYPE="hidden" NAME="ResultTemplate" VALUE="itk-simple-intrabook.hts">
<INPUT TYPE="hidden" NAME="ViewTemplate" VALUE="view.hts">

<font face="arial, helvetica" size=2><b>Search this book:</b></font><br>
<INPUT NAME="queryText" size=50 VALUE="">&nbsp;<input type="submit" name="submitbutton" value="Go!">
<INPUT type=hidden NAME="section_on" VALUE="on">
<INPUT type=hidden NAME="section" VALUE="http://www.itknowledge.com/reference/standard/0471327476/">

</form>


<!-- Empty Reference Subhead -->

<!--ISBN=0471327476//-->
<!--TITLE=Essential Windows CE Application Programming//-->
<!--AUTHOR=Robert Burdick//-->
<!--PUBLISHER=John Wiley & Sons, Inc.//-->
<!--IMPRINT=Wiley Computer Publishing//-->
<!--CHAPTER=14//-->
<!--PAGES=363-366//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->

<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="361-363.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="366-367.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P><FONT SIZE="+1"><B><I>The Service Manager Data Model</I></B></FONT></P>
<P>The ActiveSync service manager does not have information about the internal structure of data in the applications it synchronizes. It does not know, for example, that an entry in the phone list application contains strings for a first name, last name, and phone number, and an integer value representing an employee department number.
</P>
<P>But the service manager does keep track of some information about each data object that it synchronizes. The service manager stores a handle identifying each synchronized object. Along with this handle, information uniquely identifying the object may be stored. This information might include a global unique identifier (GUID), a FILETIME stamp representing when the object was last modified, or an application-defined index. As we will see later, this additional information is instrumental in determining if a given object has changed since it was last synchronized.</P>
<P>Other information can be stored as well. It is common, for instance, to store information used by the service manager for resolving data conflicts, or to save a version number of the application data.</P>
<P>This information is stored in a file called REPL.DAT. You can think of this file as the service manager&#146;s synchronization log. It contains a handle and other related data for each object synchronized by ActiveSync.</P>
<P>The service manager models the objects contained in REPL.DAT as a collection of <I>folders</I>. Each folder contains all of the data objects synchronized for a particular application data type. Each of these objects is called an <I>item</I>. Windows CE defines handle types for each of these data types. HREPLFLD is the folder handle type, and HREPLITEM is the item handle type. Folders and handles are considered to be subtypes of the more generic <I>object</I> type, represented by the handle HREPLOBJ. As we will see, many of the methods implemented by ActiveSync service providers operate on data of these types.</P>
<P>To represent folders, objects, and items internally, the phone list application desktop service provider defines the following C&#43;&#43; classes in the file \samples\datasync\phoneapp\desktop\sync\store.h:</P>
<!-- CODE //-->
<PRE>
  //Synchronization option flags
  #define SO_ALL  0
  #define SO_AM   1
  #define SO_NZ   2
  #define OT_ITEM  1
  #define OT_FOLDER  2
  class CReplObject
  &#123;
  public:
    virtual &#8764;CReplObject() &#123;&#125;
    UINT m_uType; //Object type (folder or item)
  &#125;;
  class CFolder: public CReplObject
  &#123;
  public:
    CFolder()
    &#123;
    m_uType = OT_FOLDER;
    m_uSyncOpt = SO_ALL;
    m_fChanged = FALSE;
    &#125;
    virtual &#8764;CFolder() &#123;&#125;
    UINT m_uSyncOpt; //Synchronization option
    BOOL m_fChanged; //Is the item changed?
  &#125;;
  class CItem: public CReplObject
  &#123;
  public:
    CItem()
    &#123;
    m_uType = OT_ITEM;
    memset(&#38;m_ftModified, 0, sizeof(FILETIME));
    &#125;
    virtual &#8764;CItem() &#123;&#125;
    UINT m_uid; //Item / phone entry identifier
    FILETIME m_ftModified; //Time last modified
  &#125;;
</PRE>
<!-- END CODE //-->
<P>These classes model the information stored by the service manager in REPL.DAT for the various folders and items synchronized.
</P>
<P><FONT SIZE="+1"><B>The ActiveSync Service Providers</B></FONT></P>
<P>Whereas the service manager is provided by the Windows CE Services, the service providers are implemented by the application programmer. The majority of the tasks required to carry out synchronization are implemented by the service providers.
</P>
<P>For example, the service manager transfers data from the desktop to a connected Windows CE device and vice versa. But it is the service providers&#146; responsibility to convert transferred data packets into a form useful to the application.</P>
<P>Application data can originate on either the desktop or the Windows CE device. Likewise, data can be changed or deleted either in the desktop or the device version of a particular application. There must therefore be a service provider on both the desktop computer and the Windows CE device corresponding to each type of data that can be synchronized.</P>
<P>ActiveSync service providers are implemented as in-process COM servers. Hence, service providers are implemented in dynamic link libraries. Each desktop service provider must implement two COM interfaces, IReplStore and IReplObjHandler. Device service providers must implement IReplObjHandler, as well as various exported functions.</P>
<P>IReplStore<I>,</I> simply called the store, is responsible for such tasks as enumerating objects in the application data store and converting these objects into HREPLITEM or HREPLFLD representations for the service manager. This interface takes care of any task related to the data store.</P>
<P>IReplObjHandler, or &#147;the handler&#148; for short, implements tasks such as converting object data into binary packets so that they can be transferred by the service manager.</P>
<P>Any application data type that can be synchronized between a Windows CE device and a desktop PC must implement both a device and a desktop service provider.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="361-363.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="366-367.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>


<!-- all of the reference materials (books) have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->

<!-- BEGIN SUB FOOTER -->
		<br><br>
		</TD>
    </TR>
	</TABLE>

		
	<table width="640" border=0 cellpadding=0 cellspacing=0>
		<tr>
		<td align="left" width=135><img src="/images/white.gif" width=100 height="1" alt="" border="0"></td>
		
		
<!-- END SUB FOOTER -->

<!-- all of the books have the footer and subfoot reveresed -->
<!-- reference_subfoot = footer -->
<!-- reference_footer = subfoot -->

<!-- FOOTER -->
			
		<td width="515" align="left" bgcolor="#FFFFFF">
<font face="arial, helvetica" size="1"><b><a href="/products.html"><font color="#006666">Products</font></a>&nbsp;|&nbsp; <a href="/contactus.html"><font color="#006666">Contact Us</font></a>&nbsp;|&nbsp; <a href="/aboutus.html"><font color="#006666">About Us</font></a>&nbsp;|&nbsp; <a href="http://www.earthweb.com/corporate/privacy.html" target="_blank"><font color="#006666">Privacy</font></a> &nbsp;|&nbsp; <a href="http://www.itmarketer.com/" target="_blank"><font color="#006666">Ad Info</font></a> &nbsp;|&nbsp; <a href="/"><font color="#006666">Home</font></a></b>
		<br><br>
		
		Use of this site is subject to certain <a href="/agreement.html">Terms &amp; Conditions</a>, <a href="/copyright.html">Copyright &copy; 1996-1999 EarthWeb Inc.</a><br> 
All rights reserved.  Reproduction whole or in part in any form or medium without express written permision of EarthWeb is prohibited.</font><p>
</td>
		</tr>
</table>
</BODY>
</HTML>

<!-- END FOOTER -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -