NymphCast Client Library
Public Member Functions | List of all members
NymphCastClient Class Reference

Public Member Functions

 NymphCastClient ()
 
void setClientId (std::string id)
 
void setApplicationCallback (AppMessageFunction function)
 
void setStatusUpdateCallback (StatusUpdateFunction function)
 
std::string getApplicationList (uint32_t handle)
 
std::string sendApplicationMessage (uint32_t handle, std::string appId, std::string message)
 
std::string loadResource (uint32_t handle, std::string appId, std::string name)
 
std::vector< NymphCastRemotefindServers ()
 
std::vector< NymphCastRemotefindShares ()
 
bool connectServer (std::string ip, uint32_t &handle)
 
bool disconnectServer (uint32_t handle)
 
std::vector< NymphMediaFilegetShares (NymphCastRemote mediaserver)
 
bool playShare (NymphMediaFile file, std::vector< NymphCastRemote > receivers)
 
bool addSlaves (uint32_t handle, std::vector< NymphCastRemote > remotes)
 
bool castFile (uint32_t handle, std::string filename)
 
bool castUrl (uint32_t handle, std::string url)
 
uint8_t volumeSet (uint32_t handle, uint8_t volume)
 
uint8_t volumeUp (uint32_t handle)
 
uint8_t volumeDown (uint32_t handle)
 
uint8_t playbackStart (uint32_t handle)
 
uint8_t playbackStop (uint32_t handle)
 
uint8_t playbackPause (uint32_t handle)
 
uint8_t playbackRewind (uint32_t handle)
 
uint8_t playbackForward (uint32_t handle)
 
uint8_t playbackSeek (uint32_t handle, uint64_t location)
 
uint8_t playbackSeek (uint32_t handle, uint8_t percentage)
 
NymphPlaybackStatus playbackStatus (uint32_t handle)
 

Constructor & Destructor Documentation

◆ NymphCastClient()

NymphCastClient::NymphCastClient ( )

Initialise the remote client instance with default settings.

Member Function Documentation

◆ addSlaves()

bool NymphCastClient::addSlaves ( uint32_t  handle,
std::vector< NymphCastRemote remotes 
)

Configure a Master remote to use the provided Slave remotes for synchronous playback of content.

Parameters
handleThe handle for the remote server.
remotesVector of remotes to configure as Slaves.
Returns
True if the operation succeeded.

◆ castFile()

bool NymphCastClient::castFile ( uint32_t  handle,
std::string  filename 
)

Stream file to remote. Use the provided file path to open the media file and stream its contents to the remote.

Parameters
handleThe handle for the remote server.
filenameThe (relative) path to the media file.
Returns
True if the operation succeeded.

◆ castUrl()

bool NymphCastClient::castUrl ( uint32_t  handle,
std::string  url 
)

Send the provided URL to the remote, which will attempt to play back any media content found.

Parameters
handleThe handle for the remote server.
urlURL to play back from.
Returns
True if the operation succeeded.

◆ connectServer()

bool NymphCastClient::connectServer ( std::string  ip,
uint32_t &  handle 
)

Attempt to connect to the specified remote NymphCast server.

Parameters
ipThe IP address of the target server.
handleThe new handle for the remote server.
Returns
True if the operation succeeded.

◆ disconnectServer()

bool NymphCastClient::disconnectServer ( uint32_t  handle)

Disconnect from the remote server.

Parameters
handleThe handle for the remote server.
Returns
True if the operation succeeded.

◆ findServers()

std::vector< NymphCastRemote > NymphCastClient::findServers ( )

Find remote NymphCast servers using a NyanSD query.

Returns
A vector with any found remotes.

◆ findShares()

std::vector< NymphCastRemote > NymphCastClient::findShares ( )

Find any NymphCast Media Servers on the network using a NyanSD query.

Returns
Vector containing any found media server instances.

◆ getApplicationList()

std::string NymphCastClient::getApplicationList ( uint32_t  handle)

Obtain a list of application available on the remote.

Parameters
handleThe handle for the remote server.
Returns
A string containing the application list, separated by newlines (
).

◆ getShares()

std::vector< NymphMediaFile > NymphCastClient::getShares ( NymphCastRemote  mediaserver)

Attempt to obtain the list of shared media files from a NymphCast Media Server.

Parameters
mediaserverInformation on the target media server instance.
Returns
Vector with the list of available files, if successful.

◆ loadResource()

