fome-fw/firmware/console/binary/bluetooth.h

48 lines
1.3 KiB
C
Raw Normal View History

2017-06-04 05:52:44 -07:00
/**
* @file tunerstudio.h
*
* @date Aug 26, 2013
2020-01-13 18:57:43 -08:00
* @author Andrey Belomutskiy, (c) 2012-2020
2017-06-04 05:52:44 -07:00
*/
#ifndef BLUETOOTH_H_
#define BLUETOOTH_H_
2018-09-16 19:25:17 -07:00
#include "global.h"
2017-06-04 05:52:44 -07:00
#include "tunerstudio_io.h"
// The Bluetooth setup procedure will wait 10 seconds for the user to disconnect the UART cable.
// This is required because the BT setup procedure reads a response from the module during the communication.
// Thus any bytes sent from the Console Software may interfere with the procedure.
2019-01-28 17:00:17 -08:00
#define BLUETOOTH_COMMAND_TIMEOUT TIME_MS2I(10000)
2017-06-04 05:52:44 -07:00
// Supported Bluetooth module types
typedef enum {
2017-06-04 15:07:02 -07:00
BLUETOOTH_HC_05,
2017-06-04 05:52:44 -07:00
BLUETOOTH_HC_06,
BLUETOOTH_SPP,
2017-06-04 05:52:44 -07:00
} bluetooth_module_e;
/**
* Start Bluetooth module initialization using UART connection:
* - wait for PC communication disconnect;
* - reconfigure the UART;
* - send AT-commands to the module;
* - restore connection to PC.
*/
void bluetoothStart(ts_channel_s *tsChannel, bluetooth_module_e moduleType, const char *baudRate, const char *name, const char *pinCode);
/**
* Cancel Bluetooth procedure
*/
void bluetoothCancel(void);
/**
* Called by runBinaryProtocolLoop() if a connection disconnect is detected.
* Bluetooth init code needs to make sure that there's no interference of the BT module and USB-UART (connected to PC)
*/
void bluetoothSoftwareDisconnectNotify();
#endif /* BLUETOOTH_H_ */