Pending changes

This commit is contained in:
Adrian Rumpold
2017-12-21 09:48:11 +01:00
parent d428d46f8d
commit 0f3ce17384
7 changed files with 24 additions and 10 deletions

View File

@@ -90,7 +90,7 @@ public class AgcPacket {
return dataCode;
}
public int getIoPort() {
public int getIoChannel() {
return ioPort;
}

View File

@@ -13,9 +13,10 @@ import de.rumpold.androiddsky.DSKY;
/**
* Created by Adriano on 17.05.2016.
*/
@SuppressWarnings("OctalInteger")
public class YaAgcClient {
private static final String YAAGC_HOST = "192.168.178.67";
private static final int YAAGC_SERVER_PORT = 19698;
private static final String YAAGC_HOST = "192.168.178.29";
private static final int YAAGC_SERVER_PORT = 19697;
private static final String TAG = YaAgcClient.class.getSimpleName();
private static final int KEYBOARD_CHANNEL = 015;
@@ -69,10 +70,13 @@ public class YaAgcClient {
public void connect() throws IOException {
agcChannel = SocketChannel.open();
agcChannel.connect(new InetSocketAddress(YAAGC_HOST, YAAGC_SERVER_PORT));
boolean success = agcChannel.connect(new InetSocketAddress(YAAGC_HOST, YAAGC_SERVER_PORT));
handler = new Thread(new DSKYHandler(), "DSKY I/O Handler");
handler.start();
if (success) {
Log.i(TAG, "connect: Successfully connected, starting DSKY I/O handler");
handler = new Thread(new DSKYHandler(), "DSKY I/O Handler");
handler.start();
}
}
public void disconnect() throws IOException {
@@ -150,7 +154,7 @@ public class YaAgcClient {
return;
}
switch (packet.getIoPort()) {
switch (packet.getIoChannel()) {
case 010:
handleChannel10(packet);
break;
@@ -158,6 +162,9 @@ public class YaAgcClient {
case 011:
handleChannel11(packet);
break;
default:
return;
}
// Update register sign indicator displays

View File

@@ -29,6 +29,7 @@ public class DSKYActivity extends AppCompatActivity {
private int rightActiveColor;
private int activeColor;
private int passiveColor;
private int compActyColor;
public void updateIndicator(@IdRes final int id, final boolean state) {
mViewHandler.post(new Runnable() {
@@ -43,6 +44,8 @@ public class DSKYActivity extends AppCompatActivity {
final int color;
if ("right".equals(indicator.getTag())) {
color = rightActiveColor;
} else if ("comp acty".equals(indicator.getTag())) {
color = compActyColor;
} else {
color = activeColor;
}
@@ -74,6 +77,7 @@ public class DSKYActivity extends AppCompatActivity {
rightActiveColor = getResources().getColor(R.color.indicatorRightActive);
activeColor = getResources().getColor(R.color.indicatorActive);
passiveColor = getResources().getColor(R.color.indicatorPassive);
compActyColor = getResources().getColor(R.color.compActy);
createButtonListeners();
}