std::string NymphCastClient::loadResource ( uint32_t  handle,
std::string  appId,
std::string  name 
)

Load a specific resource from a remote application. E.g. an image.

Parameters
handleThe handle for the remote server.
appIdID of the remote application.
nameThe name of the resource.
Returns
A string containing the (binary) data, if successful.

◆ playbackForward()

uint8_t NymphCastClient::playbackForward ( uint32_t  handle)

Forward playback on the remote.

Parameters
handleThe handle for the remote server.
Returns
0 if the operation succeeded.

◆ playbackPause()

uint8_t NymphCastClient::playbackPause ( uint32_t  handle)

Pause playback on the remote.

Parameters
handleThe handle for the remote server.
Returns
0 if the operation succeeded.

◆ playbackRewind()

uint8_t NymphCastClient::playbackRewind ( uint32_t  handle)

Rewind playback on the remote.

Parameters
handleThe handle for the remote server.
Returns
0 if the operation succeeded.

◆ playbackSeek() [1/2]

uint8_t NymphCastClient::playbackSeek ( uint32_t  handle,
uint64_t  location 
)

Seek to specific byte offset in the file.

Parameters
handleThe handle for the remote server.
locationNew offset in the file, in bytes.
Returns
0 if the operation succeeded.

◆ playbackSeek() [2/2]

uint8_t NymphCastClient::playbackSeek ( uint32_t  handle,
uint8_t  percentage 
)

Seek to percentage of the media file length.

Parameters
handleThe handle for the remote server.
percentageNew percentage in the file of media length.
Returns
0 if the operation succeeded.

◆ playbackStart()

uint8_t NymphCastClient::playbackStart ( uint32_t  handle)

Start or resume playback on the remote.

Parameters
handleThe handle for the remote server.
Returns
0 if the operation succeeded.

◆ playbackStatus()

NymphPlaybackStatus NymphCastClient::playbackStatus ( uint32_t  handle)

Request the playback status from the remote.

Parameters
handleThe handle for the remote server.
Returns
A NymphPlaybackStatus struct with playback information.

◆ playbackStop()

uint8_t NymphCastClient::playbackStop ( uint32_t  handle)

Stop playback on the remote.

Parameters
handleThe handle for the remote server.
Returns
0 if the operation succeeded.

◆ playShare()

bool NymphCastClient::playShare ( NymphMediaFile  file,
std::vector< NymphCastRemote receivers 
)

Instruct a Media Server instance to play back a specific shared file on the target remote servers.

If multiple receivers are specified, the first one becomes the Master receiver, with the remaining receivers configured as Slave receivers to that one Master receiver. This allows for synchronous playback.

Parameters
fileDefinition of the shared
receiversVector of remote servers to play the content back on.
Returns
True if the operation succeeded.

◆ sendApplicationMessage()

std::string NymphCastClient::sendApplicationMessage ( uint32_t  handle,
std::string  appId,
std::string  message 
)

Send a string to an application on the remote.

Parameters
handleThe handle for the remote server.
appIdID of the remote application.
messageMessage to send to the remote application.
Returns
String with any response from the remote.

◆ setApplicationCallback()

void NymphCastClient::setApplicationCallback ( AppMessageFunction  function)

Set the callback to call when a remote application sends data.

Parameters
functionThe callback function.

◆ setClientId()

void NymphCastClient::setClientId ( std::string  id)

Set the callback to call when a remote application sends data.

Parameters
idA unique string ID.

◆ setStatusUpdateCallback()

void NymphCastClient::setStatusUpdateCallback ( StatusUpdateFunction  function)

Set callback to call when the remote sends a status update on e.g. playback.

Parameters
functionThe callback function.

◆ volumeDown()

uint8_t NymphCastClient::volumeDown ( uint32_t  handle)

Decrease the volume on the remote server.

Parameters
handleThe handle for the remote server.
Returns
0 if the operation succeeded.

◆ volumeSet()

uint8_t NymphCastClient::volumeSet ( uint32_t  handle,
uint8_t  volume 
)

Set the volume on the target remote. Volume is set within a range of 0 - 128.

Parameters
handleThe handle for the remote server.
volumeTarget volume level.
Returns
0 if the operation succeeded.

◆ volumeUp()

uint8_t NymphCastClient::volumeUp ( uint32_t  handle)

Increase the volume on the remote server.

Parameters
handleThe handle for the remote server.
Returns
0 if the operation succeeded.

The documentation for this class was generated from the following files: