Skip to content

Commit

Permalink
Win23 - Improve Konfig Support.
Browse files Browse the repository at this point in the history
This commit updates the presentation Url handling in PresentationUrlChanged()
to bring it in line with recent dependency updates.

This allows the Linn Konfig utility to display the Web UI Configuration
page for the player.

To enable Konfig to display the model icon for the player:

  - Ramstore is constructed with an image filename.
    This is used as the kBufModelImageUrl value.

    NB. Static options that do not start with 'http' will result in calls
        to ExampleMediaPLayer::WriteResource() upon request.

  - IconOpenHome.h has been added to the code base.
    This contains the icon as a byte array.

  - WriteResource() has been updated to use the resource writer
    to pass the icon data to the requesting control point.
  • Loading branch information
Alan Smillie committed Sep 20, 2016
1 parent 86e0b22 commit 9e0a872
Show file tree
Hide file tree
Showing 5 changed files with 563 additions and 22 deletions.
30 changes: 11 additions & 19 deletions Win32/ExampleMediaPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <OpenHome/Av/Product.h>
#include <OpenHome/Av/SourceFactory.h>
#include <OpenHome/Av/UpnpAv/UpnpAv.h>
#include <OpenHome/Av/Utils/IconDriverSongcastSender.h>
#include <OpenHome/Media/Debug.h>
#include <OpenHome/Av/Debug.h>
#include <OpenHome/Media/Pipeline/Pipeline.h>
Expand All @@ -23,6 +22,7 @@
#include "ControlPointProxy.h"
#include "CustomMessages.h"
#include "ExampleMediaPlayer.h"
#include "IconOpenHome.h"
#include "MemoryCheck.h"
#include "MediaPlayerIF.h"
#include "OptionalFeatures.h"
Expand All @@ -37,7 +37,7 @@ using namespace OpenHome::Web;

// ExampleMediaPlayer

const Brn ExampleMediaPlayer::kSongcastSenderIconFileName("SongcastSenderIcon");
const Brn ExampleMediaPlayer::kIconOpenHomeFileName("OpenHomeIcon");

ExampleMediaPlayer::ExampleMediaPlayer(HWND hwnd,
Net::DvStack& aDvStack,
Expand Down Expand Up @@ -88,7 +88,7 @@ ExampleMediaPlayer::ExampleMediaPlayer(HWND hwnd,

// create read/write store. This creates a number of static (constant)
// entries automatically
iRamStore = new RamStore();
iRamStore = new RamStore(kIconOpenHomeFileName);

// create a read/write store using the new config framework
iConfigRegStore = new ConfigRegStore();
Expand Down Expand Up @@ -344,12 +344,12 @@ void ExampleMediaPlayer::WriteResource(const Brx& aUriTail,
std::vector<char*>& /*aLanguageList*/,
IResourceWriter& aResourceWriter)
{
if (aUriTail == kSongcastSenderIconFileName)
if (aUriTail == kIconOpenHomeFileName)
{
aResourceWriter.WriteResourceBegin(sizeof(kIconDriverSongcastSender),
kIconDriverSongcastSenderMimeType);
aResourceWriter.WriteResource(kIconDriverSongcastSender,
sizeof(kIconDriverSongcastSender));
aResourceWriter.WriteResourceBegin(sizeof(kIconOpenHome),
kIconOpenHomeMimeType);
aResourceWriter.WriteResource(kIconOpenHome,
sizeof(kIconOpenHome));
aResourceWriter.WriteResourceEnd();
}
}
Expand Down Expand Up @@ -389,17 +389,9 @@ void ExampleMediaPlayer::AddConfigApp()

void ExampleMediaPlayer::PresentationUrlChanged(const Brx& aUrl)
{
if (!iDevice->Enabled()) {
// FIXME - can only set Product attribute once (meaning no updates on subnet change)
const TBool firstChange = (iPresentationUrl.Bytes() == 0);
iPresentationUrl.Replace(aUrl);
iDevice->SetAttribute("Upnp.PresentationUrl", iPresentationUrl.PtrZ());
if (firstChange) {
Bws<128> configAtt("App:Config=");
configAtt.Append(iPresentationUrl);
iMediaPlayer->Product().AddAttribute(configAtt);
}
}
iPresentationUrl.Replace(aUrl);
iMediaPlayer->Product().SetConfigAppUrl(iPresentationUrl);
iDevice->SetAttribute("Upnp.PresentationUrl", iPresentationUrl.PtrZ());
}

TBool ExampleMediaPlayer::TryDisable(DvDevice& aDevice)
Expand Down
3 changes: 1 addition & 2 deletions Win32/ExampleMediaPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <OpenHome/Av/MediaPlayer.h>
#include <OpenHome/Av/FriendlyNameAdapter.h>
#include <OpenHome/Av/Utils/DriverSongcastSender.h>
#include <OpenHome/Media/PipelineManager.h>
#include <OpenHome/Av/RebootHandler.h>
#include <OpenHome/Av/Songcast/OhmTimestamp.h>
Expand Down Expand Up @@ -41,7 +40,7 @@ namespace Av {

class ExampleMediaPlayer : private Net::IResourceManager
{
static const Brn kSongcastSenderIconFileName;
static const Brn kIconOpenHomeFileName;
static const TUint kMaxUiTabs = 4;
static const TUint kUiSendQueueSize = kMaxUiTabs * 200;
static const TUint kShellPort = 2323;
Expand Down
Loading

0 comments on commit 9e0a872

Please sign in to comment.