blob: d16c4a03fc6a87f3d39bcb99ef16c02d1970e103 [file] [log] [blame]
The Android Open Source Project52d4c302009-03-03 19:29:09 -08001//
2// Copyright 2005 The Android Open Source Project
3//
4// Our collection of devices.
5//
6#ifndef _SIM_PHONE_COLLECTION_H
7#define _SIM_PHONE_COLLECTION_H
8
9#include <stdlib.h>
10#include "PhoneData.h"
11
12/*
13 * Only one instance of this class exists. It contains a list of all
14 * known devices, and methods for scanning for devices.
15 */
16class PhoneCollection {
17public:
18 /* get the global instance */
19 static PhoneCollection* GetInstance(void) {
20 if (mpInstance == NULL)
21 mpInstance = new PhoneCollection;
22 return mpInstance;
23 }
24 /* destroy the global instance when shutting down */
25 static void DestroyInstance(void) {
26 delete mpInstance;
27 mpInstance = NULL;
28 }
29
30 /* scan for phones in subdirectories of "directory" */
31 void ScanForPhones(const char* directory);
32
33 /* get phone data */
34 int GetPhoneCount(void) const { return mPhoneList.size(); } // slow
35 PhoneData* GetPhoneData(int idx);
36 PhoneData* GetPhoneData(const char* name);
37
38 /* layout.xml filename -- a string constant used in various places */
39 static const char* kLayoutFile;
40
41private:
42 PhoneCollection(void) {}
43 ~PhoneCollection(void) {}
44
45 /* the phone data; make this a Vector someday */
46 android::List<PhoneData> mPhoneList;
47
48 /* storage for global instance pointer */
49 static PhoneCollection* mpInstance;
50};
51
52#endif // _SIM_PHONE_COLLECTION_H