Esempio n. 1
0
void CHCEmulator::ConnectionCompleteEvent(TUint8 aError, TLinkType /*aType*/)
	{
	ClearPacket();

	iConsole.Printf(_L("Sending ConnectionComplete Event (error 0x%02x)...\n"), aError);

	const TBTConnect& newConnection = iConnections[iConnections.Count()-1];

	PutBytes(KHCIUARTEventHeader);
	PutBytes(KHCIConnectionCompleteEventCode);
	PutBytes(KHCIConnectionCompleteEventLength);

	// test for what happens if we createconnection while inquiry is active
	if (iInquiryTimer->IsActive())
		PutBytes(KHCICommandDisallowed);
	else
		PutBytes(aError);

	PutBytes(newConnection.iConnH,2);
	PutAddress(newConnection.iBdaddr); // <-- test signaller by changing this address
	PutBytes(newConnection.iLinkType);
	PutBytes(newConnection.iEncryptMode);
	
	WritePacket();
	}
Esempio n. 2
0
ezSocketsPacket::ezSocketsPacket()
{
	Data = NULL;
	Next = NULL;
	iPackets++;
	Port = 0;
	ClearPacket();
}
Esempio n. 3
0
moEventPacket::moEventPacket(float p_sendInterval, int p_maxEventNum)
{
	sendInterval = p_sendInterval;
	maxEventNum = p_maxEventNum;

	buffer_events = new moEventStruct [maxEventNum];
	pointer = (void*)buffer_events;
	memset((void*)&empty_event,0,sizeof(moEventStruct));
	num_events = 0;

	ClearPacket();
}
Esempio n. 4
0
void CHCEmulator::InquiryCompleteEvent(TUint8 aError)
	{
	ClearPacket();

	iConsole.Printf(_L("Sending InquiryComplete Event (error 0x%02x)...\n"), aError);

	PutBytes(KHCIUARTEventHeader);
	PutBytes(KHCIInquiryCompleteEventCode);
	PutBytes(KHCIInquiryCompleteEventLength);
	PutBytes(aError);
	
	WritePacket();
	}
Esempio n. 5
0
void CHCEmulator::ConnectionPacketTypeChangedEvent(TUint8 aError, THCIConnHandle aConnH)
	{
	ClearPacket();

	iConsole.Printf(_L("Sending ConnectionPacketTypeChanged Event (error 0x%02x)...\n"), aError);

	PutBytes(KHCIUARTEventHeader);
	PutBytes(KHCIConnectionPacketTypeChangedCode);
	PutBytes(KHCIConnectionPacketTypeChangedLength);
	PutBytes(aError);
	PutBytes(aConnH, 2);
	PutBytes(KEmulatedChangedPacketType,2);

	WritePacket();	
	}
Esempio n. 6
0
void CHCEmulator::HardwareErrorEvent()
	{
	ClearPacket();

	TUint8 error = KHCIOK;

	iConsole.Printf(_L("Sending HardwareError Event (error 0x%02x)...\n"), error);

	PutBytes(KHCIUARTEventHeader);
	PutBytes(KHCIHardwareErrorEventCode);
	PutBytes(KHCIHardwareErrorEventLength);	
	PutBytes(error);

	WritePacket();
	}
Esempio n. 7
0
void CHCEmulator::ReadRemoteNameCompleteEvent(TUint8 aError, const TBTDevAddr& aAddr, const TDesC8& aName)
	{
	ClearPacket();
	
	iConsole.Printf(_L("Sending C.C.E (opcode ReadRemoteName, error 0x%02x)...\n"), aError);

	PutBytes(KHCIUARTEventHeader);
	PutBytes(KHCIRemoteNameRequestCompleteEventCode);
	PutBytes(KHCIRemoteNameReqCompleteEventPacketLength);
	PutBytes(aError);
	PutAddress(aAddr);
	PutName(aName);
	
	WritePacket();
	}
Esempio n. 8
0
void CHCEmulator::ReadClockOffsetCompleteEvent(TUint8 aError, THCIConnHandle aConnH)
	{
	ClearPacket();

	iConsole.Printf(_L("Sending ReadClockOffsetComplete Event (error 0x%02x)...\n"), aError);

	PutBytes(KHCIUARTEventHeader);
	PutBytes(KHCIReadClockOffsetCompleteEventCode);
	PutBytes(KHCIReadClockOffsetCompleteLength);
	PutBytes(aError);
	PutBytes(aConnH, 2);
	PutBytes(KEmulatedClockOffset,2);

	WritePacket();	
	}
