Пример #1
0
EXPORT_C CDesC8Array* CSIP::SupportedSecurityMechanismsL() const
    {
    _LIT8(Ksipsec3gpp , "ipsec-3gpp");
    _LIT8(Ksipdigest, "digest");
    
    CDesC8ArraySeg* mechanisms = new(ELeave)CDesC8ArraySeg(1);
    CleanupStack::PushL(mechanisms);
  
    mechanisms->AppendL(Ksipsec3gpp);
  	mechanisms->AppendL(Ksipdigest);
        
    CleanupStack::Pop(mechanisms);
    
	return mechanisms;
    }
Пример #2
0
EXPORT_C CDesC8Array* CSTAnnounceList::GetAllAddressesL() const
{
	CDesC8ArraySeg* addresses = new (ELeave) CDesC8ArraySeg(5);
	CleanupStack::PushL(addresses);
		
	for (TInt i=0; i<iTiers.Count(); i++)
	{
		TInt addressCount = iTiers[i]->MdcaCount();
		for (TInt j=0; j<addressCount; j++)
		{
			addresses->AppendL((*iTiers[i])[j]);
		}
	}
	
	addresses->Sort();
	
	CleanupStack::Pop(); // addresses
	
	return addresses;
}
void CLocaLogicImpl::GetMessageL(const CBBBtDeviceList* devices,
	const TTime& aAtTime,
	TInt& doSendToIndex, 
	TInt& aMessageCode, TDes& aWithName,
	TDes& aWithTitle, auto_ptr<HBufC8>& aBody) 
{
	CALLSTACKITEM_N(_CL("CLocaLogicImpl"), _CL("GetMessage"));
	TInterpreterAutoLock interpr;

	doSendToIndex=-1;

	TInt count=-1;
	const TBBBtDeviceInfo* dev=0;

	TInt max_seen_priority=-1;

	for (dev=devices->First(); dev; dev=devices->Next()) count++;
	
	python_ptr<PyObject> dict_general(PyDict_New());
	if (! dict_general ) User::Leave(KErrNoMemory);
	AddToPyDict(dict_general, "nodename", iNodeName);
	AddToPyDict(dict_general, "time", aAtTime);
	AddToPyDict(dict_general, "bt_count", count);

	// borrowed
	PyObject* main_module = PyImport_AddModule("__main__");
	if (! main_module ) User::Leave(KErrNoMemory);
	// borrowed
	PyObject* global_dict = PyModule_GetDict(main_module);
	if (! global_dict ) User::Leave(KErrNoMemory);
	// borrowed

	TInt index=0;
	dev=devices->First(); // first is the node itself
	for (dev=devices->Next(); dev; dev=devices->Next()) {
		index++;
		TBuf<15> mac;
		dev->iMAC.IntoStringL(mac);
		AddToPyDict(dict_general, "mac", mac);
		AddToPyDict(dict_general, "majorclass", dev->iMajorClass());
		AddToPyDict(dict_general, "minorclass", dev->iMinorClass());

		TBool found=EFalse;
		python_ptr<PyObject> dict_devstats(PyDict_New());
		{
			TBuf<50> node;
			TDevStats s;
			for(found=iDevStats->FirstStats(*dev, node, s); found; 
					found=iDevStats->NextStats(*dev, node, s)) {
				python_ptr<PyObject> dict_dev(
					DevStatToPyDict(s));
				auto_ptr<HBufC8> node8(HBufC8::NewL(node.Length()+2));
				TPtr8 p=node8->Des();
				iCC->ConvertFromUnicode(p, node);
				node8->Des().ZeroTerminate();
				AddToPyDict(dict_devstats, (char*)node8->Ptr(), dict_dev);
			}
		}
		python_ptr<PyObject> dict_msgstats(0);
		{
			TMessageStats s;
			iMessageStats->GetStatsL(*dev, s);
			dict_msgstats.reset(MessageStatToPyDict(s));
		}
		for (int i=0; i<iFunctions->Count(); i++) {
			TScriptError err=RunScript(main_module,
				global_dict, iFunctions->MdcaPoint(i), max_seen_priority,
				dict_general.get(), dict_devstats.get(), 
				dict_msgstats.get(),
				aMessageCode, aWithName,
				aWithTitle, aBody, iErrorMsgBuf, dev->iMAC()
				);
			if (err>EHighestPriority) {
#if !defined(__WINS__) && !defined(CONTEXTLOCA)
				if (IsInArray(iErrorFunctions, iFunctions->MdcaPoint(i))) {
					PyErr_Clear();
					continue;
				}
#endif
				AddToArrayL(iErrorFunctions, iFunctions->MdcaPoint(i));

				TBuf<50> name;
				TInt state=CCnvCharacterSetConverter::KStateDefault;
				iCC->ConvertToUnicode(name, iFunctions->MdcaPoint(i), state);
				name.SetLength(name.Length()-1);
				if (err==EPythonError) {
					AppendCheckingSpaceL(iErrorMsgBuf, _L(" in script "));
					AppendCheckingSpaceL(iErrorMsgBuf, name);
					ReportPythonError(iErrorMsgBuf);
				} else {
					Reporting().UserErrorLog( iErrorMsgBuf,
						_L(" in script "), name);
				}
			} else if (err==EHighestPriority) {
				doSendToIndex=index;
			}
		}
	}
	/*
	// phone or PDA
	if (aDevice.iMajorClass()==0x02 || (
		aDevice.iMajorClass()==0x01 && 
		aDevice.iMinorClass()>0x03 )) {
	} else {
		return;
	}
	*/

}