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();
}

View File

@@ -14,6 +14,7 @@
android:width="96dp"
android:height="96dp"
android:text="@string/comp_acty"
android:tag="comp acty"
android:textAppearance="?android:attr/textAppearanceLarge" />
<LinearLayout

View File

@@ -4,8 +4,10 @@
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="segmentActive">#78e143</color>
<color name="compActy">@color/segmentActive</color>
<color name="indicatorPassive">#e0e0e0</color>
<color name="indicatorActive">#78e143</color>
<color name="indicatorActive">#ffffff</color>
<color name="indicatorRightActive">#ffd35c</color>
<color name="black_overlay">#66000000</color>

View File

@@ -68,7 +68,7 @@
<item name="android:layout_height">wrap_content</item>
<item name="android:fontFamily">monospace</item>
<item name="android:textSize">64sp</item>
<item name="android:textColor">@color/indicatorActive</item>
<item name="android:textColor">@color/segmentActive</item>
<item name="android:layout_gravity">center_horizontal</item>
</style>
</resources>