Exemple #1
0
    // Use this for initialization
    void Start()
    {
        blueToothPlugin = BlueToothPlugin.GetInstance();
        blueToothPlugin.SetDebug(0);
        blueToothPlugin.Init();

        blueToothPlugin.SetConnectionCallbackListener(
            OnConnected
            , OnConnecting
            , OnNotConnected
            , OnConnectionFailed
            , OnConnectionLost
            , OnConnectToDevice
            );

        blueToothPlugin.SetDataCallbackListener(OnRecievedMessage, OnSentMessage, OnLogMessage);

        bool isEnable = blueToothPlugin.CheckBlueTooth();

        Debug.Log("[BlueToothDemo] isBlueToothEnable: " + isEnable);

        if (!isEnable)
        {
            blueToothPlugin.EnsureDiscoverable();
        }
        else
        {
            blueToothPlugin.InitServer();
        }
    }
Exemple #2
0
    public void CheckBlueTooth()
    {
        bool isEnable = blueToothPlugin.CheckBlueTooth();

        if (blueEnableText != null)
        {
            blueEnableText.text = string.Format("IsBlueToothEnable: {0}", isEnable);
        }

        if (isEnable)
        {
            notifyButton.interactable = false;
        }
        else
        {
            notifyButton.interactable = true;
        }
    }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        blueToothPlugin = BlueToothPlugin.GetInstance();
        blueToothPlugin.SetDebug(0);
        blueToothPlugin.Init();

        blueToothPlugin.SetConnectionCallbackListener(
            OnConnected
            ,OnConnecting
            ,OnNotConnected
            ,OnConnectionFailed
            ,OnConnectionLost
            ,OnConnectToDevice
            );

        blueToothPlugin.SetDataCallbackListener(OnRecievedMessage,OnSentMessage,OnLogMessage);

        bool isEnable = blueToothPlugin.CheckBlueTooth();
        Debug.Log("[BlueToothDemo] isBlueToothEnable: " + isEnable);

        if(!isEnable){
            blueToothPlugin.EnsureDiscoverable();
        }else{
            blueToothPlugin.InitServer();
        }
    }