AirPlay Server Platform APIs

Includes:
"AirPlayCommon.h"
"APSCommonServices.h"
"APSDebugServices.h"
"CFUtils.h"

Introduction

Platform APIs related to AirPlay Server.



Functions

AirPlayReceiverServerPostEvent

Post events to AirPlay stack to notify of platform changes

AirPlayReceiverServerSendDACPCommand

Sends a DACP command from the accessory to the controller.


AirPlayReceiverServerPostEvent


Post events to AirPlay stack to notify of platform changes

OSStatus AirPlayReceiverServerPostEvent(
    CFTypeRef inServer,
    CFStringRef inEvent,
    CFTypeRef inQualifier,
    CFDictionaryRef inParams );  
Parameters
inServer

Server Identifier of the AirPlay Server

inEvent

Even being notified

inQualifier

Reserved

inParams

Reserved

Return Value

kNoErr if successful or an error code indicating failure.

Discussion

Platform should call this function to notify AirPlay stack of the following events:

	

              inEvent
              -------
        - kAirPlayEvent_PrefsChanged
             Notify AirPlay about change in accessory preference like password change, name change etc.

	
	

AirPlayReceiverServerSendDACPCommand


Sends a DACP command from the accessory to the controller.

OSStatus AirPlayReceiverServerSendDACPCommand(
    CFTypeRef inServer,
    CFStringRef inCommand );  
Parameters
inServer

Server Identifier of the AirPlay Server

inCommand

C string DACP command to send. See DACPCommon.h for string constants.

Return Value

kNoErr if successful or an error code indicating failure.

Discussion

Platform should call this function to send DACP commands to the controlling device.

	

        Action			DACP Command String					Comment
        ------			-------------------					-------
        Play			kDACPCommandStr_Play			Start playback of the current AirPlay session (only for separate play button).
        Stop			kDACPCommandStr_Stop			Stop playback of the current AirPlay session.
        Pause			kDACPCommandStr_Pause			Pause playback of the current AirPlay session (only for separate pause button).
        Pause Toggle		kDACPCommandStr_PlayPause		Toggle between play and pause of current AirPlay session (only for combined pause/play button).
        Next Item		kDACPCommandStr_NextItem		Go to the next song in the playlist.
        Previous Item		kDACPCommandStr_PrevItem		Go to the previous song in the playlist.
        Repeat Toggle		kDACPCommandStr_RepeatAdvance		Repeat Advance.
        Shuffle Toggle		kDACPCommandStr_ShuffleToggle		Shuffle Toggle.
        Volume Up		kDACPCommandStr_VolumeUp		Raise the volume of the current AirPlay session.
        Volume Down		kDACPCommandStr_VolumeDown		Lower the volume of the current AirPlay session.
        Set Propety		kDACPCommandStr_SetProperty		Set the following properties:
        		Volume Level		kDACPProperty_DeviceVolume		Set the volume to a specific level
	
	

- Accessory should call the following when the user unmutes the accessory:

	
        AirPlayReceiverServerSendDACPCommand(kDACPCommandStr_SetProperty kDACPProperty_DeviceVolume "=-144.0")
	
	

Note that the accessory should also remember the volume level before the mute, so that volume can be restored to that level when user unmutes in the future.

- Accessory should call the following when the user unmutes the accessory:

	
        AirPlayReceiverServerSendDACPCommand(kDACPCommandStr_SetProperty kDACPProperty_DeviceVolume "=<previous volume level>")
	
	

- Accessory should call the following to set volume to a specific level.

	
        AirPlayReceiverServerSendDACPCommand(kDACPCommandStr_SetProperty kDACPProperty_DeviceVolume "=<value>")
	
	

Note that volume level mentioned above is a floating-point dB attenuation value, where 0.0 is full volume and -144.0 is completely muted. The practical volume range utilized for the AirPlay stream has a basis of -30dB to 0dB with a special cased mute level of -144dB (linear volume of 0) in order to avoid infinities. The following equations can be used to convert between a dB value and a linear volume:

	
        linear volume = pow( 10, dB / 20 )
        dB value      = 20 * log10( linear volume )
	
	

- Accessory should do the following when switching away from an active AirPlay session, to ensure that the sender device is notified of the audio input switching away from AirPlay.

	
        AirPlayReceiverServerSendDACPCommand(kDACPCommandStr_SetProperty kDACPProperty_DevicePreventPlayback "=1")
        AirPlayReceiverServerSendDACPCommand(kDACPCommandStr_SetProperty kDACPProperty_DeviceBusy "=1")
        AirPlayReceiverServerSendDACPCommand(kDACPCommandStr_SetProperty kDACPProperty_DevicePreventPlayback "=0")
	
	

- Accessory should do the following when switching into AirPlay input when AirPlay session is inactive, to ensure that the sender device is notified of the audio input switching to AirPlay.

	
        AirPlayReceiverServerSendDACPCommand(kDACPCommandStr_SetProperty kDACPProperty_DeviceBusy "=0")