bartop

palmoswerks ARCHIVE
Palm OS programming tips from a (former) CodeWarrior insider

header

Navigation

Search
Home
About
Stories
Stuff I Like
Articles
PilRC
CodeWarrior
palmos.techwood.org
DevTools List
Palm OS Dev FAQ

Supporting the Send Data command

Author:   Ben Combee  
Posted: 2/18/03; 8:33:50 PM
Topic: Supporting the Send Data command
Msg #: 130 (top msg in thread)
Prev/Next: 129/131
Reads: 3459

If you wrote an application that uses Exchange Manager to let people beam data around, it is fairly easy to update it to support sending data through other means, including SMS and Bluetooth.

In general, all you need to do is add the send URL prefix to the name field of the ExgSocketType structure you create and pass to ExgPut. This prefix is defined as "?_send:". The "_send" part is a URL scheme that exchange libraries on your device can register to support. By default, SMS and BlueTooth both register themselves here, but there can be other libraries available. The leading "?" tells Exchange Manager to popup a dialog asking the user to pick one library. Without this, the system would go with the default library.

Most applications that support this functionality do it with a second menu command. If you had "Beam Data" before, you would add a "Send Data" command now that would use this prefix. For consistency, its a good idea to hide this menu item on devices that don't have this feature. You can start with the "Send Data" menu item hidden, and then only expose it using MenuShowItem if there is send support. MenuShowItem (added in OS 3.5) will be available on any device that also has this Exchange Manager feature.

To determine if this _Send: scheme is supported on your device, you can use code like this:

UInt32 numLibs; if (ExgGetRegisteredApplications(NULL, &numLibs, NULL, NULL, exgRegSchemeID, exgSendScheme) || !numLibs)
    MenuHideItem(SendCmd);
else
    MenuShowItem(SendCmd);

Update

MenuHideItem and MenuShowItem don't work very well on Palm OS 3.5. I learned this the hard way. So my advice to use them to hide the Send command is bad, and you need to have multiple menus, or just do it all by using MenuAddItem to add items to a menu on Palm OS 4.0 and later devices.


Send feedback to combee@techwood.org
Copyright © 2004 Benjamin L. Combee
Palm OS is a registered trademark of PalmSource, Inc.
Metrowerks and CodeWarrior are registered trademarks of Metrowerks Inc.

The views expressed on this website/weblog are those of mine alone and do not necessarily reflect the views of PalmSource or Metrowerks.

This is a Manila Site

qwertYAK / frobnovich