Refactoring of the App Tethering Communications in Seattle
Go Up to What's New in Seattle
The app tethering API responsible for communications between app tethering applications has undergone a refactoring to decouple protocols from the specifics of the transferred data, to simplify communications and to extend the functionality of the base class for profiles to make it easier for you to create your profile.
Protocols Transfer Data, Profiles Handle Data
In XE8, protocol classes were responsible for parsing the incoming data and building app tethering commands from the received data, to pass those commands to a profile class. In Seattle, protocol classes simply act as intermediaries to send and receive data streams, and profiles are responsible for serializing and unserializing app tethering commands.
The following table shows members that moved from protocol classes to profile classes:
XE8 | Seattle | ||
---|---|---|---|
Class | Member | Member | Class |
TTetheringProtocol | DoReceiveCommand | DoReceiveCommand | TTetheringProfile |
DoSendCommand | DoSendCommand | ||
ReadCommand | ReceiveCommand | ||
ReceiveCommand | |||
SendCommand | SendCommand | ||
SendCommandWithResponse | SendCommandWithResponse |
Incoming app tethering commands are no longer publicly exposed through events such as TTetheringProtocol.OnCommand
or TTetheringProfile.OnCommand
. Instead, profile classes must implement DoOnIncomingData to parse and handle incoming commands.
Protocol classes no longer provide the OnStreamReceived
and OnStringReceived
events. Use the equivalent events from profile classes instead: OnStreamReceived and OnStringReceived.
Profiles Handle Remote Profiles and Connections
The logic for handling remote profiles and connections has been moved from the application profile class to the profile base class so that you can use them in your custom profiles. As a result, TTetheringProfile has gained the following protected members that you can use when subclassing:
Other Changes
- The TransferStream method of protocol classes is now deprecated. It has been replaced by SendStream for a more consistent naming.
- TTetheringProtocol.SendStream calls DoSendStream, which you can override in your custom protocol classes.
- SendCommandWithResponse calls DoSendCommandWithResponse, which you can override in your custom profile classes.
- TTetheringCommand.ToBytes allows you to serialize a command as bytes encoded in UTF-8.
- Protocol classes have gained access to their profile through their new FProfile property.
- You can specify the command data in the constructor of an app tethering command.