System.Tether.AppProfile.TTetheringAppProfile.SubscribeToRemoteItem

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function SubscribeToRemoteItem(const AProfile: TTetheringProfileInfo; const ARemoteItem: TCustomRemoteItem): Boolean; overload;
function SubscribeToRemoteItem(const AProfile: TTetheringProfileInfo; const ARemoteItemName: string): Boolean; overload;

C++

bool __fastcall SubscribeToRemoteItem(const System::Tether::Manager::TTetheringProfileInfo &AProfile, TCustomRemoteItem* const ARemoteItem)/* overload */;
bool __fastcall SubscribeToRemoteItem(const System::Tether::Manager::TTetheringProfileInfo &AProfile, const System::UnicodeString ARemoteItemName)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.Tether.AppProfile.pas
System.Tether.AppProfile.hpp
System.Tether.AppProfile TTetheringAppProfile

Description

Subscribes this application profile to the specified remote resource of the specified remote profile for updates.

You can specify a remote resource to subscribe with either of the following sets of parameters:

  • Provide the remote application profile that contains the remote resource as an instance of TTetheringProfileInfo and the name of the remote resource.
The RemoteProfiles property of your TTetheringManager component provides a list of remote application profiles that are connected to your profile.
  • Provide the remote application profile that contains the remote resource as an instance of TTetheringProfileInfo and an instance of TCustomRemoteItem.
Your TTetheringAppProfile component provides a method, GetRemoteProfileActions, that returns a list of remote resources shared by a given remote application profile specified as an instance of TTetheringProfileInfo.

When the value of a remote resource with the same name as the instance of TCustomRemoteItem that you subscribed changes, the value of the subscribed instance of TCustomRemoteItem is updated, and the OnResourceUpdated event occurs.

Notes:
  • To read the value from the subscribed instance of TCustomRemoteItem, you must cast this instance as TRemoteResource and read its data. See Reading an Incoming Remote Resource.
  • When a remote resource that wraps a stream changes, the OnResourceUpdated event occurs, but the value of the subscribed instance of TCustomRemoteItem is not updated. You must request the new resource value manually. See Requesting Remote Resources.
  • The OnResourceUpdated event does not occur if you subscribe to the same remote resource using a local resource.

Exceptions

A call to SubscribeToRemoteItem may raise any of the following exceptions:

Exception Exception.Message Scenarios

ETetheringException

No available connections to <profile identifier>

Can't connect to profile <profile identifier>

See Also