Esempio n. 9
0
void CHCEmulator::DisconnectionCompleteEvent(TUint8 aError, THCIConnHandle aConnH, TUint8 aReason)
	{
	ClearPacket();

	iConsole.Printf(_L("Sending DisconnectComplete Event (error 0x%02x)...\n"), aError);

	PutBytes(KHCIUARTEventHeader);
	PutBytes(KHCIDisconnectionCompleteEventCode);
	PutBytes(KHCIDisconnectionCompleteEventLength);
	PutBytes(aError);
	PutBytes(aConnH, 2);
	PutBytes(aReason);
	
	WritePacket();
	}
Esempio n. 10
0
void CHCEmulator::ConnectionRequestEvent(const TBTDevAddr& aAddr, TUint aCoD, TLinkType aType)
	{
	ClearPacket();

	iConsole.Printf(_L("Sending Connection Request event...\n"));

	PutBytes(KHCIUARTEventHeader);
	PutBytes(KHCIConnectionRequestEventCode);
	PutBytes(KHCIConnectionRequestEventLength);
	PutAddress(aAddr);
	PutBytes(aCoD,3);
	PutBytes(aType);
	
	WritePacket();
	}
Esempio n. 11
0
void CHCEmulator::SpecificVendorDebugEvent()
	{
	TInputManager manager(iConsole);
	
	iConsole.Printf(_L("Data length (0-99): "));
	
	TBuf8<255> str;
	manager.ReadString(str);
	TUint count;
	
	if (manager.String2Uint(str, count) != KErrNone)
		{
		iConsole.Printf(_L("Invalid data length\n"), count);
		return;
		}
	
	iConsole.Printf(_L("Fill in %d bytes\n"), count);
	
	TBuf8<255> data(count);
	TUint value;
	
	for(TUint index=0;index<count;index++)
		{
		iConsole.Printf(_L("byte %d: 0x"), index);
		// TUint value = manager.ReadInt(ETrue);
		manager.ReadString(str);
		if (manager.String2Uint(str, value, ETrue) != KErrNone)
			{
			iConsole.Printf(_L("Invalid byte value (must be hex)\n"), count);
			return;
			}
		data[index] = value;
		}
	
	ClearPacket();
	PutBytes(KHCIUARTEventHeader);
	PutBytes(KHCISpecificVendorDebugEvent);
	PutBytes(count);
	for(TUint index=0;index<count;index++)
		{
		PutBytes(data[index]);
		}
	
	TRAPD(error,iWriter->WriteL(iPacket));

	if (error)
		iConsole.Printf(_L("ERROR - Write failed\n"));
	}
Esempio n. 12
0
void CHCEmulator::BuildAndWriteDataPacket(const TDesC8& aConnHandleBuf /* THCIConnHandle aConnH*/, const TDesC8& aRemainderBuf)
	{
	ClearPacket();

	PutBytes(KHCIUARTACLDataHeader);
//	PutBytes(aConnH,2);

	iPacket.Append(aConnHandleBuf);
	PutBytes(aRemainderBuf.Length(), 2);
	iPacket.Append(aRemainderBuf);

	TRAPD(error,iWriter->WriteL(iPacket));

	if (error)
		iConsole.Printf(_L("ERROR - Write failed\n"));
	}
Esempio n. 13
0
void CHCEmulator::NumberCompletedPacketsEvent(/*const TDesC8& aConnHandleFlagsBuf*/THCIConnHandle aConnH, TUint8 aNumPackets, TUint8 aError)
	{
	ClearPacket();

	iConsole.Printf(_L("Sending NumPacketsComplete Event (error 0x%02x)...\n"), aError);
	
	PutBytes(KHCIUARTEventHeader);
	PutBytes(KHCINumCompletedPacketsEventCode);
	PutBytes(KHCINumCompletedPacketsEventLength);
	PutBytes(0x01);				// FIXME we'll do one at a time for the moment
	PutBytes(aConnH,2);
//	iPacket.Append(aConnHandleFlagsBuf);
	PutBytes(aNumPackets,2);				// FIXME we'll do one at a time for the moment
	
	WritePacket();
	}
