blob: 2b8b8e0d969b8d65b20fd131c56a60b3cd28b4b7 [file] [log] [blame]
Keun young Park5eba08f2012-03-26 18:31:29 -07001/*
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
17#ifndef CTSAUDIO_SIGNALPROCESSINGIMPL_H
18#define CTSAUDIO_SIGNALPROCESSINGIMPL_H
19
Elliott Hughes5650bbc2016-09-11 14:43:53 -070020#include <memory>
Keun young Park5eba08f2012-03-26 18:31:29 -070021#include <utils/String8.h>
22
23#include "SignalProcessingInterface.h"
24#include "ClientSocket.h"
25#include "RWBuffer.h"
26
27/**
28 * Implements SignalProcessingInterface
29 */
30class SignalProcessingImpl: public SignalProcessingInterface {
31public:
32 static const android::String8 MAIN_PROCESSING_SCRIPT;
33 SignalProcessingImpl();
34 virtual ~SignalProcessingImpl();
35 /**
36 * @param script main script to call function script
37 */
38 virtual bool init(const android::String8& script);
39
40 virtual TaskGeneric::ExecutionResult run(const android::String8& functionScript,
41 int nInputs, bool* inputTypes, void** inputs,
42 int nOutputs, bool* outputTypes, void** outputs);
43private:
44 bool send(const char* data, int len);
45 bool read(char* data, int len);
46
47private:
48 static const int SCRIPT_PORT = 15010;
Elliott Hughes5650bbc2016-09-11 14:43:53 -070049 std::unique_ptr<ClientSocket> mSocket;
Keun young Park5eba08f2012-03-26 18:31:29 -070050 pid_t mChildPid;
51 bool mChildRunning;
52 RWBuffer mBuffer;
53};
54
55
56#endif //CTSAUDIO_SIGNALPROCESSINGIMPL_H