Beispiel #1
0
void
Volume::SetState(Volume::STATE aNewState)
{
  MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
  MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
  if (aNewState == mState) {
    return;
  }
  if (aNewState == nsIVolume::STATE_MOUNTED) {
    mMountGeneration = ++sMountGeneration;
    LOG("Volume %s (%u): changing state from %s to %s @ '%s' (%d observers) "
        "mountGeneration = %d, locked = %d",
        NameStr(), mId, StateStr(mState),
        StateStr(aNewState), mMountPoint.get(), mEventObserverList.Length(),
        mMountGeneration, (int)mMountLocked);
  } else {
    LOG("Volume %s (%u): changing state from %s to %s (%d observers)",
        NameStr(), mId, StateStr(mState),
        StateStr(aNewState), mEventObserverList.Length());
  }

  switch (aNewState) {
     case nsIVolume::STATE_NOMEDIA:
       // Cover the startup case where we don't get insertion/removal events
       mMediaPresent = false;
       mIsSharing = false;
       mUnmountRequested = false;
       mMountRequested = false;
       break;

     case nsIVolume::STATE_MOUNTED:
       mMountRequested = false;
       mIsFormatting = false;
       mIsSharing = false;
       break;
     case nsIVolume::STATE_FORMATTING:
       mFormatRequested = false;
       mIsFormatting = true;
       mIsSharing = false;
       break;

     case nsIVolume::STATE_SHARED:
     case nsIVolume::STATE_SHAREDMNT:
       // Covers startup cases. Normally, mIsSharing would be set to true
       // when we issue the command to initiate the sharing process, but
       // it's conceivable that a volume could already be in a shared state
       // when b2g starts.
       mIsSharing = true;
       break;

     case nsIVolume::STATE_IDLE:
       break;
     default:
       break;
  }
  mState = aNewState;
  mEventObserverList.Broadcast(this);
}
Beispiel #2
0
//static
void
VolumeManager::SetState(STATE aNewState)
{
  if (mState != aNewState) {
    LOG("changing state from '%s' to '%s'",
        StateStr(mState), StateStr(aNewState));
    mState = aNewState;
    mStateObserverList.Broadcast(StateChangedEvent());
  }
}
Beispiel #3
0
void
nsVolume::LogState() const
{
    if (mState == nsIVolume::STATE_MOUNTED) {
        LOG("nsVolume: %s state %s @ '%s' gen %d locked %d",
            NameStr(), StateStr(), MountPointStr(),
            MountGeneration(), (int)IsMountLocked());
        return;
    }

    LOG("nsVolume: %s state %s", NameStr(), StateStr());
}
Beispiel #4
0
void
nsVolume::LogState() const
{
  if (mState == nsIVolume::STATE_MOUNTED) {
    LOG("nsVolume: %s state %s @ '%s' gen %d locked %d fake %d "
        "media %d sharing %d formatting %d unmounting %d",
        NameStr().get(), StateStr(), MountPointStr().get(),
        MountGeneration(), (int)IsMountLocked(), (int)IsFake(),
        (int)IsMediaPresent(), (int)IsSharing(),
        (int)IsFormatting(), (int)IsUnmounting());
    return;
  }

  LOG("nsVolume: %s state %s", NameStr().get(), StateStr());
}
Beispiel #5
0
std::string NetworkSocket::debugString() const {
	if(!isOpen()) return "Closed";
	std::string ret = TypeStr(m_type) + "/" + StateStr(m_state);
	{
		std::string localStr = "INVALIDLOCAL";
		NetworkAddr addr;
		if(nlGetLocalAddr(m_socket->sock, getNLaddr(addr)) != NL_FALSE)
			NetAddrToString(addr, localStr);
		else {
			localStr = "ERRORLOCALADDR(" + GetLastErrorStr() + ")";
			ResetSocketError();
		}
		ret += " " + localStr;
	}
	if(m_state == NSS_CONNECTED) {
		ret += " connected to ";
		std::string remoteStr = "INVALIDREMOTE";
		NetworkAddr addr;
		if(nlGetRemoteAddr(m_socket->sock, getNLaddr(addr)) != NL_FALSE)
			NetAddrToString(remoteAddress(), remoteStr);
		else {
			remoteStr = "ERRORREMOTEADDR(" + GetLastErrorStr() + ")";
			ResetSocketError();
		}
		ret += remoteStr;
	}
	return ret;
}
Beispiel #6
0
void
Volume::SetState(Volume::STATE aNewState)
{
  if (aNewState == mState) {
    return;
  }
  LOG("Volume %s: changing state from %s to %s (%d observers)",
      NameStr(), StateStr(mState),
      StateStr(aNewState), mEventObserverList.Length());

  if (aNewState == nsIVolume::STATE_NOMEDIA) {
    // Cover the startup case where we don't get insertion/removal events
    mMediaPresent = false;
  }
  mState = aNewState;
  mEventObserverList.Broadcast(this);
}
Beispiel #7
0
void
Volume::SetIsSharing(bool aIsSharing)
{
  if (aIsSharing == mIsSharing) {
    return;
  }
  mIsSharing = aIsSharing;
  LOG("Volume %s: IsSharing set to %d state %s",
      NameStr(), (int)mIsSharing, StateStr(mState));
  mEventObserverList.Broadcast(this);
}
Beispiel #8
0
void
Volume::SetIsHotSwappable(bool aIsHotSwappable)
{
  if (aIsHotSwappable == mIsHotSwappable) {
    return;
  }
  mIsHotSwappable = aIsHotSwappable;
  if (mIsHotSwappable) {
    mIsRemovable = true;
  }
  LOG("Volume %s: IsHotSwappable set to %d state %s",
      NameStr(), (int)mIsHotSwappable, StateStr(mState));
  sEventObserverList.Broadcast(this);
}
Beispiel #9
0
void
Volume::Dump(const char* aLabel) const
{
  LOG("%s: Volume: %s (%d) is %s and %s @ %s gen %d locked %d",
      aLabel,
      NameStr(),
      Id(),
      StateStr(),
      MediaPresent() ? "inserted" : "missing",
      MountPoint().get(),
      MountGeneration(),
      (int)IsMountLocked());
  LOG("%s:   Sharing %s Mounting %s Formating %s Unmounting %s",
      aLabel,
      CanBeShared() ? (IsSharingEnabled() ? (IsSharing() ? "en-y" : "en-n")
                                          : "dis")
                    : "x",
      IsMountRequested() ? "req" : "n",
      IsFormatRequested() ? (IsFormatting() ? "req-y" : "req-n")
                          : (IsFormatting() ? "y" : "n"),
      IsUnmountRequested() ? (IsUnmounting() ? "req-y" : "req-n")
                           : (IsUnmounting() ? "y" : "n"));
}
Beispiel #10
0
	//文字列の表示
	void Player::DrawStrings() {

		//文字列表示
		//行動
		wstring BEHAVIOR;
		if (m_PlayerAction == PlayerAction::Jump) {
			BEHAVIOR = L"DEFAULT行動: Aボタンでジャンプ。Bボタンで行動切り替え\n";
		}
		else {
			BEHAVIOR = L"ATTACK行動: Aボタンでアタック。Bボタンで行動切り替え\n";
		}


		auto fps = App::GetApp()->GetStepTimer().GetFramesPerSecond();
		wstring FPS(L"FPS: ");
		FPS += Util::UintToWStr(fps);
		FPS += L"\nElapsedTime: ";
		float ElapsedTime = App::GetApp()->GetElapsedTime();
		FPS += Util::FloatToWStr(ElapsedTime);
		FPS += L"\n";

		auto Pos = GetComponent<Transform>()->GetPosition();
		wstring PositionStr(L"Position:\t");
		PositionStr += L"X=" + Util::FloatToWStr(Pos.x, 6, Util::FloatModify::Fixed) + L",\t";
		PositionStr += L"Y=" + Util::FloatToWStr(Pos.y, 6, Util::FloatModify::Fixed) + L",\t";
		PositionStr += L"Z=" + Util::FloatToWStr(Pos.z, 6, Util::FloatModify::Fixed) + L"\n";
		if (GetComponent<Transform>()->GetParent()) {
			PositionStr += L"OnParent\n";
		}
		else {
			PositionStr += L"NotParent\n";
		}

		wstring RididStr(L"Velocity:\t");
		auto Velocity = GetComponent<Rigidbody>()->GetVelocity();
		RididStr += L"X=" + Util::FloatToWStr(Velocity.x, 6, Util::FloatModify::Fixed) + L",\t";
		RididStr += L"Y=" + Util::FloatToWStr(Velocity.y, 6, Util::FloatModify::Fixed) + L",\t";
		RididStr += L"Z=" + Util::FloatToWStr(Velocity.z, 6, Util::FloatModify::Fixed) + L"\n";

		wstring GravStr(L"GravityVelocity:\t");
		auto GravVelocity = GetComponent<Rigidbody>()->GetGravityVelocity();
		GravStr += L"X=" + Util::FloatToWStr(GravVelocity.x, 6, Util::FloatModify::Fixed) + L",\t";
		GravStr += L"Y=" + Util::FloatToWStr(GravVelocity.y, 6, Util::FloatModify::Fixed) + L",\t";
		GravStr += L"Z=" + Util::FloatToWStr(GravVelocity.z, 6, Util::FloatModify::Fixed) + L"\n";


		wstring StateStr(L"State: ");
		StateStr += GetStateMachine()->GetTopState()->GetStateName() + L"\n";

		wstring HitObjectStr(L"HitObject: ");
		if (GetComponent<Collision>()->GetHitObjectVec().size() > 0) {
			for (auto&v : GetComponent<Collision>()->GetHitObjectVec()) {
				HitObjectStr += Util::UintToWStr((UINT)v.get()) + L",";
			}
			HitObjectStr += L"\n";
		}
		else {
			HitObjectStr += L"NULL\n";
		}
		wstring str = BEHAVIOR + FPS + PositionStr + RididStr + GravStr + StateStr + HitObjectStr;
		//文字列をつける
		auto PtrString = GetComponent<StringSprite>();
		PtrString->SetText(str);
	}