using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using SmartBowSDK;
using UnityEngine.UI;

public class SimpleDemo : MonoBehaviour
{
    [SerializeField] Toggle _DetectingMacToggle1;
    SmartBowHelper smartBowHelper1;
    //数据存储标识
    string userTags = "test";
    // Start is called before the first frame update
    void Start()
    {
        smartBowHelper1 = SmartBowHelper.NewInstance();

        Init(smartBowHelper1, GameObject.Find("A").GetComponent<Bow>());

        SmartBowLogger.isDebug = true;

        //BleWinHelper.RegisterTo(this.gameObject);

        if (BluetoothWindows.IsWindows())
            BleWinHelper.RegisterTo(smartBowHelper1.gameObject, smartBowHelper1.CreateBluetoothWindows());
    }

    void Init(SmartBowHelper smartBowHelper, Bow bow)
    {
        new SmartBowHandler(smartBowHelper, bow);
    }
    int deviceId = 1;
    public void Connect1()
    {
        //默认需要检测mac，bRecreateDeviceInfo:false.如不需要：设置bRecreateDeviceInfo:true;
        bool bRecreateDeviceInfo = _DetectingMacToggle1.isOn ? false : true;
        smartBowHelper1.Connect(userTags, deviceId, bRecreateDeviceInfo);
    }
    public void ClearDeviceInfo1()
    {
        smartBowHelper1.ClearDeviceInfo(userTags, deviceId);
    }

    public void ClearAllDeviceInfo()
    {
        ClearDeviceInfo1();
    }
    public void getAllDeviceInfo()
    {
        AimDeviceInfo aimDeviceInfo1 = smartBowHelper1.GetDeviceInfo(userTags, deviceId);
        Debug.Log("设备1：" + JsonUtility.ToJson(aimDeviceInfo1));

    }
}