Esempio n. 14
0
void CHCEmulator::ReadRemoteVersionInfoCompleteEvent(TUint8 aError, THCIConnHandle aConnH)
	{
	ClearPacket();

	iConsole.Printf(_L("Sending ReadRemoteVersionInfoComplete Event (error 0x%02x)...\n"), aError);

	PutBytes(KHCIUARTEventHeader);
	PutBytes(KHCIReadRemoteVersionInfoCode);
	PutBytes(KHCIReadRemoteVersionInfoLength);
	PutBytes(aError);
	PutBytes(aConnH, 2);
	PutBytes(KEmulatedRemoteVersionInfo1,4);
	PutBytes(KEmulatedRemoteVersionInfo2,1);

	WritePacket();	
	}
Esempio n. 15
0
void CHCEmulator::WriteLinkPolicySettingsCompleteEvent(TUint8 aError, THCIConnHandle aConnH)
	{
	ClearPacket();

	iConsole.Printf(_L("Sending WriteLinkPolicySettingsComplete Event (error 0x%02x)...\n"), aError);

	PutBytes(KHCIUARTEventHeader);
	PutBytes(KHCICommandCompleteEventCode);
	PutBytes(KHCIWriteLinkPolicySettingsCompleteLength);
	PutBytes(1); //1 command token
	PutBytes(KWriteLinkPolicySettingsOpcode,2);
	PutBytes(aError);
	PutBytes(aConnH, 2);

	WritePacket();	
	}
Esempio n. 16
0
void CHCEmulator::InquiryResultEvent()
	{
	TInt resultsInPacket = Min(((iCurrentInquiryResponse % 5) + 1) , (KEmulatedInquiryNumberDevicesFound - iCurrentInquiryResponse));
	
	ClearPacket();

	TInt error = KHCIOK;

	iConsole.Printf(_L("Sending InquiryResult Event (error 0x%02x)...\n"), error);

	PutBytes(KHCIUARTEventHeader);
	PutBytes(KHCIInquiryResultEventCode);
	PutBytes(1 + (14 * resultsInPacket));
	PutBytes(resultsInPacket);
	
	for (TInt i = 0; i < resultsInPacket; i++)
		{
		// stick them all in one event!
		
		PutAddress(iInquiryAddresses[iCurrentInquiryResponse + i]);
		PutBytes(KEmulatedInquiryPageScanRepetionMode);
		PutBytes(KEmulatedInquiryPageScanPeriodMode);
		PutBytes(KEmulatedInquiryPageScanMode);
		PutBytes(KEmulatedInquiryClassOfDevice,3);
		PutBytes(KEmulatedInquiryClockOffset,2);
		}

	WritePacket();
	
	iCurrentInquiryResponse += resultsInPacket;
	
	// Wait for another result if we've not done them all, else complete inquiry
	if(iCurrentInquiryResponse < KEmulatedInquiryNumberDevicesFound)
		{
		iInquiryTimer->Start();
		}
	else
		{
		InquiryCompleteEvent(KHCIOK);
		}
	}
Esempio n. 17
0
void CHCEmulator::VendorSpecificDebugCompleteEvent(TUint16 aOpCode, const TDesC8& aRemainderBuf)
	{
	ClearPacket();
	
	//  Just send back the payload we got in Vendor Specific Command. This is used by
	//  the tproxy HCIProxy test program, to be found in HCIProxy's directory.

	const TUint KFixedParamSize = 3;
	const TUint KMaxUserParamSize  = 255 - KFixedParamSize;
	TUint userParamSize = (aRemainderBuf.Length() < KMaxUserParamSize) ?
						   aRemainderBuf.Length() : KMaxUserParamSize;

	PutBytes(KHCIUARTEventHeader);
	PutBytes(KHCICommandCompleteEventCode);
	PutBytes(KFixedParamSize + userParamSize);
	PutBytes(1);	// numPackets
	PutBytes(aOpCode, 2);
	for (int i = 0; i < userParamSize; i++)
		PutBytes(aRemainderBuf[i]);

	iConsole.Printf(_L("Sending C.C.E (opcode VendorSpecificDebug), user param size %d...\n"),
					userParamSize);
	WritePacket();
	}
Esempio n. 18
0
GeewaPacket::GeewaPacket() : m_allDataCounter(0), m_opcode(0), m_hasAllData(false)
{
    ClearPacket();
}