コード例 #1
0
        public int lastReadValue = 0; //for Editor panel

        public Pin(UduinoDevice arduinoParent, int pin, PinMode mode)
        {
            Manager    = UduinoManager.Instance;
            device     = arduinoParent;
            currentPin = pin;
            pinMode    = mode;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: UduinoPin.cs プロジェクト: tanujasawant/tactibits
 public Pin(string arduinoParent, int pin, PinMode mode)
 {
     Manager     = UduinoManager.Instance;
     arduinoName = arduinoParent;
     currentPin  = pin;
     pinMode     = mode;
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        public override void FindBoards(UduinoManager manager)
        {
            base.FindBoards(manager);
#if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
            Discover(GetUnixPortNames());
#else
            Discover(GetWindowsPortNames());
#endif
        }
コード例 #6
0
 /// <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;
     }
 }
コード例 #7
0
 /// <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;
     }
 }
コード例 #8
0
 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");
     }
 }
コード例 #9
0
ファイル: UduinoPin.cs プロジェクト: N-Capelier/Duality
        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;
            }
        }
コード例 #10
0
        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);
        }
コード例 #11
0
ファイル: UduinoPin.cs プロジェクト: N-Capelier/Duality
        /// <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);
        }
コード例 #12
0
        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();
            }
        }
コード例 #13
0
 public virtual void FindBoards(UduinoManager manager)
 {
     _manager = manager;
 }
コード例 #14
0
 public UduinoConnection(UduinoManager manager = null)
 {
     _manager = manager;
 }
コード例 #15
0
 public virtual void FindBoards(UduinoManager manager)
 {
     _manager = manager;
     Interface.Instance.SetConnection(this);
 }
コード例 #16
0
ファイル: UduinoConnection_Wifi.cs プロジェクト: fjwntut/Qun
 public override void FindBoards(UduinoManager manager)
 {
     base.FindBoards(manager);
     Discover();
 }