1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ATHENA_SYSTEM_DEVICE_SOCKET_LISTENER_H_
6 #define ATHENA_SYSTEM_DEVICE_SOCKET_LISTENER_H_
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
19 // This class reads device-data from a socket.
20 class DeviceSocketListener
{
22 DeviceSocketListener(const std::string
& socket_parth
,
24 virtual ~DeviceSocketListener();
26 static void CreateSocketManager(
27 scoped_refptr
<base::TaskRunner
> io_task_runner
);
28 static void ShutdownSocketManager();
30 // This is called on the FILE thread when data is available on the socket.
31 // |data| is guaranteed to be of exactly |data_size| length. Note that the
32 // implementation must not mutate or free the data.
33 virtual void OnDataAvailableOnFILE(const void* data
) = 0;
36 void StartListening();
40 const std::string socket_path_
;
43 DISALLOW_COPY_AND_ASSIGN(DeviceSocketListener
);
48 #endif // ATHENA_SYSTEM_DEVICE_SOCKET_LISTENER_H_