1 /* 2 * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com 3 * Copyright 2008 Mika Lindqvist, monni1995_at_gmail.com 4 * All rights reserved. Distributed under the terms of the MIT License. 5 */ 6 #ifndef _HCIDELEGATE_H_ 7 #define _HCIDELEGATE_H_ 8 9 #include <fcntl.h> 10 #include <unistd.h> 11 #include <stdio.h> 12 #include <Path.h> 13 14 #include <bluetooth/HCI/btHCI_transport.h> 15 16 typedef void* raw_command; 17 18 19 class HCIDelegate { 20 21 public: 22 HCIDelegate(BPath* path) 23 { 24 //TODO create such queue 25 fIdentifier = -1; 26 } 27 28 29 hci_id Id(void) const 30 { 31 return fIdentifier; 32 } 33 34 35 virtual ~HCIDelegate() 36 { 37 38 } 39 40 virtual status_t IssueCommand(raw_command rc, size_t size)=0; 41 // TODO means to be private use QueueCommand 42 virtual status_t Launch()=0; 43 44 45 void FreeWindow(uint8 slots) 46 { 47 // TODO: hci control flow 48 } 49 50 51 status_t QueueCommand(raw_command rc, size_t size) 52 { 53 // TODO: this is suposed to queue the command in a queue so all 54 // are actually send to HW to implement HCI FlowControl requeriments 55 return IssueCommand(rc, size); 56 } 57 58 protected: 59 60 hci_id fIdentifier; 61 62 private: 63 64 }; 65 66 #endif 67