Refactoring of the App Tethering Communications in 1.17

From Appmethod Topics
Jump to: navigation, search

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:

1.16 1.17
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