Skip to content

Commit a1ea4f5

Browse files
committed
Fixing comms on UWP and others
1 parent 16125a9 commit a1ea4f5

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

Software/OATMobile/OATCommunications/CommunicationHandlers/TcpCommunicationHandler.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class TcpCommunicationHandler : ICommunicationHandler {
1414
public TcpCommunicationHandler(IPAddress ip, int port) {
1515
_ip = ip;
1616
_port = port;
17-
_client = new TcpClient(new IPEndPoint(IPAddress.Any, _port));
17+
_client = new TcpClient();
1818
}
1919

2020
public async Task<CommandResponse> SendBlind(string command) {
@@ -27,8 +27,13 @@ public async Task<CommandResponse> SendCommand(string command) {
2727

2828
private async Task<CommandResponse> SendCommand(string command, bool needsResponse) {
2929
if (!_client.Connected) {
30-
_client = new TcpClient(new IPEndPoint(IPAddress.Any, _port));
31-
_client.Connect(_ip, _port);
30+
try {
31+
_client = new TcpClient();
32+
_client.Connect(_ip, _port);
33+
}
34+
catch (Exception e) {
35+
Debug.WriteLine($"Failed To connect or create client: \n{e.Message}");
36+
}
3237
}
3338

3439
_client.ReceiveTimeout = 1000;

Software/OATMobile/OATMobile/OATMobile.UWP/Package.appxmanifest

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,8 @@
5151

5252
<Capabilities>
5353
<Capability Name="internetClient" />
54+
<Capability Name="privateNetworkClientServer"/>
55+
<Capability Name="internetClientServer"/>
56+
<DeviceCapability Name="location"/>
5457
</Capabilities>
5558
</Package>

Software/OATMobile/OATMobile/OATMobile/ViewModels/MountSettingsViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class MountSettingsViewModel : BaseViewModel
2626

2727
public MountSettingsViewModel()
2828
{
29-
_cmdHandler = new OatmealTelescopeCommandHandlers(new TcpCommunicationHandler(new IPAddress(new byte[] { 192, 168, 86, 250 }), 4030));
29+
_cmdHandler = new OatmealTelescopeCommandHandlers(new TcpCommunicationHandler(new IPAddress(new byte[] { 192, 168, 86, 249 }), 4030));
3030
Title = "Mount Settings";
3131
Items = new ObservableCollection<Item>();
3232
LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommand());

0 commit comments

Comments
 (0)