Refactoring of the App Tethering Communications in 1.17
Go Up to What's New
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 1.16, 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 1.17, 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:
Incoming app tethering commands are no longer publicly exposed through events such as
TTetheringProfile.OnCommand. Instead, profile classes must implement DoOnIncomingData to parse and handle incoming commands.
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:
- 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.