summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/serial/serial_connection.h
blob: 971684a6cc7573d13a07393ebaa5d65232bb9246 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_
#define CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_
#pragma once

#include <string>

#include "chrome/browser/extensions/api/api_resource.h"

namespace extensions {

class APIResourceEventNotifier;

class SerialConnection : public APIResource {
 public:
  SerialConnection(const std::string& port,
                   APIResourceEventNotifier* event_notifier);
  virtual ~SerialConnection();

  bool Open();
  void Close();

  int Read(unsigned char* byte);
  int Write(const std::string& data);

 private:
  std::string port_;
  int fd_;
};

}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_