Important: The information in this document is obsolete and should not be used for new development.
Implementing Your Cyberdog Service Class
To create a Cyberdog service, you can define a subclass ofCyberService
and create an object from your subclass or you can create aSimpleCyberService
object and use it directly. You define the characteristics of a simple Cyberdog service in the Cyberdog service resource ('srvc'
) for the service. You can use aSimpleCyberService
object if you do not need to override methods defined by theCyberService
class, such as methods related to Cyberdog service menus.The Finger sample uses a
SimpleCyberService
object and its associated service resource to implement the Finger service. The following sections show how to set up the resource and how to respond to menu events for your service's items in the Cyberdog menu.Defining Your Cyberdog Service Resource
The Cyberdog service resource ('srvc'
) allows you to specify a set of strings that describe your service, an icon suite for your service, and a set of strings that specify names for the Cyberdog menu items associated with your service. For more information, see the Types, Constants, and Global Functions chapter of the Cyberdog Programmer's Kit manual. Listing 1 shows the'srvc'
resource of the Finger service.Listing 1 The
'srvc'
resource of the Finger service
#include "Types.r" #include "Cyberdog.h" #include "CyberService.r" #include "FingerDef.h" resource 'srvc' (128, purgeable) { 128, // resource id of 'STR#' resource for this service // (required for CyberService) 128, // resource id of icon family for this service // (required for SimpleCyberService) 129 // "STR#' rsrc for menu item names of this service // (0 if not supported) // (required for SimpleCyberService) }; resource 'STR#' (128, purgeable) {{ kFingerServiceClassName, // [ 1] Service class name "Finger", // [ 2] Service name "finger", // [ 3] URL scheme kFingerConnectPanelKind, // [ 4] Connect part kind kFingerPrefsPanelKind, // [ 5] Prefs part kind kFingerItemClassName, // [ 6] Item class name }}; resource 'STR#' (129, purgeable) {{ "Finger Beep", }}; include "FingerServiceIcons.rsrc";The following constants are defined in the resource:
#define kFingerConnectPanelKind "+//ISO 9070/ANSI::113722::US:: CI LABS::Apple:Cyberdog:FingerSample:Kind:ConnectPanel" #define kFingerPrefsPanelKind "+//ISO 9070/ANSI::113722::US:: CI LABS::Apple:Cyberdog:FingerSample:Kind:PrefsPanel" #define kFingerItemClassName"AppleCyberdog::FingerItem" #define kFingerServiceClassName "AppleCyberdog::FingerService"Responding to Selections of Menu Items
If your simple Cyberdog service places items in the Cyberdog menu, you must implement theDoMenuItemSelected
method to handle the items when they are selected. The Finger service adds a single item to the Cyberdog menu, meaning itsDoMenuItemSelected
method handles item 0.