EV3RT CXX API Reference [English]
An RTOS-based development platform for LEGO Mindstorms EV3.
ev3cxx_bluetooth.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include <stdio.h>
10 
11 #include "ev3api.h"
12 #include "ev3cxx_format.h"
13 #include "ev3cxx_file.h"
14 
15 namespace ev3cxx {
16 
22 class Bluetooth : public File
23 {
24 public:
29  Bluetooth() : File() {}
30 
31  Bluetooth(bool_t open_bt) : File() {
32  if(open_bt) {
33  open();
34  }
35  }
36 
42 
48  virtual bool_t open(const char * filename = "", const char * mode = "w+") {
49  if(m_filedesc == NULL) {
50  m_filedesc = ev3_serial_open_file(EV3_SERIAL_BT);
51  }
52  return (m_filedesc != NULL);
53  }
54 
60  virtual bool_t isOpen() {
61  return (m_filedesc != NULL);
62  }
63 
70  bool_t isConnected() {
71  return ev3_bluetooth_is_connected();
72  }
73 
79  virtual int close() {
80  return 0;
81  }
82 }; // class Bluetooth
83 
84 } // namespace ev3cxx
Definition: ev3cxx.h:35
virtual bool_t isOpen()
Return if is bluetooth port open.
FILE * m_filedesc
file of this class
Definition: ev3cxx_file.h:152
API for formating data to output (display, bluetooth, file)
bool_t isConnected()
It is checked whether Bluetooth (Serial Port Profile) is connected.
Class Bluetooth. API for working with bluetooth.
~Bluetooth()
Destructor of class Bluetooth - DO NOTHING.
Bluetooth()
Constructor of class Bluetooth. Don&#39;t open bluetooth port. For opening port call open().
virtual int close()
Close the Bluetooth - DO NOTHING.
Class File. API for working with file.
Definition: ev3cxx_file.h:20
virtual bool_t open(const char *filename="", const char *mode="w+")
Opening serial port on bluetooth. Params are not used.
EV3RT CPP API for file.