1009fac99SOliver Ruiz Dorantes /* 2009fac99SOliver Ruiz Dorantes * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com 3e5da0ec5SOliver Ruiz Dorantes * Copyright 2008 Mika Lindqvist, monni1995_at_gmail.com 4009fac99SOliver Ruiz Dorantes * All rights reserved. Distributed under the terms of the MIT License. 5009fac99SOliver Ruiz Dorantes */ 630f1d1f3SOliver Ruiz Dorantes #ifndef _HCIDELEGATE_H_ 730f1d1f3SOliver Ruiz Dorantes #define _HCIDELEGATE_H_ 830f1d1f3SOliver Ruiz Dorantes 930f1d1f3SOliver Ruiz Dorantes #include <fcntl.h> 1030f1d1f3SOliver Ruiz Dorantes #include <unistd.h> 1130f1d1f3SOliver Ruiz Dorantes #include <stdio.h> 1230f1d1f3SOliver Ruiz Dorantes #include <Path.h> 1330f1d1f3SOliver Ruiz Dorantes 1430f1d1f3SOliver Ruiz Dorantes #include <bluetooth/HCI/btHCI_transport.h> 1530f1d1f3SOliver Ruiz Dorantes 1630f1d1f3SOliver Ruiz Dorantes typedef void* raw_command; 1730f1d1f3SOliver Ruiz Dorantes 1830f1d1f3SOliver Ruiz Dorantes 1930f1d1f3SOliver Ruiz Dorantes class HCIDelegate { 2030f1d1f3SOliver Ruiz Dorantes 2130f1d1f3SOliver Ruiz Dorantes public: HCIDelegate(BPath * path)2230f1d1f3SOliver Ruiz Dorantes HCIDelegate(BPath* path) 2330f1d1f3SOliver Ruiz Dorantes { 243205e523SOliver Ruiz Dorantes //TODO create such queue 25*ccf28e4dSOliver Ruiz Dorantes fIdentifier = -1; 2630f1d1f3SOliver Ruiz Dorantes } 2730f1d1f3SOliver Ruiz Dorantes 2848cca06aSOliver Ruiz Dorantes Id(void)29*ccf28e4dSOliver Ruiz Dorantes hci_id Id(void) const 3030f1d1f3SOliver Ruiz Dorantes { 31*ccf28e4dSOliver Ruiz Dorantes return fIdentifier; 3230f1d1f3SOliver Ruiz Dorantes } 3330f1d1f3SOliver Ruiz Dorantes 34e5da0ec5SOliver Ruiz Dorantes ~HCIDelegate()35e5da0ec5SOliver Ruiz Dorantes virtual ~HCIDelegate() 36e5da0ec5SOliver Ruiz Dorantes { 37*ccf28e4dSOliver Ruiz Dorantes 38e5da0ec5SOliver Ruiz Dorantes } 39e5da0ec5SOliver Ruiz Dorantes 40e5da0ec5SOliver Ruiz Dorantes virtual status_t IssueCommand(raw_command rc, size_t size)=0; 41e5da0ec5SOliver Ruiz Dorantes // TODO means to be private use QueueCommand 4248cca06aSOliver Ruiz Dorantes virtual status_t Launch()=0; 4330f1d1f3SOliver Ruiz Dorantes 443205e523SOliver Ruiz Dorantes FreeWindow(uint8 slots)45e5da0ec5SOliver Ruiz Dorantes void FreeWindow(uint8 slots) 46e5da0ec5SOliver Ruiz Dorantes { 47e5da0ec5SOliver Ruiz Dorantes // TODO: hci control flow 483205e523SOliver Ruiz Dorantes } 493205e523SOliver Ruiz Dorantes 50e5da0ec5SOliver Ruiz Dorantes QueueCommand(raw_command rc,size_t size)513205e523SOliver Ruiz Dorantes status_t QueueCommand(raw_command rc, size_t size) 523205e523SOliver Ruiz Dorantes { 53e5da0ec5SOliver Ruiz Dorantes // TODO: this is suposed to queue the command in a queue so all 5406b6c3cbSOliver Ruiz Dorantes // are actually send to HW to implement HCI FlowControl requeriments 553205e523SOliver Ruiz Dorantes return IssueCommand(rc, size); 563205e523SOliver Ruiz Dorantes } 573205e523SOliver Ruiz Dorantes 5830f1d1f3SOliver Ruiz Dorantes protected: 5930f1d1f3SOliver Ruiz Dorantes 60*ccf28e4dSOliver Ruiz Dorantes hci_id fIdentifier; 6130f1d1f3SOliver Ruiz Dorantes 6230f1d1f3SOliver Ruiz Dorantes private: 6330f1d1f3SOliver Ruiz Dorantes 6430f1d1f3SOliver Ruiz Dorantes }; 6530f1d1f3SOliver Ruiz Dorantes 6630f1d1f3SOliver Ruiz Dorantes #endif 67