Esempio n. 1
0
HRESULT dsCliTest(uint32 mode)
{
	HRESULT			hResult = NO_ERROR;
	DataStream		ds;
	uint8			data[4] = {0x12,0x34,0x56,0x78};
	uint32			read[4];
	uint32			i;
	BOOL			bEncode;
#if 0 //def _SYSDEBUG
	BOOL			dataStreamLoggingSafe = dataStreamLogging;

	dataStreamLogging = TRUE;
#endif //_SYSDEBUG

	cliPrintf("dsCliTest\n\r");
	cliPrintf("data:\t\t");
	for (i = 0; i < 4; i++) cliPrintf("0x%02x ", data[i]);
	cliPrintf("\n\r");

	hResult = dsOpenStream(&ds, data, sizeof(data), dsMODE_READ | mode);
	if (hResult != NO_ERROR) return hResult;

	bEncode = FALSE;

	hResult = dsHandleBits(&ds, 4, &read[0], bEncode);
	if (hResult != NO_ERROR) return hResult;
	hResult = dsHandleBits(&ds, 4, &read[1], bEncode);
	if (hResult != NO_ERROR) return hResult;
	hResult = dsHandleBits(&ds, 8, &read[2], bEncode);
	if (hResult != NO_ERROR) return hResult;
	hResult = dsHandleBits(&ds, 16, &read[3], bEncode);
	if (hResult != NO_ERROR) return hResult;

	dsCloseStream(&ds);

#if 0 //def _SYSDEBUG
	dataStreamLogging = dataStreamLoggingSafe;
#endif //_SYSDEBUG

	cliPrintf("dsCliTest\n\r");
	cliPrintf("read:\t\t");
	for (i = 0; i < 4; i++) cliPrintf("0x%08x ", read[i]);
	cliPrintf("\n\r");

	return hResult;
}
Esempio n. 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;
}