blob: de1dcb90f506dcce8df4fd162ad4673d66476fbf [file] [log] [blame]
Mark Salyzyn0175b072014-02-26 09:50:16 -08001/*
2 * Copyright (C) 2012-2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of 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,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _COMMANDLISTENER_H__
18#define _COMMANDLISTENER_H__
19
20#include <sysutils/FrameworkListener.h>
21#include "LogCommand.h"
22#include "LogBuffer.h"
23#include "LogReader.h"
24#include "LogListener.h"
25
26class CommandListener : public FrameworkListener {
27 LogBuffer &mBuf;
28
29public:
30 CommandListener(LogBuffer *buf, LogReader *reader, LogListener *swl);
31 virtual ~CommandListener() {}
32
33private:
34 class ShutdownCmd : public LogCommand {
35 LogBuffer &mBuf;
36 LogReader &mReader;
37 LogListener &mSwl;
38
39 public:
40 ShutdownCmd(LogBuffer *buf, LogReader *reader, LogListener *swl);
41 virtual ~ShutdownCmd() {}
42 int runCommand(SocketClient *c, int argc, char ** argv);
43 };
44
45#define LogBufferCmd(name) \
46 class name##Cmd : public LogCommand { \
47 LogBuffer &mBuf; \
48 public: \
49 name##Cmd(LogBuffer *buf); \
50 virtual ~name##Cmd() {} \
51 int runCommand(SocketClient *c, int argc, char ** argv); \
52 };
53
54 LogBufferCmd(Clear)
55 LogBufferCmd(GetBufSize)
Mark Salyzyndfa7a072014-02-11 12:29:31 -080056#ifdef USERDEBUG_BUILD
57 LogBufferCmd(SetBufSize)
58#endif
Mark Salyzyn0175b072014-02-26 09:50:16 -080059 LogBufferCmd(GetBufSizeUsed)
Mark Salyzyn34facab2014-02-06 14:48:50 -080060 LogBufferCmd(GetStatistics)
Mark Salyzyndfa7a072014-02-11 12:29:31 -080061#ifdef USERDEBUG_BUILD
62 LogBufferCmd(GetPruneList)
63 LogBufferCmd(SetPruneList)
64#endif
Mark Salyzyn0175b072014-02-26 09:50:16 -080065};
66
67#endif