#+TITLE: Chapter 10: Communications: Infrared Beaming, Serial Ports, and HotSync #+AUTHOR: Hermes & Claude #+DATE: 2026-10-07 #+PARENT: [[file:index.org][Index]] #+INCLUDE: goback.org * Physical Connectivity on the Palm Platform A signature strength of Palm handhelds was their ability to communicate seamlessly across diverse physical channels: 1. *Infrared Beaming (IrDA)*: Instant point-to-point wireless sharing between handhelds. 2. *RS-232 / UART Serial*: Direct hardware connectivity to modems, GPS receivers, and external microcontrollers. 3. *HotSync*: Fast synchronization between the desktop computer and the device's storage databases. * 1. The Exchange Manager & Infrared Beaming (IrDA) Starting with Palm OS 3.0, the *Exchange Manager* (~ExgMgr~) unified all data transmission mechanisms into a high-level URL-like protocol. Whether data is sent over Infrared (~_beam~), Bluetooth (~_bt~), or SMS, applications use the identical exchange API. ** Beaming a Record via C++ To beam a record or memo to another Palm device: #+BEGIN_SRC cpp using UInt16 = unsigned short; using UInt32 = unsigned long; using Err = short; struct ExgSocketType { UInt16 libraryRef; UInt32 socket; UInt32 target; UInt32 count; UInt32 length; UInt32 time; UInt32 appData; const char* description; const char* type; const char* name; // ... }; extern "C" { Err ExgPut(ExgSocketType* socketP); UInt32 ExgSend(ExgSocketType* socketP, const void* bufP, UInt32 bufLen, Err* errP); Err ExgDisconnect(ExgSocketType* socketP, Err error); } bool BeamTextMemo(const char* title, const char* body, UInt32 bodyLen) { ExgSocketType socket = {}; socket.description = title; socket.name = "memo.txt"; socket.length = bodyLen; socket.target = 'memo'; // Memo Pad creator ID // Initiate the connection (system shows "Preparing to Beam..." dialog) Err err = ExgPut(&socket); if (err != 0) return false; // Stream the data chunks Err sendErr = 0; ExgSend(&socket, body, bodyLen, &sendErr); // Close the connection ExgDisconnect(&socket, sendErr); return sendErr == 0; } #+END_SRC ** Receiving Beamed Data When another device beams data with your application's Creator ID or MIME type: 1. The Palm OS launcher intercepts the beam and starts your application with launch code ~sysAppLaunchCmdExgReceiveData~. 2. In ~PilotMain~, you call ~ExgAccept(&socket)~ and stream the incoming bytes using ~ExgReceive(&socket, buf, maxLen, &err)~. * 2. The Serial Manager: Hardware Interfacing & BLE Bridges Classic Palm devices feature an RS-232 UART interface routed through the bottom dock connector. The *Serial Manager* (~SrmOpen~, ~SrmSend~, ~SrmReceive~) controls the UART hardware directly. ** Opening the Serial Port (e.g. for ESP32 BLE bridges) #+BEGIN_SRC cpp extern "C" { Err SrmOpen(UInt32 port, UInt32 baudRate, UInt16* portIdP); Err SrmClose(UInt16 portId); UInt32 SrmSend(UInt16 portId, const void* bufP, UInt32 count, Err* errP); UInt32 SrmReceive(UInt16 portId, void* bufP, UInt32 count, Int32 timeout, Err* errP); } class SerialConnection { UInt16 portId_ = 0; bool isOpen_ = false; public: bool Connect(UInt32 baudRate = 9600) { // sysFileCUart328 = 4-character creator for DragonBall UART UInt32 uartPort = 'u328'; Err err = SrmOpen(uartPort, baudRate, &portId_); isOpen_ = (err == 0); return isOpen_; } void Send(const char* msg, UInt32 len) { if (!isOpen_) return; Err err = 0; SrmSend(portId_, msg, len, &err); } UInt32 Read(char* buffer, UInt32 maxLen, Int32 timeoutTicks) { if (!isOpen_) return 0; Err err = 0; return SrmReceive(portId_, buffer, maxLen, timeoutTicks, &err); } ~SerialConnection() { if (isOpen_) { SrmClose(portId_); } } }; #+END_SRC This class provides instant serial connectivity to Arduino, ESP32, Raspberry Pi, or GPS units directly from your Palm C++ app! * 3. HotSync Conduits and Inter-Application Communication ** HotSync Conduits HotSync connects the handheld to a desktop host via USB or Serial: - *Desktop Conduits*: DLLs or shared libraries running on the desktop host that query the handheld's database using the Desktop Link Protocol (DLP). - Today, open-source tools like *Pilot-Link* (~pilot-xfer~, ~install-user~, ~read-todos~) provide full CLI conduits on modern Linux: #+BEGIN_SRC bash # Backup all databases from physical Palm to Linux host over USB/serial pilot-xfer -p /dev/ttyUSB0 -b ~/palm-backup/ # Install a PRC pilot-xfer -p /dev/ttyUSB0 -i Gpp14Modern.prc #+END_SRC ** Inter-Application Calls: ~SysAppLaunch~ On Palm OS, one application can invoke another application or query its data directly: #+BEGIN_SRC cpp extern "C" { Err SysAppLaunch(UInt16 cardNo, UInt32 dbID, UInt16 launchFlags, UInt16 cmd, void* cmdPBP, UInt32* resultP); } // Example: Ask the system Calculator to launch or compute a result void LaunchCalculator() { // Find Calculator database in storage heap UInt32 calcCreator = 'calc'; // Invoke with normal launch flags // ... } #+END_SRC #+LF * Further Reading & Reference Resources - **Communications & Exchange Manager:** - PalmSource Exchange Manager Documentation: https://palm.wiki/development/docs/601/PalmOSCompanion/ExchangeManager_Chapter.html - Infrared & IrDA Protocol Standards: http://www.irda.org - **Serial Programming & Hardware Projects:** - Palm Serial Manager Reference: https://palm.wiki/development/docs/601/PalmOSReference/SerialManager.html - Hardware Pinout Guide for Palm Universal and Dock Connectors: https://pinouts.ru/PDA/ - **Conduit Development & Pilot-Link:** - Pilot-Link Source Code & Linux HotSync Suite: https://github.com/jichu4n/pilot-link - Kenneth Albanowski: /Writing Palm OS Conduits in C and Perl/.