1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */
16 #include "Log.h"
17 #include "GenericFactory.h"
18 #include "ClientImpl.h"
19 #include "task/TaskAll.h"
20 
createClientInterface()21 ClientInterface* GenericFactory::createClientInterface()
22 {
23     return new ClientImpl();
24 }
25 
createTask(TaskGeneric::TaskType type)26 TaskGeneric* GenericFactory::createTask(TaskGeneric::TaskType type)
27 {
28     TaskGeneric* task;
29     switch(type) {
30     case TaskGeneric::ETaskBatch:
31         task = new TaskBatch();
32         break;
33     case TaskGeneric::ETaskCase:
34         task = new TaskCase();
35         break;
36     case TaskGeneric::ETaskSequential:
37         task = new TaskSequential();
38         break;
39     case TaskGeneric::ETaskProcess:
40         task = new TaskProcess();
41         break;
42     case TaskGeneric::ETaskInput:
43         task = new TaskInput();
44         break;
45     case TaskGeneric::ETaskOutput:
46         task = new TaskOutput();
47         break;
48     case TaskGeneric::ETaskSound:
49         task = new TaskSound();
50         break;
51     case TaskGeneric::ETaskSave:
52         task = new TaskSave();
53         break;
54     // simple elements without its own class
55     case TaskGeneric::ETaskSetup:
56     case TaskGeneric::ETaskAction:
57         task = new TaskGeneric(type);
58         break;
59     case TaskGeneric::ETaskMessage:
60         task = new TaskMessage();
61         break;
62     case TaskGeneric::ETaskDownload:
63         task = new TaskDownload();
64         break;
65     default:
66         LOGE("GenericFactory::createTask unsupported type %d", type);
67         return NULL;
68     }
69     LOGD("GenericFactory::createTask 0x%x, type %d", task, type);
70     return task;
71 }
72 
~GenericFactory()73 GenericFactory::~GenericFactory() {
74 }
75