Example #1
0
HRESULT avcSendRequest(uint32 ctype, PB *packetBlock)
{
	HRESULT		hResult = NO_ERROR;	

	// pad the data to the next full 32bit boundary. This is a requirement for AV/C Packets.
	// stream position not always at the end - avcPadToNextQuadlet(packetBlock);

#ifdef _SYSDEBUG
		if (sysDebugIsEnabled(SYSDEBUG_TRACE_AVC))
		{
			if (avcUnitCliIsPrintMode(AVC_UNIT_PRINT_SND_RAW))
			{
				avcUnitCliPrintPacketBlockRawData(ctype, packetBlock);
			}
		}
#endif //_SYSDEBUG
#ifdef _SYSDEBUG
	if (sysDebugIsEnabled(SYSDEBUG_TRACE_AVC))
	{
		if ((avcCtypeIsResponse(ctype) &&	// response
			((avcUnitCliIsPrintMode(AVC_UNIT_PRINT_SND_RESPONSE_ALL)) ||
			 (avcUnitCliIsPrintMode(AVC_UNIT_PRINT_SND_RESPONSE_IMPLEMENTED) && ctype != AVC_RESPONSE_NOT_IMPLEMENTED) ||
			 (avcUnitCliIsPrintMode(AVC_UNIT_PRINT_SND_RESPONSE_NOT_IMPLEMENTED) && ctype == AVC_RESPONSE_NOT_IMPLEMENTED))) ||
			(avcCtypeIsCommand(ctype) &&	// commands
			(avcUnitCliIsPrintMode(AVC_UNIT_PRINT_SND_COMMAND_ALL))))
		{
			avcUnitCliPrintPacketBlock(packetBlock);
		}
	}
#endif //_SYSDEBUG

	hResult = fcpSend(packetBlock, avcCtypeIsResponse(ctype));

	return hResult;
}
Example #2
0
HRESULT avcBlockingSendRequest(NODEHANDLE hHandle, uint8 ctype, uint16 byteLength, uint32 *bufPtr)
{
	HRESULT		hResult = NO_ERROR;	

#ifdef _SYSDEBUG
		if (sysDebugIsEnabled(SYSDEBUG_TRACE_AVC))
		{
			if (avcUnitCliIsPrintMode(AVC_UNIT_PRINT_SND_RAW))
			{
				avcUnitCliPrintRawData(ctype, byteLength, bufPtr);
			}
		}
#endif //_SYSDEBUG
#ifdef _SYSDEBUG
	if (sysDebugIsEnabled(SYSDEBUG_TRACE_AVC))
	{
		if ((avcCtypeIsResponse(ctype) &&	// response
			((avcUnitCliIsPrintMode(AVC_UNIT_PRINT_SND_RESPONSE_ALL)) ||
			 (avcUnitCliIsPrintMode(AVC_UNIT_PRINT_SND_RESPONSE_IMPLEMENTED) && ctype != AVC_RESPONSE_NOT_IMPLEMENTED) ||
			 (avcUnitCliIsPrintMode(AVC_UNIT_PRINT_SND_RESPONSE_NOT_IMPLEMENTED) && ctype == AVC_RESPONSE_NOT_IMPLEMENTED))) ||
			(avcCtypeIsCommand(ctype) &&	// commands
			(avcUnitCliIsPrintMode(AVC_UNIT_PRINT_SND_COMMAND_ALL))))
		{
			DataStream  ds;
		
			hResult = dsOpenStream(&ds, bufPtr, byteLength, dsMODE_READ);
			if (hResult == NO_ERROR)
			{
				avcUnitCliPrintDataStream(&ds);
			}
		}
	}
#endif //_SYSDEBUG

	hResult = fcpBlockingSend(hHandle, byteLength, bufPtr, avcCtypeIsResponse(ctype));

	return hResult;
}
Example #3
0
/*****************************************************************************
 
   avcAudioRxPacketCallback
 
		This function gets called when a packet is received with has us as its
		subunit type and id.

******************************************************************************/
static HRESULT	avcAudioRxPacketCallback (AVC_HEADER	*avcHeaderInfo,
										  PB 			*pPacketBlock)
{
	HRESULT				hResult;
	DataStream			*pAvcStream;
		
	//KBJ??? ASSERT (AVC_SU_TYPE_AUDIO == avcHeaderInfo.subunittype);
	//KBJ??? ASSERT (NUM_AUDIO_SUBUNIT_INSTANCES > avcHeaderInfo.subunitid);

	/* get our packet stream - stream has already been advanced to operand[0] */

	hResult = pbGetApplicationDatastream (pPacketBlock, &pAvcStream);	
	if (NO_ERROR == hResult)
	{
		/* We only receive commands, we never send them so we should never receive response codes */
		if (!avcCtypeIsCommand(avcHeaderInfo->ctype))
		{
			/* We don't want to send response to a response, so we will return NO_ERROR.  On the other
				hand, it is an error so do report the error */
			hResult = E_AVC_UNEXPECTED_RESPONSE;
			sysLogError(hResult, __LINE__, moduleName);
			pbPacketDone(pPacketBlock, 8);
			hResult = NO_ERROR;
		}
		else
		{
			/* see what is being commanded of us */
			switch (avcHeaderInfo->opcode)
			{
				case AVC_CMD_PLUG_INFO:
						hResult = avcCmdPlugInfo(avcHeaderInfo, pPacketBlock, pAvcStream);
						break;
				case AVC_CMD_STREAM_FMT_EXT_INFO:
						hResult = avcCmdStreamFmtExtInfo(avcHeaderInfo, pPacketBlock, pAvcStream);
						break;
				case AVC_CMD_STREAM_FMT_SUPPORT:
						hResult = avcCmdStreamFmtSupport(avcHeaderInfo, pPacketBlock, pAvcStream, AVC_SU_TYPE_AUDIO);
						break;
				case AVC_CMD_CHANGE_CONFIGURATION:
						hResult = changeConfigurationHandler(pAvcStream, avcHeaderInfo, pPacketBlock);
						break;
				case AVC_CMD_FUNCTION_BLOCK:
						hResult = functionBlockHandler(pAvcStream, avcHeaderInfo, pPacketBlock);
						break;
				default:
						hResult = AVC_RESPONSE_NOT_IMPLEMENTED;
						break;
			}
		}
	}

	switch (hResult)
	{
		case E_PKT_AVC_ACCEPTED:
		case E_PKT_AVC_IMPLEMENTED:
		case E_PKT_AVC_NOT_IMPLEMENTED:
		case E_PKT_AVC_REJECTED:
		case E_PKT_AVC_INTERIM:
		case E_PKT_AVC_STABLE:
				/* These return values cause avc_main (who called us) to send the
					respective AV/C response. */
				break;
		case NO_ERROR:
				/* This return value tells avc_main that we have handled the command and
					sent the response.  */
				break;
		default:
				/* Anything else is some sort of error - log the error and reject the command. */
				sysLogError(hResult, __LINE__, moduleName);
				hResult = E_PKT_AVC_REJECTED;
				break;
	}
	return(hResult);
}