Synchronization Logic
The SyncLogic object created
in
the BeginProcess routine
encapsulates all of our synchronization
logic. In our example, the class instancing property is set to
Private, and the class file is saved as
Ch4aLogic.cls. By partitioning a conduit in this
fashion, between the public interface and the internal
synchronization logic, we ensure that the interface code can be
reused in other conduits.
Let’s look at the Synchronize
method,
which
is called to handle all of the synchronization requests made of this
conduit. The code for Synchronize is shown in
Example 4-8.
Example 4-8. Listing for SyncLogic.Synchronize
Public Sub Synchronize( )
' Get the HotSync information object for this conduit
Dim pdSys As New PDSystemAdapter
Dim pdHSInfo As PDHotsyncInfo
Set pdHSInfo = pdSys.PDHotsyncInfo
' Route the requested synchronization to the local handler
Select Case pdHSInfo.SyncType
Case eFast
FastSync pdSys, pdHSInfo
Case eSlow
SlowSync pdSys, pdHSInfo
Case eHHtoPC
HHtoPC pdSys, pdHSInfo
Case Else
LogSync pdSys, pdHSInfo.SyncType
End Select
End SubThe first thing the method does is to declare and initialize a Palm Sync Suite COM object:
Dim pdSys As New PDSystemAdapter
The PDSystemAdapter class represents
the
Palm device. This powerful class provides access to most features of
the device (except databases, which are handled by a separate class).
The PDSystemAdapter class
has the methods and properties shown in
Table 4-10.
Table 4-10. Properties and methods of PDSystemAdapter ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access