I am using this code MODIFIED from
I am using this code MODIFIED from
http://otapi.com/2014/11/09/app-tethering-part-2-resources-and-a-license-duplication-check-demo/
but TetherProfSL.Connect(ARemoteProfiles[I]) is always false.
Can someone explain?
Thanks. Dan'l
procedure TdmDataXFer.TetherManSLEndProfilesDiscovery(const Sender: TObject;
const ARemoteProfiles: TTetheringProfileInfoList);
var
i,j: integer;
begin
L(Format('Profile Discovery Complete, found %d Remote Profiles',
[ARemoteProfiles.Count]));
// Iterate all discovered Remote Profiles
for I := 0 to ARemoteProfiles.Count - 1 do
begin
// Log information about the Remote Manager
L(Format('Discovered Remote Profile %d - %s' + #13#10 +
#9 + 'Manager Text: %s' + #13#10 +
#9 + 'Profile ID: %s',
[I,
ARemoteProfiles[I].ManagerIdentifier,
ARemoteProfiles[I].ProfileText,
ARemoteProfiles[I].ProfileIdentifier]));
// Check if the Remote Profile's "Text" value matches our Local Profile's
if ARemoteProfiles[I].ProfileText = TetherProfSL.Text then
begin
// If we have a match, check to ensure it's not our LOCAL profile
if ARemoteProfiles[I].ProfileIdentifier <> TetherProfSL.Identifier then
begin
// If it's not our LOCAL profile, connect with the Remote Profile
IsProfileConnected := False;
try
if TetherProfSL.Connect(ARemoteProfiles[I]) then
begin
IsProfileConnected := True;
l('Connected to remote profile ' + ARemoteProfiles[i].ProfileText);
end else
begin
L(Format('Unable to connect to Remote Profile %s',
[ARemoteProfiles[I].ProfileIdentifier]));
end;
except
on E: Exception do
begin
L(e.Message);
ShowMessage(e.Message);
end;
end;
end;
end;
end;
end;
http://otapi.com/2014/11/09/app-tethering-part-2-resources-and-a-license-duplication-check-demo/
but TetherProfSL.Connect(ARemoteProfiles[I]) is always false.
Can someone explain?
Thanks. Dan'l
procedure TdmDataXFer.TetherManSLEndProfilesDiscovery(const Sender: TObject;
const ARemoteProfiles: TTetheringProfileInfoList);
var
i,j: integer;
begin
L(Format('Profile Discovery Complete, found %d Remote Profiles',
[ARemoteProfiles.Count]));
// Iterate all discovered Remote Profiles
for I := 0 to ARemoteProfiles.Count - 1 do
begin
// Log information about the Remote Manager
L(Format('Discovered Remote Profile %d - %s' + #13#10 +
#9 + 'Manager Text: %s' + #13#10 +
#9 + 'Profile ID: %s',
[I,
ARemoteProfiles[I].ManagerIdentifier,
ARemoteProfiles[I].ProfileText,
ARemoteProfiles[I].ProfileIdentifier]));
// Check if the Remote Profile's "Text" value matches our Local Profile's
if ARemoteProfiles[I].ProfileText = TetherProfSL.Text then
begin
// If we have a match, check to ensure it's not our LOCAL profile
if ARemoteProfiles[I].ProfileIdentifier <> TetherProfSL.Identifier then
begin
// If it's not our LOCAL profile, connect with the Remote Profile
IsProfileConnected := False;
try
if TetherProfSL.Connect(ARemoteProfiles[I]) then
begin
IsProfileConnected := True;
l('Connected to remote profile ' + ARemoteProfiles[i].ProfileText);
end else
begin
L(Format('Unable to connect to Remote Profile %s',
[ARemoteProfiles[I].ProfileIdentifier]));
end;
except
on E: Exception do
begin
L(e.Message);
ShowMessage(e.Message);
end;
end;
end;
end;
end;
end;
Network AND Wifi ?
ReplyDeleteYes, it pairs with the RP but will not Connect.
ReplyDeleteUsing RunRemoteAction results in "Can't find profile for action". I have verified that the action exists.
Dan Statham "only network and WiFi" means you have two network interfaces. Lots of code fails to support that properly, so I wouldn't be surprised if app tethering fails on that especially since that code area has had other rookie mistakes in the past. Writing proper network code is like writing proper threading code: the first few tries always fail in the real world.
ReplyDelete