Ejemplo n.º 1
0
void
BluetoothProfileController::GiveupAndContinue()
{
  MOZ_ASSERT(!mCurrentProfileFinished);
  MOZ_ASSERT(mProfilesIndex < (int)mProfiles.Length());

  BT_LOGR_PROFILE(mProfiles[mProfilesIndex], ERR_OPERATION_TIMEOUT);
  mProfiles[mProfilesIndex]->Reset();

  if (IsBtServiceAvailable()) {
    Next();
  } else {
    EndSession();
  }
}
Ejemplo n.º 2
0
void
BluetoothProfileController::OnDisconnect(const nsAString& aErrorStr)
{
    MOZ_ASSERT(NS_IsMainThread());
    BT_LOGR_PROFILE(mProfiles[mProfilesIndex], "<%s>",
                    NS_ConvertUTF16toUTF8(aErrorStr).get());

    if (!aErrorStr.IsEmpty()) {
        BT_WARNING(NS_ConvertUTF16toUTF8(aErrorStr).get());
    } else {
        mSuccess = true;
    }

    Next();
}
void
BluetoothProfileController::Start()
{
    MOZ_ASSERT(NS_IsMainThread());
    MOZ_ASSERT(!mDeviceAddress.IsEmpty());
    MOZ_ASSERT(mProfilesIndex == -1);

    ++mProfilesIndex;
    BT_LOGR_PROFILE(mProfiles[mProfilesIndex], "");

    if (mConnect) {
        mProfiles[mProfilesIndex]->Connect(mDeviceAddress, this);
    } else {
        mProfiles[mProfilesIndex]->Disconnect(this);
    }
}
Ejemplo n.º 4
0
void
BluetoothProfileController::NotifyCompletion(const nsAString& aErrorStr)
{
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(mTimer);
  MOZ_ASSERT(mProfiles.Length() > 0);

  BT_LOGR_PROFILE(mProfiles[mProfilesIndex], "<%s>",
                  NS_ConvertUTF16toUTF8(aErrorStr).get());

  mCurrentProfileFinished = true;

  if (mTimer) {
    mTimer->Cancel();
  }

  mSuccess |= aErrorStr.IsEmpty();

  Next();
}