home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 August / PCO0897.ISO / filesbbs / os2 / plnk065.arj / PLNK065.ZIP / pilot-link.0.6.5 / Perl5 / PDAPilot / test.pl < prev    next >
Encoding:
Text File  |  1997-05-23  |  1.2 KB  |  61 lines

  1.  
  2. use PDA::Pilot;
  3.  
  4. if ($ARGV[0]) {
  5.     $port = $ARGV[0];
  6. } else {
  7.     print "What port should I use [/dev/cua3]: ";
  8.     $port = <STDIN>;
  9.     chop $port;
  10.     $port ||= "/dev/cua3";
  11. }
  12.  
  13. $socket = PDA::Pilot::OpenPort($port);
  14.  
  15. # OpenPort is the equivalent of
  16. #
  17. #$socket = PDA::Pilot::socket(PI_AF_SLP, PI_SOCK_STREAM, PI_PF_PADP);
  18. #
  19. #PDA::Pilot::bind($socket,
  20. #    {family => PI_AF_SLP, port => PI_PilotSocketDLP, device => $port});
  21. #
  22. #PDA::Pilot::listen($socket, 1);
  23.  
  24. print "Now press the HotSync button\n";
  25.  
  26. $dlp = PDA::Pilot::Accept($socket);
  27.  
  28. @pref = $dlp->GetAppPref('mail', 3);
  29.  
  30. @pref = "Not available" if not defined $pref[0];
  31.  
  32. print "Mail preferences: @pref\n";
  33.  
  34. $ui = $dlp->GetUserInfo;
  35.  
  36. @b = $dlp->Battery;
  37.  
  38. print "Battery voltage is $b[0], (warning marker $b[1], critical marker $b[2])\n";
  39.  
  40. $db = $dlp->Open("MemoDB");
  41.  
  42. @r = $db->GetRecord(0);
  43.  
  44. print "Memo record 0 has ID $r[2], attribue $r[3], category $r[4]\n";
  45.  
  46. $r = PDA::Pilot::Memo::Unpack($r[0]);
  47.  
  48. print "Contents: '$r->{text}'\n";
  49.  
  50. $app = $db->GetAppBlock;
  51.  
  52. $app = PDA::Pilot::Memo::UnpackAppBlock($app);
  53.  
  54. print "Categories: @{$app->{categoryName}}\n";
  55.  
  56. undef $db; # Close database
  57.  
  58. undef $dlp; # Close connection
  59.  
  60. print "Your name is $ui->{name}\n";
  61.