public void packageTerminateAckTest() { PackageTerminate pkgt = new PackageTerminate(0); byte [] bs = pkgt.getAckMessage(); PackageTerminate pkgtRec = new PackageTerminate(PackageBase.getMessageFromAck(bs)); Assert.AreEqual(EnPackageType.TERMINATE, pkgtRec.type); Assert.AreEqual(0, pkgtRec.terminateSignal); }
/// <summary> /// Handles the bluetooth messages recived (only terminate packages will be accepted) [only slaves]. /// </summary> /// <param name="pkg">Package.</param> private void terminateHandle(PackageBase pkg) { if (pkg == EnPackageType.TERMINATE) { PackageTerminate pkgt = (PackageTerminate)pkg; Board.Instance.Reset(); Intent serverIntent = new Intent(this, typeof(MainActivity)); if (pkgt.terminateSignal == 0) { serverIntent.PutExtra("NewGame", 0); } else if (pkgt.terminateSignal == 1) { serverIntent.PutExtra("NewGame", 1); } BTManager.Instance.eventPackageReceived -= terminateHandle; BTManager.Instance.eventLocalMessageReceived -= handleLocalMessage; StartActivityForResult(serverIntent, 2); } }