示例#1
0
/////////////////////////////////////////////////////////////////////////////////////
// constructor class TPdfFrontend
TPdfFrontend::TPdfFrontend()
{
	// clears document list and documents
	DocumentList.Clear();
	Documents.Clear();
	
	// setup button handlers
	CreateButton	<<= THISBACK(onCreate);
	CancelButton	<<= THISBACK(onCancel);
	
	// install the SIGHUP handler
	Signals().Handle(SIGHUP, THISBACK(onSIGHUP));

	// restores fax documents left from previous run, if any
	String DataPath = GetPdfDataPath();
	FindFile ff(DataPath + "*-*");
	while(ff)
	{
		if(ff.GetName() != "seqf")
			Documents.Add(DataPath + ff.GetName());
		ff.Next();
	}
	Sort(Documents);
	for(int i = 0; i < Documents.GetCount(); i++)
	{
		// inside list puts just the document name, skipping
		// the sequence number (4 digits)
		// nnnn-s-name
		DocumentList.Add(GetFileName(Documents[i]).Mid(5));
	}

	CtrlLayout(*this, "MaxPdf");
}
示例#2
0
TInt DChannelComm::DoControl(TInt aFunction, TAny* a1, TAny* a2)
	{

	TCommConfigV01 c;
	TInt r = KErrNone;

	switch (aFunction)
		{
		case RBusDevComm::EControlConfig:
			{
			//get the current configuration
			TPtrC8 cfg((const TUint8*)&iConfig, sizeof(iConfig));
			r = Kern::ThreadDesWrite(iClient, a1, cfg, 0, KTruncateToMaxLength, iClient);
			break;
			}

		case RBusDevComm::EControlSetConfig:
			{
			if (AreAnyPending())	
				Kern::PanicCurrentThread(_L("D32COMM"), ESetConfigWhileRequestPending);
			else
				{
				memclr(&c, sizeof(c));
				TPtr8 cfg((TUint8*)&c, 0, sizeof(c));
				r = Kern::ThreadDesRead(iClient, a1, cfg, 0, 0);
				if (r == KErrNone)
					r = SetConfig(c);	//set the new configuration
				}
			break;
			}

		case RBusDevComm::EControlCaps:
			{
			//get capabilities
			TCommCaps2 caps;
			PddCaps(caps);	//call ipdd->Caps
			r = Kern::ThreadDesWrite(iClient, a1, caps, 0, KTruncateToMaxLength, iClient);
			break;
			}

		case RBusDevComm::EControlSignals:
			{
			r = Signals();
			break;
			}

		case RBusDevComm::EControlSetSignals:
			{
//			if (((TUint)a1)&((TUint)a2))	//can't set and clear at same time
//				{
//				Kern::PanicCurrentThread(_L("D32COMM"), ESetSignalsSetAndClear);
//				}
//			else
				{

				SetSignals((TUint)a1, (TUint)a2);
				}
			break;
			}

		case RBusDevComm::EControlQueryReceiveBuffer:
			r = RxCount();
			break;

		case RBusDevComm::EControlResetBuffers:
			if (AreAnyPending())
				Kern::PanicCurrentThread(_L("D32COMM"), EResetBuffers);
			else
				ResetBuffers(ETrue);
			break;

		case RBusDevComm::EControlReceiveBufferLength:
			r = RxBufferSize();
			break;

		case RBusDevComm::EControlSetReceiveBufferLength:
			if (AreAnyPending())
				Kern::PanicCurrentThread(_L("D32COMM"), ESetReceiveBufferLength);
			else
				r = SetRxBufferSize((TInt)a1);
			break;

		case RBusDevComm::EControlMinTurnaroundTime:
			r = iTurnaroundMicroSeconds;			// used saved value
			break;

		case RBusDevComm::EControlSetMinTurnaroundTime:
				{
				if ((TInt)a1<0)
					a1=(TAny*)0;
				iTurnaroundMicroSeconds = (TUint)a1;			// save this
				TUint newTurnaroundMilliSeconds = (TUint)a1/1000;	// convert to ms
				if(newTurnaroundMilliSeconds != iTurnaroundMinMilliSeconds)
					{
					// POLICY: if a new turnaround time is set before the previous running timer has expired and a
					// write request has been queued, the transmission goes ahead immediately
					TurnaroundClear();
					if(newTurnaroundMilliSeconds > 0)
						{
						r = TurnaroundSet(newTurnaroundMilliSeconds);
						}
					}
				}
			break;

		default:
			r = KErrNotSupported;
			}
		return(r);
		}