removed unused bindings, made constants constant

main
Jonas Arnold 4 years ago
parent dd44445d9b
commit 28c4eceb53
  1. 8
      ADIS_Csharp/RaspiControl/AppState.cs
  2. 5
      ADIS_Csharp/RaspiControl/Joystick.cs
  3. 10
      ADIS_Csharp/RaspiControl/JoystickButton.cs
  4. 22
      ADIS_Csharp/RaspiControl/MqttConstants.cs
  5. 20
      ADIS_Csharp/RaspiControl/NavigationConstants.cs
  6. 9
      ADIS_Csharp/RaspiControl/Program.cs

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RaspiControl {
namespace RaspiControl {
public enum APP_STATE {
STARTUP = 0,
INIT = 1,

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading;
using Unosquare.RaspberryIO;
using Unosquare.RaspberryIO;
using Unosquare.RaspberryIO.Abstractions;
using Unosquare.WiringPi;

@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RaspiControl {
namespace RaspiControl {
public enum JoystickButton {
None = 0,
Left = 1,
@ -14,5 +7,4 @@ namespace RaspiControl {
Down = 8,
Center = 16
}
}

@ -1,21 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RaspiControl {
internal static class MqttConstants {
namespace RaspiControl {
public static class MqttConstants {
#region Publish
public static string MOBILE_NAV_TURN_TOPIC = "/mobile/cmd/nav/turn/";
public static string MOBILE_NAV_MOVE_TOPIC = "/mobile/cmd/nav/move/";
public static string MOBILE_NAV_STOP_TOPIC = "/mobile/cmd/nav/stop/";
public static string SPLITFLAP_DISPLAY = "/splitFlap/cmd/display/";
public static string SPLITFLAP_INIT = "/splitFlap/cmd/init/";
public const string MOBILE_NAV_TURN_TOPIC = "/mobile/cmd/nav/turn/";
public const string MOBILE_NAV_MOVE_TOPIC = "/mobile/cmd/nav/move/";
public const string MOBILE_NAV_STOP_TOPIC = "/mobile/cmd/nav/stop/";
public const string SPLITFLAP_DISPLAY_TOPIC = "/splitFlap/cmd/display/";
public const string SPLITFLAP_INIT_TOPIC = "/splitFlap/cmd/init/";
#endregion
#region subscribe
public static string DEVICE_STATUS_APP_TOPIC = "/device/status/+/app";
public const string DEVICE_STATUS_APP_TOPIC = "/device/status/+/app";
#endregion
}
}

@ -1,15 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RaspiControl {
internal static class NavigationConstants {
public static int TURN_ANGLE_LEFT = -10;
public static int TURN_ANGLE_RIGHT = 10;
public static int SPEED_FORWARD = 100;
public static int SPEED_BACKWARD = -100;
public static bool STOP = true;
namespace RaspiControl {
public static class NavigationConstants {
public const int TURN_ANGLE_LEFT = -10;
public const int TURN_ANGLE_RIGHT = 10;
public const int SPEED_FORWARD = 100;
public const int SPEED_BACKWARD = -100;
public const bool STOP = true;
}
}

@ -1,10 +1,7 @@
using System;
using System.Text;
using System.Text;
using M2Mqtt;
using M2Mqtt.Messages;
using System.Text.Json;
using System.Linq;
using System.Runtime.CompilerServices;
namespace RaspiControl {
class Programm {
@ -49,7 +46,7 @@ namespace RaspiControl {
private static void PublishSplitFlapDisplay(string message) {
string payload = JsonSerializer.Serialize<Dictionary<string, string>>(new Dictionary<string, string>() { { "message", message } });
client.Publish(MqttConstants.SPLITFLAP_DISPLAY, Encoding.UTF8.GetBytes(payload),MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE,false);
client.Publish(MqttConstants.SPLITFLAP_DISPLAY_TOPIC, Encoding.UTF8.GetBytes(payload),MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE,false);
}
private static void Client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e) {
string deviceId = "";
@ -67,7 +64,7 @@ namespace RaspiControl {
switch (appState) {
case APP_STATE.STARTUP:
Console.WriteLine("Startup");
client.Publish(MqttConstants.SPLITFLAP_INIT, new byte[] { }, MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, false);
client.Publish(MqttConstants.SPLITFLAP_INIT_TOPIC, new byte[] { }, MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, false);
break;
case APP_STATE.INIT:
Console.WriteLine("Init");

Loading…
Cancel
Save