// デバイスをスキャンして接続 public void Connecting(string Address, BLEMgr.Callback Success, BLEMgr.Callback Error, BLEMgr.Callback DisConnectCallback) { m_ConnectSuccess = Success; m_ConnectError = Error; m_DisConnectCallback = DisConnectCallback; m_Mode = eMode.Connecting; m_API.connectBtDevice(Address, () => { m_Mode = eMode.InitSetting; StartCoroutine(InitSetting()); m_API.setCommStsChangedEventHandler(onCommStsChanged); }, () => { m_Mode = eMode.ConnectError; if (m_ConnectError != null) { m_ConnectError(); } m_ConnectSuccess = null; m_ConnectError = null; }); m_connectAddress = Address; }
public void Scan(BLEMgr.Callback Success, BLEMgr.Callback Error) { m_Mode = eMode.Scan; m_ScanSuccess = Success; m_ScanError = Error; m_API.scanBtDevice(() => { m_Mode = eMode.ScanOK; if (m_ScanSuccess != null) { m_ScanSuccess(); } m_ScanSuccess = null; m_ScanError = null; }, () => { m_Mode = eMode.ScanError; if (m_ScanError != null) { m_ScanError(); } m_ScanSuccess = null; m_ScanError = null; }); }
IEnumerator InitSetting() { yield return(new WaitForSeconds(SettingWait)); // 初期化コマンド群 Hot2gApplication.Instance.API.getDeviceInfo(Hot2gEnumerations.EnumHot2gDevInfo.DevId); yield return(new WaitForSeconds(SettingWait)); /**/ Hot2gApplication.Instance.API.setMotionAccRange(Hot2gEnumerations.EnumHot2gAccRange.e16G); yield return(new WaitForSeconds(SettingWait)); Hot2gApplication.Instance.API.getHot2gIf().UpdateReport86(); Hot2gApplication.Instance.API.setMotionGyroRange(Hot2gEnumerations.EnumHot2gGyroRange.e2000DPS); yield return(new WaitForSeconds(SettingWait)); Hot2gApplication.Instance.API.getHot2gIf().UpdateReport87(); Hot2gApplication.Instance.API.setMotionSamplingInfo_1(Hot2gEnumerations.EnumHot2gMotSmplRate.e10HZ, Hot2gEnumerations.EnumHot2gMotTransRate.e10HZ); yield return(new WaitForSeconds(SettingWait)); Hot2gApplication.Instance.API.getHot2gIf().UpdateReport89(); Hot2gApplication.Instance.API.setMotionSamplingInfo_2(Hot2gEnumerations.EnumHot2gMotSmplRate.e10HZ, Hot2gEnumerations.EnumHot2gMotTransRate.e10HZ); yield return(new WaitForSeconds(SettingWait)); Hot2gApplication.Instance.API.getHot2gIf().UpdateReport8A(); Hot2gApplication.Instance.API.setHRSamplingInfo(Hot2gEnumerations.EnumHot2gHRTransRate.e10HZ); yield return(new WaitForSeconds(SettingWait)); Hot2gApplication.Instance.API.getHot2gIf().UpdateReport8A(); Hot2gApplication.Instance.API.setUsbRTOutputMode(false); yield return(new WaitForSeconds(SettingWait)); Hot2gApplication.Instance.API.getHot2gIf().UpdateReport8C(); Hot2gApplication.Instance.API.getHot2gIf().UpdateReport86(); //Hot2gApplication.Instance.API.setBatterySamplingInfo(Hot2gEnumerations.EnumHot2gBattTransRate.e1HZ); //Hot2gApplication.Instance.API.set Hot2gApplication.Instance.API.getHot2gIf().UpdateReport81(); /**/ if (m_Mode == eMode.InitSetting) { m_Mode = eMode.Waiting; //m_Mode = eMode.Connecting; if (m_ConnectSuccess != null) { m_ConnectSuccess(); } m_ConnectSuccess = null; m_ConnectError = null; } }