USB Host Shield 2.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
PS4BT.h
Go to the documentation of this file.
1 /* Copyright (C) 2014 Kristian Lauszus, TKJ Electronics. All rights reserved.
2 
3  This software may be distributed and modified under the terms of the GNU
4  General Public License version 2 (GPL2) as published by the Free Software
5  Foundation and appearing in the file GPL2.TXT included in the packaging of
6  this file. Please note that GPL2 Section 2[b] requires that all works based
7  on this software must also be made publicly available under the terms of
8  the GPL2 ("Copyleft").
9 
10  Contact information
11  -------------------
12 
13  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _ps4bt_h_
19 #define _ps4bt_h_
20 
21 #include "BTHID.h"
22 #include "PS4Parser.h"
23 
28 class PS4BT : public BTHID, public PS4Parser {
29 public:
36  PS4BT(BTD *p, bool pair = false, const char *pin = "0000") :
37  BTHID(p, pair, pin) {
39  };
40 
45  bool connected() {
46  return BTHID::connected;
47  };
48 
53  void attachOnInit(void (*funcOnInit)(void)) {
54  pFuncOnInit = funcOnInit;
55  };
56 
57 protected:
65  virtual void ParseBTHID(BTHID *bthid, uint8_t len, uint8_t *buf) {
66  PS4Parser::Parse(len, buf);
67  };
68 
74  virtual void OnInitBTHID() {
75  if (pFuncOnInit)
76  pFuncOnInit(); // Call the user function
77  };
78 
80  virtual void ResetBTHID() {
82  };
85 private:
86  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
87 };
88 #endif
void Reset()
Definition: PS4Parser.h:260
Definition: BTD.h:230
virtual void ParseBTHID(BTHID *bthid, uint8_t len, uint8_t *buf)
Definition: PS4BT.h:65
bool connected()
Definition: PS4BT.h:45
bool connected
Definition: BTHID.h:92
void attachOnInit(void(*funcOnInit)(void))
Definition: PS4BT.h:53
void Parse(uint8_t len, uint8_t *buf)
Definition: PS4Parser.cpp:76
virtual void ResetBTHID()
Definition: PS4BT.h:80
PS4BT(BTD *p, bool pair=false, const char *pin="0000")
Definition: PS4BT.h:36
virtual void OnInitBTHID()
Definition: PS4BT.h:74
Definition: BTHID.h:29
void pair(void)
Definition: BTHID.h:95
Definition: PS4BT.h:28