📄 svexservice.h
字号:
// Copyright (c) 2006 Murray Read, All rights reserved
#ifndef SVEXSERVICE_H
#define SVEXSERVICE_H
#include <AknServerApp.h>
#include <SvexInfo.h>
// Client side of the Service Info Service.
// To be used through CSvexServiceInfoClient
// Note, this example has a very simple IPC protocol.
// Much more complex protocols are possible.
class RSvexServiceInfo : public RAknAppServiceBase
{
public:
void ShowAllL(TUid aServiceUid);
void ShowAppL(TUid aServiceUid, TUid aAppUid);
private: // from RApaAppServiceBase
// All services must return their UID from ServiceUid()
TUid ServiceUid() const;
};
// Client interface for the Service Info Service.
// This collects the client class together with server app
// lifetime monitoring via the MApaServerAppExitObserver interface.
class CSvexServiceInfoClient : public CBase
{
public:
IMPORT_C static CSvexServiceInfoClient* NewAllL(const CSvexServiceInfo& aServiceInfoService, MApaServerAppExitObserver* aObserver, TUid aServiceUid);
IMPORT_C static CSvexServiceInfoClient* NewAppL(const CSvexServiceInfo& aServiceInfoService, MApaServerAppExitObserver* aObserver, TUid aServiceUid, TUid aAppUid);
IMPORT_C ~CSvexServiceInfoClient();
private:
CSvexServiceInfoClient();
void ConstructL(TUid aApp, MApaServerAppExitObserver* aObserver);
TUid AppForServiceL(const CSvexServiceInfo& aServiceInfoService, TUid aServiceUid);
private:
RSvexServiceInfo iService;
CApaServerAppExitMonitor* iMonitor;
};
// Server side session for the Service Info Service.
// This takes the IPC command IDs from the client and converts
// them to virtual function calls for the server app to implement.
// More complex session support would provide parameter and
// security checking where necessary.
class CSvexServiceInfoSession : public CAknAppServiceBase
{
public:
IMPORT_C CSvexServiceInfoSession();
IMPORT_C ~CSvexServiceInfoSession();
public: // for server apps to implement
// Note to implementers: These functions must not block -
// never block a server function!
virtual void ShowAllL(TUid aServiceUid) = 0;
virtual void ShowAppL(TUid aServiceUid, TUid aAppUid) = 0;
protected: // from CSession2
IMPORT_C void ServiceL(const RMessage2& aMessage);
};
// Server side server class for Service Info Service.
// Server apps may choose whether or not to use this class. They
// may inherit directly from CAknAppServer if they implement
// multiple service types.
// This class makes things easy for server apps that only implement
// the Service Info Service, by converting the CreateServiceL
// call into a virtual call to create a CSvexServiceInfoSession
// when the appropriate service UID is passed.
class CSvexServiceInfoServer : public CAknAppServer
{
public: // from CAknAppServer
IMPORT_C ~CSvexServiceInfoServer();
public: // for server apps to implement
virtual CSvexServiceInfoSession* CreateServiceInfoServiceL() const = 0;
protected:
IMPORT_C CApaAppServiceBase* CreateServiceL(TUid aServiceType) const;
};
// Utility class that collects the registration information of
// apps that support the Service Info Service.
// This allows users to get the service name and supporting app for
// services that have a Service Info Service app.
class CSvexServiceServiceInfo : public CBase
{
public:
IMPORT_C static CSvexServiceServiceInfo* NewLC(const CSvexServiceInfo& aInfo);
IMPORT_C ~CSvexServiceServiceInfo();
public:
IMPORT_C const TDesC& ServiceName(TUid aService) const;
IMPORT_C TUid InfoApp(TUid aService) const;
IMPORT_C static void ExtractInfoLC(const TSvexAppServiceInfo& aInfo, TUid& aServiceMatched, HBufC*& aName);
private:
CSvexServiceServiceInfo();
void ConstructL(const CSvexServiceInfo& aInfo);
void AddInfoL(const TSvexAppServiceInfo& aInfo);
private:
struct SInfo
{
TUid iService;
TUid iApp;
HBufC* iName;
};
private:
const SInfo& Find(TUid aService) const;
private:
RArray<SInfo> iInfo;
TInt iFallback;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -