public int lastReadValue = 0; //for Editor panel public Pin(UduinoDevice arduinoParent, int pin, PinMode mode) { Manager = UduinoManager.Instance; device = arduinoParent; currentPin = pin; pinMode = mode; }
public static UduinoConnection GetFinder(UduinoManager manager, Platform p, ConnectionMethod m) { UduinoConnection connection = null; #if UNITY_EDITOR || UNITY_STANDALONE //IF it's on the editor if (manager.activeExtentionsMap.ContainsValue(true)) { connection = new UduinoConnection_DesktopSerial(); } #elif UNITY_ANDROID //Get the Android Serial Plugin if (manager.ExtensionIsPresentAndActive("UduinoDevice_AndroidBluetoothLE")) { connection = new UduinoConnection_AndroidBluetoothLE(); } else if (manager.ExtensionIsPresentAndActive("UduinoDevice_AndroidSerial")) { connection = new UduinoConnection_AndroidSerial(); } else { Log.Error("Uduino for Android is not active ! Activate it in the Inspector Panel."); } #else #endif return(connection); }
public Pin(string arduinoParent, int pin, PinMode mode) { Manager = UduinoManager.Instance; arduinoName = arduinoParent; currentPin = pin; pinMode = mode; }
public static UduinoConnection GetFinder(UduinoManager manager, Platform p, ConnectionMethod m) { UduinoConnection connection = null; #if UNITY_ANDROID #if UNITY_EDITOR //IF it's on the editor UduinoExtension u; if (manager.AvailableExtensions["UduinoDevice_AndroidSerial"].isActive) { Log.Info("Uduino for Android Serial is active but you are in the editor. Switching platform."); } connection = new UduinoConnection_DesktopSerial(); #else //Get the Android Serial Plugin if (UduinoManager.Instance.AvailableExtensions["UduinoDevice_AndroidSerial"].isPresent) { if (UduinoManager.Instance.AvailableExtensions["UduinoDevice_AndroidSerial"].isActive) { connection = new UduinoConnection_AndroidSerial(); } else { Log.Error("Uduino for Android Serial is not active ! Activate it in the Inspector Panel"); } } else { Log.Error("Uduino for Android Serial is not present ! Are you sure it's imported in your project ?"); } #endif #else // default connection = new UduinoConnection_DesktopSerial(); #endif return(connection); }
public override void FindBoards(UduinoManager manager) { base.FindBoards(manager); #if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX Discover(GetUnixPortNames()); #else Discover(GetWindowsPortNames()); #endif }
/// <summary> /// Send OptimizedValue /// </summary> /// <param name="sendValue">Value to send</param> public void SendPinValue(int sendValue, string typeOfPin, string bundle = null) { if (sendValue != prevSendValue) { this.sendValue = sendValue; WriteMessage(UduinoManager.BuildMessageParameters(typeOfPin, currentPin, sendValue), bundle); prevSendValue = sendValue; } }
/// <summary> /// Change Pin mode /// </summary> /// <param name="mode">Mode</param> public void ChangePinMode(PinMode mode, string bundle = null) { if (!isInit || mode != pinMode) { pinMode = mode; WriteMessage(UduinoManager.BuildMessageParameters("s", currentPin, (int)pinMode), bundle); isInit = true; } }
public void Destroy() { if (pinMode == PinMode.Output) { WriteMessage(UduinoManager.BuildMessageParameters("d", currentPin, 0), "destroy"); } else if (pinMode == PinMode.PWM || pinMode == PinMode.Input) { WriteMessage(UduinoManager.BuildMessageParameters("a", currentPin, 0), "destroy"); } }
public int lastReadValue = 0; //for Editor panel public Pin(UduinoDevice arduinoParent, int pin, PinMode mode) { Manager = UduinoManager.Instance; device = arduinoParent; currentPin = pin; pinMode = mode; if (device != null) { arduinoName = device.name; } }
public static UduinoConnection GetFinder(UduinoManager manager, Platform p, ConnectionMethod m) { UduinoConnection connection = null; #if UNITY_EDITOR || UNITY_STANDALONE //IF it's on the editor if (manager.activeExtentionsMap.ContainsValue(true)) { if (manager.ExtensionIsPresentAndActive("UduinoDevice_DesktopBluetoothLE")) { connection = System.Reflection.Assembly.GetExecutingAssembly().CreateInstance("Uduino.UduinoConnection_DesktopBluetoothLE") as UduinoConnection; } else if (manager.ExtensionIsPresentAndActive("UduinoDevice_Wifi")) { connection = System.Reflection.Assembly.GetExecutingAssembly().CreateInstance("Uduino.UduinoConnection_Wifi") as UduinoConnection; } else { connection = new UduinoConnection_DesktopSerial(); } } else { #if UNITY_EDITOR Log.Warning("No build platform selected"); return(null); #else return(connection = new UduinoConnection_DesktopSerial()); // Fix for Build #endif } #elif UNITY_ANDROID //Get the Android Serial Plugin if (manager.ExtensionIsPresentAndActive("UduinoDevice_AndroidBluetoothLE")) { connection = new UduinoConnection_AndroidBluetoothLE(); } else if (manager.ExtensionIsPresentAndActive("UduinoDevice_AndroidSerial")) { connection = new UduinoConnection_AndroidSerial(); } else if (manager.ExtensionIsPresentAndActive("UduinoDevice_Wifi")) { connection = new UduinoConnection_Wifi(); } else { Log.Error("Uduino for Android is not active ! Activate it in the Inspector Panel."); } #endif Log.Debug("Starting Uduino with type: " + connection.GetType()); return(connection); }
/// <summary> /// Send OptimizedValue /// </summary> /// <param name="sendValue">Value to send</param> public virtual int SendRead(string bundle = null, System.Action <string> action = null, bool digital = false) { string cmd = "r" + (digital ? "d" : ""); if (bundle != null) { cmd = "br"; } string valueAsString = Manager.Read(device, UduinoManager.BuildMessageParameters(cmd, currentPin), action: action, bundle: bundle); int returnedValue = ParseIntValue(valueAsString); if (returnedValue != -1) { lastReadValue = returnedValue; } return(lastReadValue); }
public static UduinoConnection GetFinder(UduinoManager manager, Platform p, ConnectionMethod m) { UduinoConnection connection = null; #if UNITY_EDITOR || UNITY_STANDALONE //IF it's on the editor if (manager.activeExtentionsMap.ContainsValue(true)) { if (manager.ExtensionIsPresentAndActive("UduinoDevice_DesktopBluetoothLE")) { connection = System.Reflection.Assembly.GetExecutingAssembly().CreateInstance("Uduino.UduinoConnection_DesktopBluetoothLE") as UduinoConnection; } else if (manager.ExtensionIsPresentAndActive("UduinoDevice_Wifi")) { connection = System.Reflection.Assembly.GetExecutingAssembly().CreateInstance("Uduino.UduinoConnection_Wifi") as UduinoConnection; } else { connection = new UduinoConnection_DesktopSerial(); } } else { return(null); } #elif UNITY_ANDROID //Get the Android Serial Plugin if (manager.ExtensionIsPresentAndActive("UduinoDevice_AndroidBluetoothLE")) { connection = new UduinoConnection_AndroidBluetoothLE(); } else if (manager.ExtensionIsPresentAndActive("UduinoDevice_AndroidSerial")) { connection = new UduinoConnection_AndroidSerial(); } else if (manager.ExtensionIsPresentAndActive("UduinoDevice_Wifi")) { connection = new UduinoConnection_Wifi(); } }
public virtual void FindBoards(UduinoManager manager) { _manager = manager; }
public UduinoConnection(UduinoManager manager = null) { _manager = manager; }
public virtual void FindBoards(UduinoManager manager) { _manager = manager; Interface.Instance.SetConnection(this); }
public override void FindBoards(UduinoManager manager) { base.FindBoards(manager); Discover(); }