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

📄 396-398.html

📁 WindowsCE.[Essential Windows CE Application Programming].Jon Wiley & Son.zip
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<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=396-398//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->

<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="392-396.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="398-401.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H3><A NAME="Heading13"></A><FONT COLOR="#000077">Programming Device Service Providers</FONT></H3>
<P>So far we have concentrated on programming desktop ActiveSync service providers. For synchronization to work for any given data type, there must also be a service provider installed on the Windows CE device capable of synchronizing the data type.
</P>
<P>Device service providers are much easier to implement. The main reason is that the device service provider only implements one of the COM interfaces implemented by its desktop counterpart. Device service providers must implement IReplObjHandler, but they do not implement IReplStore. The role of IReplStore is instead performed by four functions exported by the device service provider DLL. These functions are listed in Table 14.4. Of these four functions, <I>ObjectNotify</I> carries the majority of the device service provider responsibilities. We will therefore focus on this function first.</P>
<TABLE WIDTH="100%" BORDER RULES="ROWS"><CAPTION ALIGN=LEFT><B>Table 14.4</B> Device Service Provider Exported Functions.
<TR>
<TH WIDTH="30%" ALIGN="LEFT">FUNCTION
<TH WIDTH="70%" ALIGN="LEFT">PURPOSE
<TR>
<TD>InitObjType
<TD>Initializes the device provider IReplObjHandler interface instance.
<TR>
<TD>GetObjTypeInfo
<TD>Called by the service manager to retrieve data type information from the device.
<TR>
<TD>ObjectNotify
<TD>Called by the service manager when a device data store object changes.
<TR>
<TD>ReportStatus
<TD>Called by the service manager to get status of device synchronization objects.
</TABLE>
<P><FONT SIZE="+1"><B>Synchronizing Device Data Store Changes</B></FONT></P>
<P>When data store objects on the Windows CE device change, or new objects are created, the service manager calls the device service manager <I>ObjectNotify</I> function. The service provider responds to this function call by telling the service manager if the corresponding object change should be synchronized during the next data synchronization.</P>
<P>The <I>ObjectNotify</I> function is defined as:</P>
<!-- CODE SNIP //-->
<PRE>
  BOOL ObjectNotify(pNotify);
</PRE>
<!-- END CODE SNIP //-->
<P>The <I>pNotify</I> parameter is a pointer to an OBJNOTIFY structure that contains information about the object that has changed. The service provider returns TRUE to indicate that the change should be synchronized. It returns FALSE if the change is not to be synchronized.</P>
<P>The OBJNOTIFY structure has the following definition:</P>
<!-- CODE //-->
<PRE>
  typedef struct tagObjNotify
  &#123;
    UINT cbStruct;
    OBJTYPENAME szObjType[ MAX_OBJTYPE_NAME ];
    UINT uFlags;
    UINT uPartnerBit;
    CEOID oidObject;
    CEOIDINFO oidInfo;
    UINT cOidChg;
    UINT cOidDel;
    UINT *poid
  &#125; OBJNOTIFY, *POBJNOTIFY;
</PRE>
<!-- END CODE //-->
<P><I>cbStruct</I> contains the size of the structure in bytes. <I>szObjType</I> is the object type name (for example, &#147;PhoneApp&#148;).</P>
<P>A desktop PC can connect to up to two Windows CE devices. Each connection is called a partnership. <I>uPartnerBit</I> indicates which partnership is connected.</P>
<P><I>oidObject</I> and <I>oidInfo</I> contain the CEOID and CEOIDINFO data of the object in question.</P>
<P>The <I>cOidChg</I> and <I>cOidDel</I> members are returned by <I>ObjectNotify</I>. They tell the service manager the number of changed or deleted objects that should be synchronized.</P>
<P><I>poid</I> is also returned by <I>ObjectNotify</I>. It points to an array of object identifiers corresponding to the objects to be synchronized.</P>
<P>The <I>uFlags</I> member contains flag bits that give the <I>ObjectNotify</I> function information about why the function is being called. <I>uFlags</I> can take on one or more of the values given in Table 14.5.</P>
<TABLE WIDTH="100%" BORDER RULES="ROWS"><CAPTION ALIGN=LEFT><B>Table 14.5</B> ObjectNotify Function Flag Values
<TR>
<TH WIDTH="30%" ALIGN="LEFT">FLAG
<TH WIDTH="70%" ALIGN="LEFT">MEANING
<TR>
<TD>ONF_FILE
<TD>The object in question is a file.
<TR>
<TD>ONF_DIRECTORY
<TD>The object in question is a directory.
<TR>
<TD>ONF_RECORD
<TD>The object in question is a database record.
<TR>
<TD>ONF_DATABASE
<TD>The object in question is a database.
<TR>
<TD>ONF_CHANGED
<TD>Indicates that the object has changed.
<TR>
<TD>ONF_DELETED
<TD>Indicates that the object was deleted.
<TR>
<TD VALIGN="TOP">ONF_CLEAR_CHANGE
<TD>Indicates that the service provider should mark the object as up to date.
<TR>
<TD VALIGN="TOP">ONF_CALL_BACK
<TD>If returned by the service provider, tells the service manager to call <I>ObjectNotify</I> again in two seconds.
<TR>
<TD VALIGN="TOP">ONF_CALLING_BACK
<TD>Indicates that the service manager is calling <I>ObjectNotify</I> in response to the ONF_CALL_BACK flag.
</TABLE>
<P>For example, a device service provider might tell the service manager to synchronize an object deletion as follows:
</P>
<!-- CODE //-->
<PRE>
  BOOL ObjectNotify(POBJNOTIFY pNotify)
  &#123;
    if (pNotify-&gt;uFlags &#38; ONF_DELETED)
    &#123;
    pNotify-&gt;cOidDel = 1;
    pNotify-&gt;poid = (UINT *)&#38;pNotify-&gt;oidObject;
    return (TRUE);
  &#125;
  /* Other ObjectNotify code ... */
&#125;
</PRE>
<!-- END CODE //-->
<P>A complete <I>ObjectNotify</I> example can be found in the phone list application device service provider. This is implemented in the companion CD file \samples\datasync\phoneapp\device\sync\phdevs.cpp.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="392-396.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="398-401.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 + -