Пример #1
0
bool UDPAssetProvider::QueryAssetStatus(const std::string& asset_id, uint& size, uint& received, uint& received_continuous)
{
    UDPAssetTransfer* transfer = GetTransfer(asset_id);

    if (transfer)
    {
        size = transfer->GetSize();
        received = transfer->GetReceived();
        received_continuous = transfer->GetReceivedContinuous();

        return true;
    }

    return false;
}
Пример #2
0
Foundation::AssetPtr UDPAssetProvider::GetIncompleteAsset(const std::string& asset_id, const std::string& asset_type, uint received)
{
    UDPAssetTransfer* transfer = GetTransfer(asset_id);

    if ((transfer) && (transfer->GetReceivedContinuous() >= received))
    {
        // Make new temporary asset for the incomplete data
        RexAsset* new_asset = new RexAsset(transfer->GetAssetId(), GetTypeNameFromAssetType(transfer->GetAssetType()));
        Foundation::AssetPtr asset_ptr(new_asset);

        RexAsset::AssetDataVector& data = new_asset->GetDataInternal();
        data.resize(transfer->GetReceivedContinuous());
        transfer->AssembleData(&data[0]);

        return asset_ptr;
    }

    return Foundation::AssetPtr();
}
Пример #3
0
void UDPAssetProvider::RequestOtherAsset(boost::shared_ptr<ProtocolUtilities::ProtocolModuleInterface> net,
        const RexUUID& asset_id, uint asset_type, const RequestTagVector& tags)
{
    // If request already exists, just append the new tag(s)
    std::string asset_id_str = asset_id.ToString();
    UDPAssetTransfer* transfer = GetTransfer(asset_id_str);
    if (transfer)
    {
        transfer->InsertTags(tags);
        return;
    }

    RexUUID transfer_id;
    transfer_id.Random();

    UDPAssetTransfer new_transfer;
    new_transfer.SetAssetId(asset_id_str);
    new_transfer.SetAssetType(asset_type);
    new_transfer.InsertTags(tags);
    asset_transfers_[transfer_id] = new_transfer;

    AssetModule::LogDebug("Requesting asset " + asset_id_str);

    ProtocolUtilities::NetOutMessage *m = net->StartMessageBuilding(RexNetMsgTransferRequest);
    assert(m);

    m->AddUUID(transfer_id); // Transfer ID
    m->AddS32(RexAC_Asset); // Asset channel type
    m->AddS32(RexAS_Asset); // Asset source type
    m->AddF32(100.0); // Download priority

    u8 asset_info[20]; // Asset info block with UUID and type
    memcpy(&asset_info[0], &asset_id.data, 16);
    memcpy(&asset_info[16], &asset_type, 4);
    m->AddBuffer(20, asset_info);
    m->MarkReliable();
    net->FinishMessageBuilding(m);

    return;
}
Пример #4
0
void HD44780Analyzer::WorkerThread()
{
  U32 dbline;

  //get sample rate
	mSampleRateHz = GetSampleRate();

  //setup channels
	mE = GetAnalyzerChannelData( mSettings->mEChannel );
	mRS = GetAnalyzerChannelData( mSettings->mRSChannel );
	if( mSettings->mRWChannel != UNDEFINED_CHANNEL )
    mRW = GetAnalyzerChannelData( mSettings->mRWChannel );
	else mRW = NULL;
  for (dbline=0;dbline<8;dbline++)
    if( mSettings->mDBChannel[dbline] != UNDEFINED_CHANNEL )
      mDB[dbline] = GetAnalyzerChannelData( mSettings->mDBChannel[dbline] );
    else mDB[dbline] = NULL;

  //if we start high we need to move to low
	if( mE->GetBitState() == BIT_HIGH)
		mE->AdvanceToNextEdge();

  //we always start in 8-bit mode unless the force 4-bit mode option is selected
  //function set command can change modes
  bitmode8=!mSettings->mStartIn4BitMode;

  //reset between E high pulse measurements
  mLastEStart=0;

  //reset busy mode
  mWaitBusy=0;

  //get frames
	for( ; ; )
    {
      GetTransfer();
      CheckIfThreadShouldExit();
    }
}
Пример #5
0
void UDPAssetProvider::RequestTexture(boost::shared_ptr<ProtocolUtilities::ProtocolModuleInterface> net,
                                      const RexUUID& asset_id, const RequestTagVector& tags)
{
    // If request already exists, just append the new tag(s)
    std::string asset_id_str = asset_id.ToString();
    UDPAssetTransfer* transfer = GetTransfer(asset_id_str);
    if (transfer)
    {
        transfer->InsertTags(tags);
        return;
    }

    const ProtocolUtilities::ClientParameters& client = net->GetClientParameters();

    UDPAssetTransfer new_transfer;
    new_transfer.SetAssetId(asset_id.ToString());
    new_transfer.SetAssetType(RexAT_Texture);
    new_transfer.InsertTags(tags);
    texture_transfers_[asset_id] = new_transfer;

    AssetModule::LogDebug("Requesting texture " + asset_id.ToString());

    ProtocolUtilities::NetOutMessage *m = net->StartMessageBuilding(RexNetMsgRequestImage);
    assert(m);

    m->AddUUID(client.agentID);
    m->AddUUID(client.sessionID);

    m->SetVariableBlockCount(1);
    m->AddUUID(asset_id); // Image UUID
    m->AddS8(0); // Discard level
    m->AddF32(100.0); // Download priority
    m->AddU32(0); // Starting packet
    m->AddU8(RexIT_Normal); // Image type
    m->MarkReliable();
    net->FinishMessageBuilding(m);
}
Пример #6
0
bool UDPAssetProvider::InProgress(const std::string& asset_id)
{
    UDPAssetTransfer* transfer = GetTransfer(asset_id);
    return (transfer != 0);
}