diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..aaca436
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,4 @@
+optional_subdirs = [
+    "interfaces",
+    "example-server",
+]
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index 113b6ff..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,99 +0,0 @@
-#
-# Copyright (C) 2009 Dynastream Innovations
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-ifneq ($(BOARD_ANT_WIRELESS_DEVICE),)
-
-LOCAL_PATH := $(call my-dir)
-
-#
-# ANT native library
-#
-
-include $(CLEAR_VARS)
-
-# For known qualcomm smd devices we remap the chip name to "qualcomm-smd"
-
-ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"wcn3680")
-
-BOARD_ANT_WIRELESS_DEVICE := "qualcomm-smd"
-
-endif
-
-ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"wl12xx")
-
-ANT_DIR := src/bluez_hci
-
-else ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"bcm433x")
-
-ANT_DIR := src/bluez_hci
-
-else ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"cg29xx")
-
-ANT_DIR := src/vfs
-
-else ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"qualcomm-smd")
-
-ANT_DIR := src/vfs
-
-else ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"qualcomm-uart")
-
-ANT_DIR := src/bt-vendor_vfs
-
-else ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"qualcomm-hidl")
-
-ANT_DIR := src/qcomm-hidl
-
-else ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"vfs-prerelease")
-
-ANT_DIR := src/vfs
-
-else
-
-$(error Unsupported BOARD_ANT_WIRELESS_DEVICE := $(BOARD_ANT_WIRELESS_DEVICE))
-
-endif # BOARD_ANT_WIRELESS_DEVICE type
-
-COMMON_DIR := src/common
-
-include $(LOCAL_PATH)/$(ANT_DIR)/Android.mk
-
-#
-# ANT Application
-#
-
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES:= \
-	$(LOCAL_PATH)/src/common/inc \
-	$(LOCAL_PATH)/app
-
-LOCAL_CFLAGS:= -g -c -W -Wall -O2
-
-LOCAL_SRC_FILES:= \
-	app/ant_app.c
-
-LOCAL_SHARED_LIBRARIES := \
-	libantradio \
-	libcutils
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
-LOCAL_MODULE_TAGS := debug
-LOCAL_MODULE:=antradio_app
-
-include $(BUILD_EXECUTABLE)
-
-
-endif # BOARD_ANT_WIRELESS_DEVICE defined
diff --git a/NOTICE b/NOTICE
index 0dafa6b..4538360 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
 ANT Android System Package
-Copyright 2009-2012 Dynastream Innovations
+Copyright 2009-2018 Dynastream Innovations
 
 This product includes software developed at
 Dynastream Innovations (http://www.dynastream.com/).
\ No newline at end of file
diff --git a/README.md b/README.md
deleted file mode 100644
index d040c04..0000000
--- a/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Linux ANT HAL library #
-
-This repository contains the source to build the ANT HAL library (libantradio.so) for use on Linux based platforms, including Android. Android makefiles are included to configure the build for a specific ANT part which is set in the board config.
-
-## Branches ##
-
-### master ###
-Versions that have been tested and are suitable for consumer devices.
-
-### features/_branch name_ ###
-The latest, untested, development versions of new features and fixes. These are made available for silicon vendors to verify code changes on new parts/boards not yet available to ANT Wireless engineers.
-
-### Third party submissions ###
-If you have code changes (new features, improvements or bug fixes), you should submit a pull request to master. These will be considered, and added to master if accepted, or a features branch if further verification is required.
-
diff --git a/app/ant_app.c b/app/ant_app.c
deleted file mode 100644
index b0090ba..0000000
--- a/app/ant_app.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * ANT Stack testing appication
- *
- * Copyright 2009 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#define _GNU_SOURCE
-
-#include <stdio.h>
-#include <pthread.h>
-#include <string.h>
-#include <errno.h>
-#include <math.h>
-#include <signal.h>
-
-#include "ant_native.h"
-#include "ant_types.h"
-#include "ant_log.h"
-#undef LOG_TAG
-#define LOG_TAG "antradio_app"
-
-/* transient stage */
-typedef ANTStatus ant_status;
-
-void app_ANT_rx_callback(ANT_U8 ucLen, ANT_U8* pucData);
-void app_ANT_state_callback(ANTRadioEnabledStatus uiNewState);
-
-static int Ant_Create(void)
-{
-    ANTStatus antStatus;
-
-    //register_antsig_handlers();
-
-   antStatus = ant_init();
-   if (antStatus)
-   {
-      printf("failed to init ANT rx stacki\n");
-      goto CLEANUP;
-   }
-
-   antStatus = set_ant_rx_callback(app_ANT_rx_callback);
-   if (antStatus)
-   {
-      printf("failed to set ANT rx callback");
-      goto CLEANUP;
-   }
-
-   antStatus = set_ant_state_callback(app_ANT_state_callback);
-   if (antStatus)
-   {
-      printf("failed to set ANT rx callback");
-      goto CLEANUP;
-   }
-   return antStatus;
-
-CLEANUP:
-   return ANT_STATUS_FAILED;
-}
-
-void ProcessCommand(char cCmd)
-{
-   ANT_U8 TxMessage[256];
-   switch (cCmd)
-   {
-      case 'V':
-         TxMessage[0] = 0x02;   //Size
-         TxMessage[1] = 0x4D;   //MESG_REQUEST_ID
-         TxMessage[2] = 0x00;   //Ch0
-         TxMessage[3] = 0x3E;
-         ant_tx_message(4,TxMessage);
-         break;
-      case 'R':
-         TxMessage[0] = 0x01;   //Size
-         TxMessage[1] = 0x4A;   //MESG_RESET_ID
-         TxMessage[2] = 0x00;   //Ch0
-         ant_tx_message(3,TxMessage);
-         break;
-      case 'K':
-         printf("Hard Reset returned: %d\n", ant_radio_hard_reset());
-         break;
-
-      case 'H':
-         //Normally we will not blindly send commands like this and actually check for responses before sending the next command, but this is just for a quick test.
-         ProcessCommand('R');   //Reset chip
-         ProcessCommand('A');   //Assign channel
-         ProcessCommand('F');   //Set RF Freq
-         ProcessCommand('I');   //Set Channel ID
-         ProcessCommand('P');   //Set Channel Period
-         ProcessCommand('O');   //Open Channel
-         break;
-
-      case 'A':
-         TxMessage[0] = 0x03;   //Size
-         TxMessage[1] = 0x42;   //MESG_ASSIGN_ID
-         TxMessage[2] = 0x00;   //Ch0
-         TxMessage[3] = 0x00;   //Assignment Params (Rx channel)
-         TxMessage[4] = 0x01;   //Network 1 (ANT+)
-         ant_tx_message(5,TxMessage);
-         break;
-
-      case 'F':
-         TxMessage[0] = 0x02;   //Size
-         TxMessage[1] = 0x45;   //MESG_CHANNEL_RADIO_FREQ_ID
-         TxMessage[2] = 0x00;   //Ch0
-         TxMessage[3] = 57;   //2.457GHz
-         ant_tx_message(4,TxMessage);
-         break;
-
-      case 'I':
-         TxMessage[0] = 0x05;   //Size
-         TxMessage[1] = 0x51;   //MESG_CHANNEL_ID_ID
-         TxMessage[2] = 0x00;   //Ch0
-         TxMessage[3] = 0x00;   //Wildcard Device Number
-         TxMessage[4] = 0x00;   //Wildcard Device Number
-         TxMessage[5] = 0x78;   //Set HRM Device Type
-         TxMessage[6] = 0x00;   //Wildcard Transmission Type
-         ant_tx_message(7,TxMessage);
-         break;
-
-      case 'P':
-         TxMessage[0] = 0x03;   //Size
-         TxMessage[1] = 0x43;   //MESG_CHANNEL_MESG_PERIOD_ID
-         TxMessage[2] = 0x00;   //Ch0
-         TxMessage[3] = 0x86;   //
-         TxMessage[4] = 0x1F;   // HRM MESG Peroid 0x1F86 (8070)
-         ant_tx_message(5,TxMessage);
-         break;
-
-      case 'O':
-         TxMessage[0] = 0x01;   //Size
-         TxMessage[1] = 0x4B;   //MESG_OPEN_CHANNEL__ID
-         TxMessage[2] = 0x00;   //Ch0
-         ant_tx_message(3,TxMessage);
-         break;
-      case 'E':
-         printf("Enable returned: %d\n", ant_enable_radio());
-         break;
-      case 'D':
-         printf("Disable returned: %d\n", ant_disable_radio());
-         break;
-      case 'S':
-         printf("State is: %d\n", ant_radio_enabled_status());
-         break;
-      case '1':
-         TxMessage[0] = 0x0A;   //Size
-         TxMessage[1] = 0x01;   //Enable
-         TxMessage[2] = 0x00;   //Code upload
-         TxMessage[3] = 0x00;
-         TxMessage[4] = 0x00;
-         TxMessage[5] = 0x00;
-         TxMessage[6] = 0x00;
-         TxMessage[7] = 0x00;
-         TxMessage[8] = 0x00;
-         TxMessage[9] = 0x00;
-         TxMessage[10] = 0x00;
-         //ANT_CORE_Send_VS_Command(0xFDD0, 11, TxMessage);
-         printf("Not Implemented\n");
-         break;
-
-      case '2':
-         TxMessage[0] = 0x00;   //Size
-         //ANT_CORE_Send_VS_Command(0xFF22, 1, TxMessage);
-         printf("Not Implemented\n");
-         break;
-
-
-      case 'X':
-         printf("Exiting\n");
-         break;
-
-      default:
-         printf("Invalid command: %#02x\n", cCmd);
-         break;
-   }
-}
-
-
-void app_ANT_rx_callback(ANT_U8 ucLen, ANT_U8* pucData)
-{
-   ANT_U8 i;
-
-   for(i=0; i <ucLen; i++)
-      printf("[%02X]",pucData[i]);
-   switch (pucData[1])
-   {
-      case 0x3E:
-         printf(" ANT FW Version:%s\n", &(pucData[2]));
-         break;
-      case 0x6F:
-         printf(" Chip Reset\n");
-         break;
-      case 0x40:
-         if (pucData[3] != 0x01)
-         {
-            printf(" Response (Ch:%d Mesg:%02X) ", pucData[2], pucData[3]);
-            if (pucData[4] == 0)
-               printf("Success\n");
-            else
-               printf("Error - %02X\n", pucData[4]);
-         }
-         else
-         {
-            printf(" Event (Ch:%d) %02X\n", pucData[2], pucData[4]);
-         }
-         break;
-      case 0x4E:
-         if (pucData[2] == 0)  //we are using channel 0 for HRM
-         {
-            // We are just assuming this is a HRM message and pulling the BPM out, refer to the ANT+ HRM profile documentation for proper/complete decoding instructions.
-            printf(" BPM: %u\n", pucData[10]);
-         }
-         break;
-
-      default:
-
-         break;
-   }
-   return;
-}
-
-void app_ANT_state_callback(ANTRadioEnabledStatus uiNewState)
-{
-   const char *pcState;
-   switch (uiNewState) {
-   case RADIO_STATUS_UNKNOWN:
-      pcState = "UNKNOWN";
-      break;
-   case RADIO_STATUS_ENABLING:
-      pcState = "ENABLING";
-      break;
-   case RADIO_STATUS_ENABLED:
-      pcState = "ENABLED";
-      break;
-   case RADIO_STATUS_DISABLING:
-      pcState = "DISABLING";
-      break;
-   case RADIO_STATUS_DISABLED:
-      pcState = "DISABLED";
-      break;
-   case RADIO_STATUS_NOT_SUPPORTED:
-      pcState = "NOT SUPPORTED";
-      break;
-   case RADIO_STATUS_SERVICE_NOT_INSTALLED:
-      pcState = "SERVICE NOT INSTALLED";
-      break;
-   case RADIO_STATUS_SERVICE_NOT_CONNECTED:
-      pcState = "SERVICE NOT CONNECTED";
-      break;
-   case RADIO_STATUS_RESETTING:
-      pcState = "RESETTING";
-      break;
-   case RADIO_STATUS_RESET:
-      pcState = "RESET";
-      break;
-   default:
-      printf("State change to: %d is an undefined state\n", uiNewState);
-      return;
-   }
-   printf("State change to: %s\n", pcState);
-}
-
-int main(void)
-{
-   char buffer[1024];
-   int ret = 0;
-
-   if (Ant_Create())
-   {
-      printf("failed to init ANT\n");
-      goto out;
-   }
-
-   printf("===ANT Test===\n");
-   printf("Using libantradio version:\n");
-   printf("%s\n", ant_get_lib_version());
-   printf("\n");
-   printf("Press V to get Version\n");
-   printf("Press R to Reset\n");
-   printf("Press K to hard reset\n");
-   printf("Press H to setup an ANT+ HRM rx channel\n");
-   printf("\n");
-   printf("Press A to Assign channel\n");
-   printf("Press F to set radio Frequency\n");
-   printf("Press I to set channel Id\n");
-   printf("Press P to set channel Peroid\n");
-   printf("Press O to Open channel\n");
-   printf("\n");
-   printf("Press E to Enable ANT\n");
-   printf("Press D to Disable ANT\n");
-   printf("Press S to get State\n");
-   printf("\n");
-   printf("Press X to eXit\n");
-
-   while (1)
-   {
-      memset(&buffer,0,sizeof(buffer));
-      fgets(buffer, sizeof(buffer), stdin);
-      ProcessCommand(buffer[0]);
-      if (buffer[0] == 'X')
-         goto done;
-   }
-
-done:
-   ProcessCommand('R');
-   sleep(1);
-   ProcessCommand('D');
-   ant_deinit();
-
-
-out:
-   return ret;
-}
-
diff --git a/app/ant_app.h b/app/ant_app.h
deleted file mode 100644
index 1806975..0000000
--- a/app/ant_app.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2009 Dynastream Innovations
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and  
- * limitations under the License.
- */
-
-
-#ifndef __ANT_APP_H
-#define __ANT_APP_H
-
-
-
-#endif
diff --git a/example-server/Android.bp b/example-server/Android.bp
new file mode 100644
index 0000000..7dc1614
--- /dev/null
+++ b/example-server/Android.bp
@@ -0,0 +1,23 @@
+/*
+ * The example server is a standalone daemon, however
+ * vendor implementations may combine with other hal server daemons.
+ */
+cc_binary {
+    name: "com.dsi.ant@1.0-example",
+    relative_install_path: "hw",
+    proprietary: true,
+    srcs: [
+        "src/Ant.cpp",
+        "src/Server.cpp"
+    ],
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libutils",
+        "liblog",
+        "com.dsi.ant@1.0",
+    ],
+    init_rc: [
+        "com.dsi.ant@1.0-example.rc",
+    ],
+}
diff --git a/example-server/README.txt b/example-server/README.txt
new file mode 100644
index 0000000..246b9f9
--- /dev/null
+++ b/example-server/README.txt
@@ -0,0 +1,11 @@
+This folder contains an example implementation of a HAL client for ant.
+
+This example expects to be able to use a unix domain socket located at
+/dev/socket/ant. The sepolicy directory shows example policy to use
+as a starting point for the vendor policy, and vintf contains a fragment
+that should be added to the vendor manifest.xml in order to advertise
+that the service is provided.
+
+Note that the example policy does not currently contain the pieces that
+are needed to actually open and use the socket.
+
diff --git a/example-server/com.dsi.ant@1.0-example.rc b/example-server/com.dsi.ant@1.0-example.rc
new file mode 100644
index 0000000..8595b8c
--- /dev/null
+++ b/example-server/com.dsi.ant@1.0-example.rc
@@ -0,0 +1,4 @@
+service ant_hal_service /vendor/bin/hw/com.dsi.ant@1.0-example
+    class hal
+    user system
+    group system
diff --git a/example-server/sepolicy/ant_example_server.te b/example-server/sepolicy/ant_example_server.te
new file mode 100644
index 0000000..31fa595
--- /dev/null
+++ b/example-server/sepolicy/ant_example_server.te
@@ -0,0 +1,10 @@
+type ant_hidl_example, domain;
+type ant_hidl_example_exec, exec_type, vendor_file_type, file_type;
+
+init_daemon_domain(ant_hidl_example);
+hal_server_domain(ant_hidl_example, hal_dsi_ant);
+
+# Any other permissions needed by the server go here.
+# For example, to allow opening the proper socket/char devices
+# needed to communicate with the hardware
+
diff --git a/example-server/sepolicy/file_contexts b/example-server/sepolicy/file_contexts
new file mode 100644
index 0000000..0547ba0
--- /dev/null
+++ b/example-server/sepolicy/file_contexts
@@ -0,0 +1,2 @@
+/vendor/bin/hw/com\.dsi\.ant\@1\.0-example          u:object_r:ant_hidl_example_exec:s0
+
diff --git a/example-server/src/Ant.cpp b/example-server/src/Ant.cpp
new file mode 100644
index 0000000..2c25e97
--- /dev/null
+++ b/example-server/src/Ant.cpp
@@ -0,0 +1,465 @@
+/*
+ * ANT Android Host Stack
+ *
+ * Copyright 2018 Dynastream Innovations
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "Ant Hidl Example"
+
+#include <cassert>
+#include <cstring>
+
+#include <limits>
+#include <sstream>
+#include <stdexcept>
+
+#include <sys/eventfd.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <poll.h>
+
+#include "log/log.h"
+
+#include "Ant.h"
+
+// NOTE: Code here holds mutex locks while making callbacks. This is fine in this case since
+// all of the callback methods are marked as oneway in the hal and therefore are non-blocking.
+
+namespace com {
+namespace dsi {
+namespace ant {
+namespace V1_0 {
+namespace example {
+
+// Convenience typedef, since we only use one type of mutex.
+typedef std::lock_guard<std::mutex> lock;
+
+// Header for framing ANT messages to go to the chip.
+struct MsgHeader {
+    uint8_t channel_id;
+    uint8_t payload_len;
+
+    static const size_t max_payload = std::numeric_limits<uint8_t>::max();
+};
+
+// Error classes. This implementation uses the upper 16 bits of a status code
+// to indicate a class, and the lower 16 bits as an associated errno value.
+// It assumes that all errno values fit, which is currently the case in the
+// errno.h header used by android.
+// see translateStatus to understand exactly what each error code means.
+enum errors : uint16_t {
+    GENERIC_ERR,
+    SOCKET_ERR,
+    CONNECT_ERR,
+    EFD_ERR,
+    NOFD_ERR,
+    LARGEMSG_ERR,
+};
+
+// Convenience to not need the fully scoped name every time.
+static const Status STATUS_OK = (Status)CommonStatusCodes::OK;
+
+// Example implementation uses an UNIX domain socket, which allows for
+// adb reverse-forwarding to be used.
+static const sockaddr_un socket_addr = {
+    AF_UNIX,
+    "/dev/socket/ant",
+    };
+
+static const int poll_timeout_ms = 1000 * 5;
+
+// Implementation properties are constant.
+static const ImplProps props = {
+    "ant.hidl.example.1.0",
+    OptionFlags::USE_KEEPALIVE | OptionFlags::USE_ANT_FLOW_CONTROL,
+};
+
+// Bit manipulation for status codes.
+
+static Status makeStatus(uint32_t cls, uint32_t err_code)
+{ return ((cls << 16)|(err_code & 0xffff)); }
+
+static uint16_t getErrClass(Status status)
+{ return (uint16_t)((status >> 16) & 0xffff); }
+
+static uint16_t getErrCode(Status status)
+{ return (uint16_t)(status & 0xffff); }
+
+// Convenience stuff for file descriptors.
+static bool isValidFd(int fd) { return fd >= 0; }
+
+static int invalid_fd = -1;
+
+class MessageReader {
+public:
+    MessageReader(int fd) : fd(fd), read_idx(0) {}
+    int checkForMessages(const sp<IAntCallbacks> &callbacks);
+
+private:
+    int fd;
+    uint8_t read_buf[sizeof(MsgHeader) + MsgHeader::max_payload];
+    size_t read_idx;
+};
+
+int MessageReader::checkForMessages(const sp<IAntCallbacks> &callbacks) {
+
+    // First consume any new data that is available.
+    ssize_t read_result = read(
+        fd,
+        &read_buf[read_idx],
+        sizeof(read_buf) - read_idx);
+
+    if (read_result < 0) {
+        switch(errno) {
+        case EAGAIN:
+        case EINTR:
+            // These errors are okay, act like no data read.
+            read_result = 0;
+            break;
+        default:
+            return errno;
+        };
+    }
+
+    read_idx += read_result;
+
+    // Now dispatch all read messages.
+
+    // Alias the front of the buffer as a message header.
+    MsgHeader *header = (MsgHeader*)read_buf;
+
+    size_t full_size = header->payload_len + sizeof(MsgHeader);
+    while (read_idx >= sizeof(MsgHeader) && read_idx >= full_size) {
+
+        assert((header->channel_id == Ant::command_channel_id) ||
+            (header->channel_id == Ant::data_channel_id));
+
+        if (callbacks != NULL) {
+            hidl_vec<uint8_t> msg;
+            msg.setToExternal(read_buf + sizeof(MsgHeader), header->payload_len);
+            callbacks->onMessageReceived(msg);
+        }
+
+        if (read_idx > full_size) {
+            // There's (part of) another message, move it to the front of the buffer.
+            std::memmove(read_buf, read_buf + full_size, read_idx - full_size);
+        }
+        read_idx -= full_size;
+        full_size = header->payload_len + sizeof(MsgHeader);
+    }
+
+    return STATUS_OK;
+}
+
+Ant::Ant():
+   transport_fd(invalid_fd),
+   shutdown_fd(invalid_fd),
+   stop_polling(true)
+   {}
+
+// Methods from IAnt follow.
+Return<void> Ant::getProperties(getProperties_cb _hidl_cb) {
+    _hidl_cb(props);
+    return Void();
+}
+
+Return<void> Ant::setCallbacks(const sp<IAntCallbacks>& callbacks) {
+    // Keep a reference to the old value around until we are outside of the
+    // locked scope. See RefBase.h for why this is needed.
+    sp<IAntCallbacks> old;
+    {
+        lock l(state_mtx);
+        old = this->callbacks;
+        this->callbacks = callbacks;
+    }
+
+    return Void();
+}
+
+Return<void> Ant::translateStatus(Status status, translateStatus_cb _hidl_cb) {
+    std::ostringstream err;
+    uint16_t err_class = getErrClass(status);
+    uint16_t err_code = getErrCode(status);
+
+    switch(err_class) {
+    case GENERIC_ERR:
+        break;
+    case SOCKET_ERR:
+        err << "Socket creation failed.";
+        break;
+    case CONNECT_ERR:
+        err << "Socket connect failed.";
+        break;
+    case EFD_ERR:
+        err << "Event fd not created.";
+        break;
+    case NOFD_ERR:
+        err << "Transport not open.";
+        break;
+    case LARGEMSG_ERR:
+        err << "Provided message too big.";
+        break;
+    default:
+        err << "Unknown Error Class (" << err_class << ").";
+        break;
+    };
+
+    if (err_code) {
+        // Add a space between class and error string, only if a class string was
+        // added (ie. length > 0)
+        if (err.tellp() > 0) {
+            err << " ";
+        }
+        err << strerror(err_code);
+    }
+
+    _hidl_cb(err.str());
+    return Void();
+}
+
+Return<Status> Ant::enable() {
+    // Early returns are used to bail out here, this is okay in this case though
+    // since disable will always be used to recover, and we deal with any inconsistent state there.
+
+    ALOGV("Enabling");
+
+    lock l(state_mtx);
+
+    stop_polling = false;
+
+    // Open the local socket that is adb-forwarded somewhere. Actual implementations
+    // would maybe open a character device here.
+    // The socket is non-blocking since the poll loop waits for data anyways.
+    transport_fd = socket(AF_UNIX, SOCK_STREAM|SOCK_NONBLOCK, 0);
+    if (!isValidFd(transport_fd)) {
+        return makeStatus(SOCKET_ERR, errno);
+    }
+
+    if (connect(transport_fd, (const sockaddr*)&socket_addr, sizeof(socket_addr)) < 0) {
+        return makeStatus(CONNECT_ERR, errno);
+    }
+
+    // Setup the shutdown handle, which is an event-fd that can be used to interrupt
+    // the poll thread when it is stuck in a poll().
+    shutdown_fd = eventfd(0, EFD_NONBLOCK);
+    if (!isValidFd(shutdown_fd)) {
+        return makeStatus(EFD_ERR, errno);
+    }
+
+    // If all state was setup succesfully then the poll thread can be started.
+    poll_thread = std::thread(&Ant::pollThreadEntry, this);
+
+    return STATUS_OK;
+}
+
+Return<Status> Ant::disable() {
+    ALOGV("Disabling");
+
+    // Used to capture the value of the poll thread.
+    std::thread old_poll;
+
+    {
+        // Use a scope block, since we need to be unlocked while joining the thread.
+        lock l(state_mtx);
+
+        std::swap(old_poll, poll_thread);
+        if (isValidFd(shutdown_fd)) {
+            uint64_t shutdown_evt = 1;
+            if (write(shutdown_fd, &shutdown_evt, sizeof(shutdown_evt)) < 0) {
+                ALOGW("Shutdown sending signal failed. %s", strerror(errno));
+            }
+        }
+
+        stop_polling = true;
+    }
+
+    if (old_poll.get_id() != std::thread::id()) {
+        // NOTE: if it's possible for the poll thread to get stuck it might
+        // be better to do a timed wait on a future<void> set by the threads exit.
+        // If a timeout occurs the thread should be detached instead of joined.
+        old_poll.join();
+    }
+
+    // At this point the poll thread should be stopped, meaning it's safe to start
+    // cleaning up files. The state lock is still held to make sure we don't close
+    // the handles on any message writes in progress.
+
+    lock l2(state_mtx);
+
+    if (isValidFd(shutdown_fd)) {
+        if (close(shutdown_fd) < 0) {
+            ALOGW("Could not cleanly close event_fd. %s", strerror(errno));
+        }
+    }
+    shutdown_fd = invalid_fd;
+
+    if (isValidFd(transport_fd)) {
+        if (close(transport_fd) < 0) {
+            ALOGW("Could not cleanly close transport_fd. %s", strerror(errno));
+        }
+    }
+    transport_fd = invalid_fd;
+
+    return STATUS_OK;
+}
+
+void Ant::pollThreadEntry() {
+    bool should_quit = false;
+    MessageReader reader(transport_fd);
+    // This remains empty as long as no error occured.
+    std::string err_msg;
+
+    struct poll_fds_t {
+       pollfd transport;
+       pollfd shutdown;
+    } poll_fds;
+
+    // Static setup for poll loop.
+    // The only non-error event that matters is the data ready event.
+    poll_fds.transport.fd = transport_fd;
+    poll_fds.transport.events = POLLIN;
+    poll_fds.shutdown.fd = shutdown_fd;
+    poll_fds.shutdown.events = POLLIN;
+
+    class poll_err : public std::runtime_error {};
+
+    // Error cases just bail straight out of the thread
+    while(!should_quit) {
+        // Clear out previous events.
+        poll_fds.transport.revents = 0;
+        poll_fds.shutdown.revents = 0;
+
+        int poll_result = poll((pollfd*)&poll_fds, sizeof(poll_fds)/sizeof(pollfd), poll_timeout_ms);
+
+        // Now that poll is done grab the state lock, the rest should be quick, since all
+        // operations are non-blocking.
+        lock l(state_mtx);
+
+        should_quit = stop_polling;
+
+        // Only care to differentiate error case, and ignore EINTR errors.
+        if (poll_result < 0 && errno != EINTR) {
+            err_msg = std::string("Poll call failed. ") + strerror(errno);
+            break;
+        }
+
+        if (poll_fds.transport.revents) {
+            if (poll_fds.transport.revents != POLLIN) {
+                std::ostringstream err_bld("Poll error flags on transport file: ");
+                err_bld << (int)poll_fds.transport.revents;
+                err_msg = err_bld.str();
+                break;
+            }
+
+            int read_result = reader.checkForMessages(callbacks);
+            if (read_result != STATUS_OK) {
+                err_msg =  std::string("Could not read available data") + strerror(read_result);
+                break;
+            }
+        }
+
+        if (poll_fds.shutdown.revents) {
+            if (poll_fds.shutdown.revents != POLLIN) {
+                std::ostringstream err_bld("Poll error flags on shutdown file: ");
+                err_bld << (int)poll_fds.shutdown.revents;
+                err_msg = err_bld.str();
+                break;
+            }
+
+            // No need to read, the eventfd is only signaled when shutting down.
+            should_quit = true;
+        }
+    }
+
+    if (!err_msg.empty()) {
+        lock l(state_mtx);
+        if (callbacks != NULL) {
+            callbacks->onTransportDown(err_msg);
+        }
+    }
+
+    return;
+}
+
+Status Ant::writeMsg(const hidl_vec<uint8_t> &msg, uint8_t channel_id) {
+    if (msg.size() > MsgHeader::max_payload) {
+        return makeStatus(LARGEMSG_ERR, 0);
+    }
+
+    // Lock is held for full function to make sure the fd isn't changed on us.
+    // This should never take long, higher level flow control should ensure
+    // we never block waiting for space in write buffers.
+    lock l(state_mtx);
+    if (!isValidFd(transport_fd)) {
+        return makeStatus(NOFD_ERR, 0);
+    }
+
+    Status retval = STATUS_OK;
+
+    MsgHeader header = {
+        channel_id,
+        (uint8_t)msg.size(),
+    };
+
+    iovec vecs[] = {
+        { (uint8_t*)&header, sizeof(header) },
+        // Cast away the constness of the data.
+        // This is okay because we are only sourcing the data for a write,
+        // but is required because the struct in the writev api is non-const
+        // in order to be shared with readv calls.
+        { const_cast<uint8_t*>(msg.data()), msg.size() },
+    };
+    size_t num_vecs = sizeof(vecs)/sizeof(vecs[0]);
+
+    // Continue until the last chunk has been fully written.
+    while(vecs[num_vecs - 1].iov_len > 0) {
+        ssize_t written = writev(transport_fd, vecs, num_vecs);
+
+        if (written < 0) {
+            if (errno == EINTR) {
+                // EINTR is okay, it means no data was written though.
+                written = 0;
+            } else {
+                retval = makeStatus(GENERIC_ERR, errno);
+                // Abort writing the remainder.
+                break;
+            }
+        }
+
+        // Adjust write to resume with unwritten portion.
+        for (size_t i = 0; i < num_vecs; i++) {
+            if ((size_t)written <= vecs[i].iov_len) {
+                // Chunk was partially written, pointer adjustment needed.
+                vecs[i].iov_len -= written;
+                vecs[i].iov_base = ((uint8_t*)vecs[i].iov_base) + written;
+                // Remaining chunks are unchanged.
+                break;
+            }
+
+            // Chunk fully written, move onto next.
+            vecs[i].iov_len = 0;
+            written -= vecs[i].iov_len;
+        }
+    }
+
+    return retval;
+}
+
+}  // namespace example
+}  // namespace V1_0
+}  // namespace ant
+}  // namespace dsi
+}  // namespace com
diff --git a/example-server/src/Ant.h b/example-server/src/Ant.h
new file mode 100644
index 0000000..5a36c12
--- /dev/null
+++ b/example-server/src/Ant.h
@@ -0,0 +1,89 @@
+/*
+ * ANT Android Host Stack
+ *
+ * Copyright 2018 Dynastream Innovations
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COM_DSI_ANT_V1_0_ANT_H
+#define COM_DSI_ANT_V1_0_ANT_H
+
+#include <mutex>
+#include <thread>
+
+#include <com/dsi/ant/1.0/IAnt.h>
+#include <hidl/Status.h>
+
+namespace com {
+namespace dsi {
+namespace ant {
+namespace V1_0 {
+namespace example {
+
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+struct Ant : public IAnt {
+
+public:
+
+    // These need to be declared here because they are used in the inline versions
+    // of sendData/CommandMessage.
+    static const uint8_t command_channel_id = 0x0C;
+    static const uint8_t data_channel_id = 0x0E;
+
+    // Methods from IAnt follow.
+    Return<void> getProperties(getProperties_cb _hidl_cb) override;
+    Return<void> setCallbacks(const sp<IAntCallbacks>& callbacks) override;
+    Return<void> translateStatus(Status status, translateStatus_cb _hidl_cb) override;
+    Return<Status> enable() override;
+    Return<Status> disable() override;
+
+    Return<Status> sendDataMessage(const hidl_vec<uint8_t>& msg) override
+    { return writeMsg(msg, data_channel_id); }
+    Return<Status> sendCommandMessage(const hidl_vec<uint8_t>& msg) override
+    { return writeMsg(msg, command_channel_id); }
+
+    Ant();
+
+private:
+
+    sp<IAntCallbacks> callbacks;
+    // File handle used for communicating with the ant chip.
+    int transport_fd;
+    // File handle used to signal the poll thread when shutting down.
+    int shutdown_fd;
+    std::thread poll_thread;
+    // This is set to indicate that the poll thread should exit.
+    bool stop_polling;
+    // Coarse mutex for all internal state.
+    std::mutex state_mtx;
+
+    void pollThreadEntry();
+    Status writeMsg(const hidl_vec<uint8_t> &msg, uint8_t channel_id);
+};
+
+
+}  // namespace example
+}  // namespace V1_0
+}  // namespace ant
+}  // namespace dsi
+}  // namespace com
+
+#endif  // COM_DSI_ANT_V1_0_ANT_H
diff --git a/example-server/src/Server.cpp b/example-server/src/Server.cpp
new file mode 100644
index 0000000..9ea376b
--- /dev/null
+++ b/example-server/src/Server.cpp
@@ -0,0 +1,50 @@
+/*
+ * ANT Android Host Stack
+ *
+ * Copyright 2018 Dynastream Innovations
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "Ant Hidl Example"
+
+#include "Ant.h"
+
+#include "log/log.h"
+#include <hidl/HidlTransportSupport.h>
+
+using com::dsi::ant::V1_0::example::Ant;
+using namespace android;
+using namespace android::hardware;
+
+/* Handle 1 data + 1 command + power control. */
+static const uint32_t THREAD_POOL_SIZE = 3;
+
+int main(void) {
+    /*
+     * This is fairly standard daemon code based on
+     * defaultPassthroughServiceImplementation()
+     */
+    ALOGI("Starting example ANT HIDL daemon");
+    configureRpcThreadpool(THREAD_POOL_SIZE, true);
+
+    Ant ant;
+    status_t status = ant.registerAsService();
+    if (status != OK) {
+        ALOGE("Unable to register service: %d", status);
+        return -1;
+    }
+
+    joinRpcThreadpool();
+}
+
diff --git a/example-server/vintf/manifest.xml b/example-server/vintf/manifest.xml
new file mode 100644
index 0000000..12e07cf
--- /dev/null
+++ b/example-server/vintf/manifest.xml
@@ -0,0 +1,10 @@
+<hal format="hidl">
+    <name>com.dsi.ant</name>
+    <transport>hwbinder</transport>
+    <version>1.0</version>
+    <interface>
+        <name>IAnt</name>
+        <instance>default</instance>
+    </interface>
+</hal>
+
diff --git a/interfaces/Android.bp b/interfaces/Android.bp
new file mode 100644
index 0000000..7aef46b
--- /dev/null
+++ b/interfaces/Android.bp
@@ -0,0 +1,3 @@
+subdirs = [
+    "*"
+]
diff --git a/interfaces/ant/1.0/Android.bp b/interfaces/ant/1.0/Android.bp
new file mode 100644
index 0000000..e5ea3d5
--- /dev/null
+++ b/interfaces/ant/1.0/Android.bp
@@ -0,0 +1,96 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+filegroup {
+    name: "com.dsi.ant@1.0_hal",
+    srcs: [
+        "types.hal",
+        "IAnt.hal",
+        "IAntCallbacks.hal",
+    ],
+}
+
+genrule {
+    name: "com.dsi.ant@1.0_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hidl:system/libhidl/transport -rcom.dsi:external/ant-wireless/hidl/interfaces com.dsi.ant@1.0",
+    srcs: [
+        ":com.dsi.ant@1.0_hal",
+    ],
+    out: [
+        "com/dsi/ant/1.0/types.cpp",
+        "com/dsi/ant/1.0/AntAll.cpp",
+        "com/dsi/ant/1.0/AntCallbacksAll.cpp",
+    ],
+}
+
+genrule {
+    name: "com.dsi.ant@1.0_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hidl:system/libhidl/transport -rcom.dsi:external/ant-wireless/hidl/interfaces com.dsi.ant@1.0",
+    srcs: [
+        ":com.dsi.ant@1.0_hal",
+    ],
+    out: [
+        "com/dsi/ant/1.0/types.h",
+        "com/dsi/ant/1.0/hwtypes.h",
+        "com/dsi/ant/1.0/IAnt.h",
+        "com/dsi/ant/1.0/IHwAnt.h",
+        "com/dsi/ant/1.0/BnHwAnt.h",
+        "com/dsi/ant/1.0/BpHwAnt.h",
+        "com/dsi/ant/1.0/BsAnt.h",
+        "com/dsi/ant/1.0/IAntCallbacks.h",
+        "com/dsi/ant/1.0/IHwAntCallbacks.h",
+        "com/dsi/ant/1.0/BnHwAntCallbacks.h",
+        "com/dsi/ant/1.0/BpHwAntCallbacks.h",
+        "com/dsi/ant/1.0/BsAntCallbacks.h",
+    ],
+}
+
+cc_library {
+    name: "com.dsi.ant@1.0",
+    defaults: ["hidl-module-defaults"],
+    generated_sources: ["com.dsi.ant@1.0_genc++"],
+    generated_headers: ["com.dsi.ant@1.0_genc++_headers"],
+    export_generated_headers: ["com.dsi.ant@1.0_genc++_headers"],
+    vendor_available: true,
+    vndk: {
+        enabled: true,
+    },
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+    ],
+}
+
+cc_library {
+    name: "com.dsi.ant@1.0_vendor",
+    defaults: ["hidl-module-defaults"],
+    generated_sources: ["com.dsi.ant@1.0_genc++"],
+    generated_headers: ["com.dsi.ant@1.0_genc++_headers"],
+    export_generated_headers: ["com.dsi.ant@1.0_genc++_headers"],
+    vendor: true,
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+    ],
+}
diff --git a/interfaces/ant/1.0/Android.mk b/interfaces/ant/1.0/Android.mk
new file mode 100644
index 0000000..bf21f0e
--- /dev/null
+++ b/interfaces/ant/1.0/Android.mk
@@ -0,0 +1,198 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := com.dsi.ant-V1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir, COMMON)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+LOCAL_JAVA_LIBRARIES := \
+    android.hidl.base-V1.0-java \
+
+
+#
+# Build types.hal (ImplProps)
+#
+GEN := $(intermediates)/com/dsi/ant/V1_0/ImplProps.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hidl:system/libhidl/transport \
+        -rcom.dsi:external/ant-wireless/hidl/interfaces \
+        com.dsi.ant@1.0::types.ImplProps
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (OptionFlags)
+#
+GEN := $(intermediates)/com/dsi/ant/V1_0/OptionFlags.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hidl:system/libhidl/transport \
+        -rcom.dsi:external/ant-wireless/hidl/interfaces \
+        com.dsi.ant@1.0::types.OptionFlags
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IAnt.hal
+#
+GEN := $(intermediates)/com/dsi/ant/V1_0/IAnt.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IAnt.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IAntCallbacks.hal
+$(GEN): $(LOCAL_PATH)/IAntCallbacks.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hidl:system/libhidl/transport \
+        -rcom.dsi:external/ant-wireless/hidl/interfaces \
+        com.dsi.ant@1.0::IAnt
+
+$(GEN): $(LOCAL_PATH)/IAnt.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IAntCallbacks.hal
+#
+GEN := $(intermediates)/com/dsi/ant/V1_0/IAntCallbacks.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IAntCallbacks.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hidl:system/libhidl/transport \
+        -rcom.dsi:external/ant-wireless/hidl/interfaces \
+        com.dsi.ant@1.0::IAntCallbacks
+
+$(GEN): $(LOCAL_PATH)/IAntCallbacks.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := com.dsi.ant-V1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir, COMMON)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+    android.hidl.base-V1.0-java-static \
+
+
+#
+# Build types.hal (ImplProps)
+#
+GEN := $(intermediates)/com/dsi/ant/V1_0/ImplProps.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hidl:system/libhidl/transport \
+        -rcom.dsi:external/ant-wireless/hidl/interfaces \
+        com.dsi.ant@1.0::types.ImplProps
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (OptionFlags)
+#
+GEN := $(intermediates)/com/dsi/ant/V1_0/OptionFlags.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hidl:system/libhidl/transport \
+        -rcom.dsi:external/ant-wireless/hidl/interfaces \
+        com.dsi.ant@1.0::types.OptionFlags
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IAnt.hal
+#
+GEN := $(intermediates)/com/dsi/ant/V1_0/IAnt.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IAnt.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IAntCallbacks.hal
+$(GEN): $(LOCAL_PATH)/IAntCallbacks.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hidl:system/libhidl/transport \
+        -rcom.dsi:external/ant-wireless/hidl/interfaces \
+        com.dsi.ant@1.0::IAnt
+
+$(GEN): $(LOCAL_PATH)/IAnt.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IAntCallbacks.hal
+#
+GEN := $(intermediates)/com/dsi/ant/V1_0/IAntCallbacks.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IAntCallbacks.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hidl:system/libhidl/transport \
+        -rcom.dsi:external/ant-wireless/hidl/interfaces \
+        com.dsi.ant@1.0::IAntCallbacks
+
+$(GEN): $(LOCAL_PATH)/IAntCallbacks.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/interfaces/ant/1.0/IAnt.hal b/interfaces/ant/1.0/IAnt.hal
new file mode 100644
index 0000000..f837d23
--- /dev/null
+++ b/interfaces/ant/1.0/IAnt.hal
@@ -0,0 +1,105 @@
+/*
+ * ANT Android Host Stack
+ *
+ * Copyright 2018 Dynastream Innovations
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.dsi.ant@1.0;
+
+import IAntCallbacks;
+
+interface IAnt {
+
+    /**** Administrative Methods ****/
+
+    /** Retrieve the static properties of the HAL implementation. */
+    getProperties() generates (ImplProps properties);
+
+    /**
+     * Set up callbacks from HAL implementation to ANTHALService.
+     * The callbacks will be set before any of the other methods below are called.
+     * NULL may also be passed here during shutdown to unregister the callbacks.
+     */
+    setCallbacks(IAntCallbacks callbacks);
+
+    /**
+     * Translate a non-0 status code to a string value. This is used by the ANTHALService
+     * to log operational errors to logcat for debugging purposes.
+     */
+    translateStatus(Status status) generates (string translation);
+
+
+
+    /**** Interface state/power control ****/
+
+    /* General Notes
+     *
+     * The ANTHALService will guarantee that calls to enable and disable are mutually exclusive.
+     * If the ANTHALService detects an error condition it will attempt recovery by disabling
+     * and then re-enabling the interface. This includes cases where enable failed,
+     * so it is strongly suggested that disable is able to recover from an inconsistent state.
+     *
+     * If an asynchronous failure condition is detected then the HAL implementation should
+     * report it through the registered callbacks.
+     */
+
+    /**
+     * Enable the ANT stack and transport.
+     *
+     * This will acquire any needed resources and power up the appropriate subsystems.
+     * The implementation must block until this is complete.
+     */
+    enable() generates (Status status);
+
+    /**
+     * Disable the ANT stack and transport.
+     *
+     * This is called when the ANT protocol is no longer in used. The implementation should power
+     * down any subsystems and release any acquired resources. The implementation must block until
+     * this is complete.
+     */
+    disable() generates (Status status);
+
+
+
+    /**** Message Transport Methods ****/
+
+    /* General Notes
+     *
+     * The ANTHALService will guarantee that these methods will not be called while an enable or
+     * disable is in progress.
+     *
+     * The ANT stack uses two separate channels for message transactions, one for data and one for
+     * commands. For a single channel a new send call will not be made until the previous returns.
+     * However, the HAL implementation must be able to handle a message being sent concurrently on
+     * both channels.
+     *
+     * Any non 0 status returned by these will be treated as a fatal error and cause the host stack
+     * to attempt full recovery of the chip.
+     */
+
+    /**
+     * Send a message on the data channel. The provided message will be raw payload, any required framing must be
+     * added by the HAL implementation.
+     */
+    sendDataMessage(vec<uint8_t> msg) generates (Status status);
+
+    /**
+     * Send a message on the command channel. The provided message will be raw payload, any required framing must be
+     * added by the HAL implementation.
+     */
+    sendCommandMessage(vec<uint8_t> msg) generates (Status status);
+};
+
diff --git a/interfaces/ant/1.0/IAntCallbacks.hal b/interfaces/ant/1.0/IAntCallbacks.hal
new file mode 100644
index 0000000..ffb3919
--- /dev/null
+++ b/interfaces/ant/1.0/IAntCallbacks.hal
@@ -0,0 +1,38 @@
+/*
+ * ANT Android Host Stack
+ *
+ * Copyright 2018 Dynastream Innovations
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.dsi.ant@1.0;
+
+/**
+ * Callbacks to allow the HAL implementation to notify the ANTHALService of events.
+ */
+interface IAntCallbacks {
+
+    /**
+     * Indicate that a message was received on either the data or command channel.
+     */
+    oneway onMessageReceived(vec<uint8_t> data);
+
+    /**
+     * Indicate that a failure condition was detected. The ANTHALService will attempt
+     * a recovery process. The cause parameter is an optional string describing the
+     * failure condition.
+     */
+    oneway onTransportDown(string cause);
+};
+
diff --git a/interfaces/ant/1.0/types.hal b/interfaces/ant/1.0/types.hal
new file mode 100644
index 0000000..8f23078
--- /dev/null
+++ b/interfaces/ant/1.0/types.hal
@@ -0,0 +1,63 @@
+/*
+ * ANT Android Host Stack
+ *
+ * Copyright 2018 Dynastream Innovations
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.dsi.ant@1.0;
+
+/**
+ * Status codes returned from most interface functions. The only requirement is that 0 indicates success.
+ * Otherwise all values are specific to the HAL implementation.
+ */
+typedef int32_t Status;
+
+/**
+ * Status code 0 is used to indicate success. All other status codes are vendor-defined and
+ * can be converted to a string description using translateStatus in IAnt.
+ */
+enum CommonStatusCodes : Status {
+    OK = 0,
+};
+
+/**
+ * Various flags that can be used by the server to modify the behavior of the ANTHALService.
+ * These should be static for a given implementation.
+ */
+enum OptionFlags : uint32_t {
+    /**
+     * This flag indicates that keep alive should be used. When the ANT transport is idle
+     * for an extended period of time the ANTHALService will use a ping message to verify
+     * that the stack is still responding.
+     */
+    USE_KEEPALIVE = 1 << 0,
+    /**
+     * Whether the data channel flow control is encapsulated in ANT message. The value to
+     * set for this depends on the ANT protocol stack implementation being used.
+     */
+    USE_ANT_FLOW_CONTROL = 1 << 1,
+};
+
+/**
+ * A set of properties describing the vendor implementation of the HAL. These will be requested
+ * by the ANTHALService on startup.
+ */
+struct ImplProps {
+    /** A version string describing the implementation. Should be unique for every public release */
+    string version;
+    /** Flags to modify ANTHALService behavior */
+    bitfield<OptionFlags> options;
+};
+
diff --git a/interfaces/ant/Android.bp b/interfaces/ant/Android.bp
new file mode 100644
index 0000000..bbb3e4b
--- /dev/null
+++ b/interfaces/ant/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+    "1.0",
+]
diff --git a/interfaces/current.txt b/interfaces/current.txt
new file mode 100644
index 0000000..d8e65dc
--- /dev/null
+++ b/interfaces/current.txt
@@ -0,0 +1 @@
+# The initial interface is not finalized yet so there are currently no hashes here.
diff --git a/interfaces/update-makefiles.sh b/interfaces/update-makefiles.sh
new file mode 100644
index 0000000..06eff1e
--- /dev/null
+++ b/interfaces/update-makefiles.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+source $ANDROID_BUILD_TOP/system/tools/hidl/update-makefiles-helper.sh
+
+do_makefiles_update \
+  "com.dsi:external/ant-wireless/hidl/interfaces" \
+  "android.hidl:system/libhidl/transport"
+
diff --git a/sepolicy/README.txt b/sepolicy/README.txt
new file mode 100644
index 0000000..838de0a
--- /dev/null
+++ b/sepolicy/README.txt
@@ -0,0 +1,4 @@
+The policy files in this directory must be merged with the platform policy files.
+
+for the public policy this is either system/sepolicy/public or BOARD_PLAT_PUBLIC_SEPOLICY
+for the private policy this is either system/sepolicy/private or BOARD_PLAT_PRIVATE_SEPOLICY
diff --git a/sepolicy/private/hwservice_contexts b/sepolicy/private/hwservice_contexts
new file mode 100644
index 0000000..5d915dd
--- /dev/null
+++ b/sepolicy/private/hwservice_contexts
@@ -0,0 +1 @@
+com.dsi.ant::IAnt                   u:object_r:hal_dsi_ant_hwservice:s0
diff --git a/sepolicy/public/attributes b/sepolicy/public/attributes
new file mode 100644
index 0000000..be962bc
--- /dev/null
+++ b/sepolicy/public/attributes
@@ -0,0 +1,6 @@
+attribute hal_dsi_ant;
+expandattribute hal_dsi_ant true;
+attribute hal_dsi_ant_client;
+expandattribute hal_dsi_ant_client true;
+attribute hald_dsi_ant_server;
+expandattribute hal_dsi_ant_server false;
diff --git a/sepolicy/public/hal_dsi_ant.te b/sepolicy/public/hal_dsi_ant.te
new file mode 100644
index 0000000..c5f93b0
--- /dev/null
+++ b/sepolicy/public/hal_dsi_ant.te
@@ -0,0 +1,9 @@
+type hal_dsi_ant_hwservice, hwservice_manager_type;
+
+# Allow interaction with the hwservice manager for the initial bind.
+add_hwservice(hal_dsi_ant_server, hal_dsi_ant_hwservice);
+allow hal_dsi_ant_client hal_dsi_ant_hwservice:hwservice_manager find;
+
+# Binder calls are made in both directions.
+binder_call(hal_dsi_ant_client, hal_dsi_ant_server);
+binder_call(hal_dsi_ant_server, hal_dsi_ant_client);
diff --git a/src/bluez_hci/Android.mk b/src/bluez_hci/Android.mk
deleted file mode 100644
index 2a7687b..0000000
--- a/src/bluez_hci/Android.mk
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Copyright (C) 2009 Dynastream Innovations
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include $(CLEAR_VARS)
-
-LOCAL_CFLAGS := -g -c -W -Wall -O2
-
-# Check which chip is used so correct values in messages
-ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"wl12xx")
-LOCAL_CFLAGS += -DBOARD_ANT_DEVICE_WL12XX
-else ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"bcm433x")
-LOCAL_CFLAGS += -DBOARD_ANT_DEVICE_BCM433X
-endif
-
-LOCAL_C_INCLUDES := \
-   $(LOCAL_PATH)/src/common/inc \
-   $(LOCAL_PATH)/$(ANT_DIR)/inc \
-   system/bluetooth/bluez-clean-headers \
-
-ifeq ($(BOARD_ANT_WIRELESS_POWER),"bluedroid")
-LOCAL_CFLAGS += \
-   -DBOARD_HAVE_ANT_WIRELESS \
-   -DUSE_EXTERNAL_POWER_LIBRARY \
-
-LOCAL_C_INCLUDES += system/bluetooth/bluedroid/include/bluedroid
-endif # BOARD_ANT_WIRELESS_POWER = bluedroid
-
-LOCAL_SRC_FILES := \
-   $(COMMON_DIR)/JAntNative.cpp \
-   $(COMMON_DIR)/ant_utils.c \
-   $(ANT_DIR)/ant_native_hci.c \
-   $(ANT_DIR)/ant_rx.c \
-   $(ANT_DIR)/ant_tx.c \
-
-# JNI
-LOCAL_C_INCLUDE += $(JNI_H_INCLUDE)
-
-LOCAL_SHARED_LIBRARIES += \
-   libnativehelper \
-
-# chip power
-LOCAL_SHARED_LIBRARIES += \
-   libbluedroid \
-
-# logging
-LOCAL_SHARED_LIBRARIES += \
-   libcutils \
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_PRELINK_MODULE := false
-LOCAL_MODULE := libantradio
-
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/src/bluez_hci/ant_native_hci.c b/src/bluez_hci/ant_native_hci.c
deleted file mode 100644
index f247534..0000000
--- a/src/bluez_hci/ant_native_hci.c
+++ /dev/null
@@ -1,865 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2009 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ant_native_hci.c
-*
-*   BRIEF:
-*      This file provides the BlueZ HCI implementation of ant_native.h
-*
-*
-\******************************************************************************/
-
-#include <pthread.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "ant_types.h"
-#include "ant_native.h"
-#include "ant_utils.h"
-#include "ant_version.h"
-
-#if USE_EXTERNAL_POWER_LIBRARY
-#include "antradio_power.h"
-#endif
-
-#include "ant_rx.h"
-#include "ant_tx.h"
-#include "ant_hciutils.h"
-#include "ant_log.h"
-
-static pthread_mutex_t         txLock;
-pthread_mutex_t                enableLock;
-
-ANTRadioEnabledStatus radio_status = RADIO_STATUS_DISABLED;
-ANTRadioEnabledStatus get_and_set_radio_status(void);
-
-////////////////////////////////////////////////////////////////////
-//  ant_init
-//
-//  Initialises the native environment.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failures:
-//          ANT_STATUS_FAILED if could not initialize mutex
-//
-//  Psuedocode:
-/*
-LOCK antdevice_LOCK
-    CREATE mutex for locking Tx attempt
-    IF could not create mutex
-        RESULT = ANT_STATUS_FAILED
-    ELSE
-        CREATE mutex for locking enable/disable
-        IF could not create mutex
-            RESULT = ANT_STATUS_FAILED
-        ELSE
-            RESULT = ANT_STATUS_SUCCESS
-        ENDIF
-    ENDIF
-UNLOCK
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_init(void)
-{
-   int mutexResult;
-   ANTStatus status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   mutexResult = pthread_mutex_init(&txLock, NULL); //use default attr
-   if (mutexResult)
-   {
-      ANT_ERROR("Tx Lock mutex initialization failed: %s", strerror(mutexResult));
-   }
-   else
-   {
-      mutexResult = pthread_mutex_init(&enableLock, NULL);
-      if (mutexResult)
-      {
-         ANT_ERROR("Enable Lock mutex init failed %s", strerror(mutexResult));
-      }
-      else
-      {
-         status = ANT_STATUS_SUCCESS;
-      }
-   }
-
-   ANT_FUNC_END();
-   return status;
-}
-
-
-////////////////////////////////////////////////////////////////////
-//  ant_deinit
-//
-//  De-initialises the native environment.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failures:
-//          ANT_STATUS_FAILED if could not de-initialize mutex
-//
-//  Psuedocode:
-/*
-LOCK antdevice_LOCK (also Init and Tx)
-    DESTROY mutex for locking Tx attempt
-    IF could not destroy mutex
-        RESULT = ANT_STATUS_FAILED
-    ELSE
-        DESTROY mutex for locking enable/disable
-        IF coult not destroy mutex
-            RESULT = ANT_STATUS_FAILED
-        ELSE
-            RESULT = ANT_STATUS_SUCCESS
-        ENDIF
-    ENDIF
-UNLOCK
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_deinit(void)
-{
-   int mutexResult;
-   ANTStatus result_status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   mutexResult = pthread_mutex_destroy(&txLock);
-   if (mutexResult)
-   {
-      ANT_ERROR("Tx Lock mutex destroy failed: %s", strerror(mutexResult));
-   }
-   else
-   {
-      mutexResult = pthread_mutex_destroy(&enableLock);
-      if (mutexResult)
-      {
-         ANT_ERROR("Enable Lock mutex destroy failed: %s", strerror(mutexResult));
-      }
-      else
-      {
-         result_status = ANT_STATUS_SUCCESS;
-      }
-   }
-
-   ANT_FUNC_END();
-   return result_status;
-}
-
-
-////////////////////////////////////////////////////////////////////
-//  ant_enable_radio
-//
-//  Powers on the ANT part and initialises the transport to the chip.
-//  Changes occur in part implementing ant_enable() call
-//      On Android this is in the Bluedroid module.
-//      On Linux this is device specific
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failures:
-//          ANT_STATUS_TRANSPORT_INIT_ERR if could not enable
-//          ANT_STATUS_FAILED if failed to get mutex or init rx thread
-//
-//  Psuedocode:
-/*
-LOCK enable_LOCK
-    LOCK tx_LOCK
-        IF state is not enabled
-            STATE = ENABLING
-        ENDIF
-        ant enable
-        IF ant_enable success
-            IF rx thread is running
-                STATE = ENABLED
-                RESULT = SUCCESS
-            ELSE
-                start rx thread
-                IF starting rx thread fails
-                    ant disable
-                    get state
-                    IF state is enabled
-                        log a serious error
-                    ENDIF
-                    RESULT = FAILED
-                ELSE
-                    STATE = ENABLED
-                    RESULT = SUCCESS
-                ENDIF
-            ENDIF
-        ELSE
-            get state
-            IF state is enabled
-                log a serious error
-            ENDIF
-            RESULT = FAILURE
-        ENDIF
-    UNLOCK
-UNLOCK
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_enable_radio(void)
-{
-   int result;
-   int lockResult;
-   ANTStatus result_status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting enableLock in %s", __FUNCTION__);
-   lockResult = pthread_mutex_lock(&enableLock);
-   if(lockResult)
-   {
-      ANT_ERROR("Enable failed to get enableLock mutex: %s", strerror(lockResult));
-      return ANT_STATUS_FAILED;
-   }
-   ANT_DEBUG_V("got enableLock in %s", __FUNCTION__);
-
-   if(RADIO_STATUS_DISABLED == radio_status)
-   {
-      radio_status = RADIO_STATUS_ENABLING;
-   }
-
-   ANT_DEBUG_V("getting txLock in %s", __FUNCTION__);
-   lockResult = pthread_mutex_lock(&txLock);
-   if (lockResult)
-   {
-      ANT_ERROR("Enable txLock failed: %s", strerror(lockResult));
-      pthread_mutex_unlock(&enableLock);
-      return ANT_STATUS_FAILED;
-   }
-   ANT_DEBUG_V("got txLock in %s", __FUNCTION__);
-
-   if (get_and_set_radio_status() != RADIO_STATUS_ENABLED)
-   {
-      if (RxParams.thread)
-      {
-         ANT_WARN("in enable call: rx thread still exists but radio crashed. trying to recover");
-         ANT_DEBUG_V("radio crashed, letting rx thread join");
-         pthread_join(RxParams.thread, NULL);
-         RxParams.thread = 0;
-         ANT_DEBUG_V("recovered. joined by rx thread");
-      }
-
-      ANT_DEBUG_I("radio_status (%d -> %d)", radio_status, RADIO_STATUS_ENABLING);
-      radio_status = RADIO_STATUS_ENABLING;
-
-#if USE_EXTERNAL_POWER_LIBRARY
-      if (RxParams.pfStateCallback)
-         RxParams.pfStateCallback(radio_status);
-#endif
-   }
-
-#if USE_EXTERNAL_POWER_LIBRARY
-   result = ant_enable();
-
-   ANT_DEBUG_D("ant_enable() result is %d", result);
-#else
-   result = 0;
-#endif
-   if (result == 0)
-   {
-      if (RxParams.thread)
-      {
-         result_status = ANT_STATUS_SUCCESS;
-         radio_status = RADIO_STATUS_ENABLED; // sanity assign, cant be enabling
-         ANT_DEBUG_D("ANT radio re-enabled");
-      }
-      else
-      {
-         result = pthread_create(&RxParams.thread, NULL, ANTHCIRxThread, NULL);
-         if (result)
-         {
-            ANT_ERROR("Thread initialization failed: %s", strerror(result));
-            result_status = ANT_STATUS_FAILED;
-         }
-         else
-         {
-            result_status = ANT_STATUS_SUCCESS;
-#if USE_EXTERNAL_POWER_LIBRARY
-            if (radio_status == RADIO_STATUS_ENABLING)
-            {
-               ANT_DEBUG_I("radio_status (%d -> %d)", radio_status, RADIO_STATUS_ENABLED);
-               radio_status = RADIO_STATUS_ENABLED;
-
-               if (RxParams.pfStateCallback)
-                  RxParams.pfStateCallback(radio_status);
-            }
-            else
-            {
-               ANT_WARN("radio was already enabled but rx thread was not running");
-            }
-#else
-            radio_status = RADIO_STATUS_ENABLED;
-#endif
-         }
-      }
-   }
-   else
-   {
-      result_status = ANT_STATUS_TRANSPORT_INIT_ERR;
-   }
-
-   if (result_status != ANT_STATUS_SUCCESS) // ant_enable() or rx thread creating failed
-   {
-#if USE_EXTERNAL_POWER_LIBRARY
-      ant_disable();
-#endif
-
-      switch (get_and_set_radio_status())
-      {
-         case RADIO_STATUS_ENABLED:
-            ANT_ERROR("SERIOUS: enable failed, but ANT is enabled without a rx thread");
-            break;
-         default:
-            ANT_DEBUG_D("Enable failed, after cleanup chip is not enabled");
-            break;
-      }
-   }
-
-   ANT_DEBUG_V("releasing txLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&txLock);
-   ANT_DEBUG_V("released txLock in %s", __FUNCTION__);
-
-   ANT_DEBUG_V("releasing enableLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&enableLock);
-   ANT_DEBUG_V("released enableLock in %s", __FUNCTION__);
-
-   ANT_FUNC_END();
-   return result_status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_radio_hard_reset
-//
-//  Does nothing as Hard Reset is not supported.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      ANT_NOT_SUPPORTED
-//
-//  Psuedocode:
-/*
-RESULT = NOT SUPPORTED
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_radio_hard_reset(void)
-{
-   ANTStatus result_status = ANT_STATUS_NOT_SUPPORTED;
-   ANT_FUNC_START();
-   ANT_FUNC_END();
-   return result_status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_disable_radio
-//
-//  Disables the HCI transport and powers off the ANT part.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failures:
-//          ANT_STATUS_FAILED if could not get mutex
-//          ANT_STATUS_NOT_DE_INITIALIZED if ant_disable failed
-//
-//  Psuedocode:
-/*
-LOCK enable_LOCK
-    LOCK tx_LOCK
-        IF not disabled
-            STATE = DISABLING
-        ENDIF
-        ant disable
-        IF rx thread is running
-            wait for rx thread to terminate
-        ENDIF
-        get radio status
-        IF radio is disabled
-            RESULT = SUCCESS
-        ELSE IF radio is enabled
-            log a serious error
-            RESULT = FAILURE
-        ELSE
-            RESULT = FAILURE
-        ENDIF
-    UNLOCK
-UNLOCK
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_disable_radio(void)
-{
-   int result;
-   int lockResult;
-   ANTStatus ret = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting enableLock in %s", __FUNCTION__);
-   lockResult = pthread_mutex_lock(&enableLock);
-   if(lockResult)
-   {
-      ANT_ERROR("Disable failed to get enableLock mutex: %s", strerror(lockResult));
-      return ANT_STATUS_FAILED;
-   }
-   ANT_DEBUG_V("got enableLock in %s", __FUNCTION__);
-
-   ANT_DEBUG_V("getting txLock in %s", __FUNCTION__);
-   lockResult = pthread_mutex_lock(&txLock);
-   if (lockResult)
-   {
-      ANT_ERROR("Disable txLock failed: %s", strerror(lockResult));
-      pthread_mutex_unlock(&enableLock);
-      return ANT_STATUS_FAILED;
-   }
-   ANT_DEBUG_V("got txLock in %s", __FUNCTION__);
-
-#if USE_EXTERNAL_POWER_LIBRARY
-   if (get_and_set_radio_status() != RADIO_STATUS_DISABLED)
-   {
-      ANT_DEBUG_I("radio_status (%d -> %d)", radio_status, RADIO_STATUS_DISABLING);
-      radio_status = RADIO_STATUS_DISABLING;
-
-      if (RxParams.pfStateCallback)
-         RxParams.pfStateCallback(radio_status);
-   }
-
-   result = ant_disable();
-
-   ANT_DEBUG_D("ant_disable() result is %d", result);
-#else
-   radio_status = RADIO_STATUS_DISABLED;
-#endif
-
-   // If rx thread exists ( != 0)
-   if (RxParams.thread)
-   {
-      ANT_DEBUG_V("quit rx thread, joining");
-      pthread_join(RxParams.thread, NULL);
-      RxParams.thread = 0;
-      ANT_DEBUG_V("joined by rx thread");
-   }
-   else
-   {
-      ANT_DEBUG_W("rx thread is 0 (not created?)");
-   }
-
-   switch (get_and_set_radio_status())
-   {
-      case RADIO_STATUS_DISABLED:
-         ret = ANT_STATUS_SUCCESS;
-         break;
-      case RADIO_STATUS_ENABLED:
-         ANT_ERROR("SERIOUS: ANT was disabled, rx thread quit, but ANT is enabled");
-         ret = ANT_STATUS_FAILED;
-         break;
-      default:
-         ret = ANT_STATUS_NOT_DE_INITIALIZED;
-         break;
-   }
-
-   ANT_DEBUG_V("releasing txLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&txLock);
-   ANT_DEBUG_V("released txLock in %s", __FUNCTION__);
-
-   ANT_DEBUG_V("releasing enableLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&enableLock);
-   ANT_DEBUG_V("released enableLock in %s", __FUNCTION__);
-
-   ANT_FUNC_END();
-   return ret;
-}
-
-
-////////////////////////////////////////////////////////////////////
-//  ant_radio_enabled_status
-//
-//  Returns if the chip/transport is disabled/disabling/enabling/enabled. This
-//  function will NOT overwrite internal state variable enabling or disabling.
-//  It will call get_and_set_radio_status() if not enabling/disabling which can
-//  change internal state on errors.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      The current radio status (ANTRadioEnabledStatus)
-//
-//  Psuedocode:
-/*
-IF Enabling
-    RESULT = Enabling
-ELSE IF Disabling
-    RESULT = Disabling
-ELSE
-    IF ant_is_enabled
-        Enabled
-        RESULT = Enabled
-    ELSE
-        Disabled
-        RESULT = Disabled
-    ENDIF
-ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTRadioEnabledStatus ant_radio_enabled_status(void)
-{
-   ANT_FUNC_START();
-
-   if ((RADIO_STATUS_ENABLING != radio_status) &&
-         (RADIO_STATUS_DISABLING != radio_status))
-   {
-      get_and_set_radio_status();
-   }
-
-   ANT_FUNC_END();
-   return radio_status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  get_and_set_radio_status
-//
-//  Returns if the chip/transport is disabled/enabled/unknown This function WILL
-//  overwrite what it thinks the state is with what the BlueZ core (kernel)
-//  thinks it is. It will overwrite enabling or disabling states, and might
-//  change internal state from enabled, disabled, or unknown to any of these
-//  three on errors.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      The current radio status (ANTRadioEnabledStatus)
-//
-////////////////////////////////////////////////////////////////////
-ANTRadioEnabledStatus get_and_set_radio_status(void)
-{
-   ANT_FUNC_START();
-#if USE_EXTERNAL_POWER_LIBRARY
-   ANTRadioEnabledStatus orig_status = radio_status;
-   switch (ant_is_enabled())
-   {
-      case 0:
-         radio_status = RADIO_STATUS_DISABLED;
-         break;
-      case 1:
-         radio_status = RADIO_STATUS_ENABLED;
-         break;
-      default:
-         ANT_ERROR("getting chip state returned an error");
-         radio_status = RADIO_STATUS_UNKNOWN;
-         break;
-   }
-   if (orig_status != radio_status)
-   {
-      ANT_DEBUG_I("radio_status (%d -> %d)", orig_status, radio_status);
-
-      if (RxParams.pfStateCallback)
-         RxParams.pfStateCallback(radio_status);
-   }
-#endif
-   ANT_FUNC_END();
-   return radio_status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  set_ant_rx_callback
-//
-//  Sets which function to call when an ANT message is received.
-//
-//  Parameters:
-//      rx_callback_func   the ANTNativeANTEventCb function to be used
-//                         for received messages.
-//
-//  Returns:
-//          ANT_STATUS_SUCCESS
-//
-//  Psuedocode:
-/*
-    Rx Callback = rx_callback_func
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus set_ant_rx_callback(ANTNativeANTEventCb rx_callback_func)
-{
-   ANTStatus status = ANT_STATUS_SUCCESS;
-   ANT_FUNC_START();
-
-   RxParams.pfRxCallback = rx_callback_func;
-
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  set_ant_state_callback
-//
-//  Sets which function to call when an ANT state change occurs.
-//
-//  Parameters:
-//      state_callback_func   the ANTNativeANTStateCb function to be used
-//                            for received state changes.
-//
-//  Returns:
-//          ANT_STATUS_SUCCESS
-//
-//  Psuedocode:
-/*
-    State Callback = state_callback_func
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus set_ant_state_callback(ANTNativeANTStateCb state_callback_func)
-{
-   ANTStatus status = ANT_STATUS_SUCCESS;
-   ANT_FUNC_START();
-
-   RxParams.pfStateCallback = state_callback_func;
-
-   ANT_FUNC_END();
-
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_tx_message
-//
-//  Sends an ANT message to the chip
-//
-//  Parameters:
-//      ucLen   the length of the message
-//      pucMesg pointer to the message data
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failure:
-//          ANT_STATUS_NOT_ENABLED
-//
-//  Psuedocode:
-/*
-IF not enabled
-    RESULT = NOT ENABLED
-ELSE
-    Lock
-    IF Lock failed
-        RESULT = FAILED
-    ELSE
-        STORE length (little endian) in send buffer
-        STORE data in send buffer
-    ENDIF
-ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_tx_message(ANT_U8 ucLen, ANT_U8 *pucMesg)
-{
-   ANTStatus   status;
-
-   /* Socket for sending HCI commands */
-   int tx_socket = -1;
-
-   int lockResult;
-
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting txLock in %s", __FUNCTION__);
-   lockResult = pthread_mutex_lock(&txLock);
-   if (lockResult)
-   {
-      ANT_ERROR("ant_tx_message, could not get txLock: %s", strerror(lockResult));
-      return ANT_STATUS_FAILED;
-   }
-
-   ANT_DEBUG_V("got txLock in %s", __FUNCTION__);
-
-   if(RADIO_STATUS_ENABLED != get_and_set_radio_status())
-   {
-      ANT_DEBUG_E("ant_tx_message, ANT not enabled - ABORTING. Radio status = %d",
-                                                                  radio_status);
-      ANT_DEBUG_V("releasing txLock in %s", __FUNCTION__);
-      pthread_mutex_unlock(&txLock);
-      ANT_DEBUG_V("released txLock in %s", __FUNCTION__);
-      return ANT_STATUS_FAILED_BT_NOT_INITIALIZED;
-   }
-
-   // Open socket
-   tx_socket = ant_open_tx_transport();
-
-   if(tx_socket < 0)
-   {
-      ANT_ERROR("Could not open Tx socket");
-      ANT_DEBUG_V("releasing txLock in %s", __FUNCTION__);
-      pthread_mutex_unlock(&txLock);
-      ANT_DEBUG_V("released txLock in %s", __FUNCTION__);
-      return ANT_STATUS_FAILED;
-   }
-
-   // Send HCI packet
-   ANT_BOOL retryRx;
-   ANT_BOOL retryTx;
-   status = ANT_STATUS_FAILED;
-
-   int MAX_RETRIES_WRITE_FAIL = 10;
-   int MAX_RETRY_TIME_SECS = 10;
-   int commandWriteFailRetries = 0;
-
-   // Start New timed retry code:
-   time_t startTime = time(NULL);
-   time_t endTime = 0;
-   if((time_t)-1 != startTime)
-   {
-      endTime = startTime + MAX_RETRY_TIME_SECS;
-   }
-   else
-   {
-      ANT_ERROR("failed to get current time");
-   }
-
-   do // while (retryTx)
-   {
-      retryTx = ANT_FALSE;
-
-      if(ANT_STATUS_SUCCESS == write_data(pucMesg, ucLen))
-      {
-         do // while (retryRx)
-         {
-            retryRx = ANT_FALSE;
-         
-            if(ANT_TRUE == wait_for_message(tx_socket))
-            {
-               ANT_DEBUG_D("New HCI data available, reading...");
-            
-               status = get_command_complete_result(tx_socket);
-               switch (status)
-               {
-                  case ANT_STATUS_NO_VALUE_AVAILABLE:
-                  {
-                     ANT_WARN("Did not get an expected response for write, trying again");
-                     retryRx = ANT_TRUE;
-                     break;
-                  }
-                  case ANT_STATUS_FAILED:
-                  {
-                     ANT_ERROR("Command Complete: ANT_STATUS_FAILED");
-                     break;
-                  }
-                  case ANT_STATUS_COMMAND_WRITE_FAILED:
-                  {
-                     ANT_ERROR("Command Complete: ANT_STATUS_WRITE_FAILED");
-                   
-                     if(++commandWriteFailRetries < MAX_RETRIES_WRITE_FAIL)
-                     {
-                        ANT_DEBUG_D("Retrying.  Retry count = %d", 
-                                                      commandWriteFailRetries);
-                     
-                        retryTx = ANT_TRUE;
-                     }
-                     else
-                     {
-                        ANT_ERROR("Aborting.  Retry count = %d.  Max retries = %d",
-                              commandWriteFailRetries, MAX_RETRIES_WRITE_FAIL);
-                     }
-                     break;
-                  }
-                  case ANT_STATUS_TRANSPORT_UNSPECIFIED_ERROR:
-                  {
-                     ANT_DEBUG_D("Command Complete: ANT_STATUS_UNSPECIFIED_ERROR");
-
-                     // Give the chip a break before we try to resend data.
-                     nanosleep((struct timespec[]){{0, 50000000}}, NULL);
-                   
-                     time_t currentTime = time(NULL);
-                      
-                     if((time_t)-1 != currentTime)
-                     {
-                        if(currentTime < endTime)
-                        {
-                           ANT_DEBUG_V("Retrying. Current time = %d. "
-                              "End time = %d", (int)currentTime, (int)endTime);
-                        
-                           retryTx = ANT_TRUE;
-                        }
-                        else
-                        {
-                           ANT_ERROR("Command Complete: ANT_STATUS_UNSPECIFIED_ERROR");
-                           ANT_ERROR("Aborting. Current time = %d. End Time = %d",
-                                                (int)currentTime, (int)endTime);
-                        }
-                     }
-                     else
-                     {
-                        ANT_ERROR("Command Complete: failed to get current time");
-                     }
-                  
-                     break;
-                  }
-                  case ANT_STATUS_SUCCESS:
-                  {
-                     break;
-                  }
-                  default:
-                  {
-                     ANT_ERROR("Unhandled command complete status");
-                     break;
-                  }
-               }
-            }
-            else
-            {
-               ANT_WARN("Command Complete: wait for message failed");
-            }
-         } while (retryRx);
-      }
-      else
-      {
-         ANT_ERROR("write failed");
-         retryRx = ANT_FALSE;
-      
-         status = ANT_STATUS_FAILED;
-      }
-   } while(retryTx);
-   
-   ant_close_tx_transport(tx_socket);
-
-   ANT_DEBUG_V("releasing txLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&txLock);
-   ANT_DEBUG_V("released txLock in %s", __FUNCTION__);
-
-   ANT_FUNC_END();
-
-   return status;
-}
-
-const char *ant_get_lib_version()
-{
-   return "libantradio.so Bluez HCI Transport Version " 
-          LIBANT_STACK_MAJOR "." LIBANT_STACK_MINOR "." LIBANT_STACK_INCRE;
-}
-
diff --git a/src/bluez_hci/ant_rx.c b/src/bluez_hci/ant_rx.c
deleted file mode 100644
index 3894cd6..0000000
--- a/src/bluez_hci/ant_rx.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2009 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ant_rx.c
-*
-*   BRIEF:
-*      This file implements the receive thread for a BlueZ HCI implementation
-*      using Vendor Specific messages.
-*
-*
-\******************************************************************************/
-
-#define _GNU_SOURCE /* needed for PTHREAD_MUTEX_RECURSIVE */
-
-#include <errno.h>
-#include <poll.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <sys/resource.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/un.h>
-
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/hci.h>
-#include <bluetooth/hci_lib.h>
-
-#include "ant_types.h"
-
-#if USE_EXTERNAL_POWER_LIBRARY
-#include "antradio_power.h"
-#endif
-
-#include "ant_rx.h"
-#include "ant_hciutils.h"
-#include "ant_framing.h"
-#include "ant_log.h"
-
-#undef LOG_TAG
-#define LOG_TAG "antradio_rx"
-
-/* Global Options */
-ANTHCIRxParams RxParams = {
-   .pfRxCallback = NULL,
-   .pfStateCallback = NULL,
-   .thread = 0
-};
-
-extern pthread_mutex_t enableLock;
-extern ANTRadioEnabledStatus get_and_set_radio_status(void);
-#ifndef USE_EXTERNAL_POWER_LIBRARY
-extern ANTRadioEnabledStatus radio_status;
-#endif
-
-/*
- * This thread opens a Bluez HCI socket and waits for ANT messages.
- */
-void *ANTHCIRxThread(void *pvHCIDevice)
-{
-   int ret = ANT_STATUS_SUCCESS;
-   int rxSocket;
-   int len;
-   unsigned char buf[HCI_MAX_EVENT_SIZE];
-   int result;
-   struct hci_filter eventVendorFilter;
-   ANT_FUNC_START();
-
-   (void)pvHCIDevice; //unused waring
-
-   ANT_DEBUG_D("Entering ANTHCIRxThread");
-
-   rxSocket = create_hci_sock();
-   if (rxSocket < 0)
-   {
-      ANT_DEBUG_E("can't open HCI socket in rx thread: %s", strerror(errno));
-
-      ret = ANT_STATUS_FAILED;
-      goto out;
-   }
-
-   eventVendorFilter.type_mask = TYPE_MASK_EVENT_PACKET;
-   eventVendorFilter.event_mask[0] = 0;
-   eventVendorFilter.event_mask[1] = EVENT_MASK_1_EVENT_VENDOR;
-   eventVendorFilter.opcode = htobs(ANT_EVENT_VENDOR_CODE);
-
-   if (setsockopt(rxSocket, SOL_HCI, HCI_FILTER, &eventVendorFilter, sizeof(eventVendorFilter)) < 0)
-   {
-      ANT_ERROR("failed to set socket options: %s", strerror(errno));
-
-      ret = ANT_STATUS_FAILED;
-      goto close;
-   }
-
-   /* continue running as long as not terminated */
-   while (get_and_set_radio_status() == RADIO_STATUS_ENABLED)
-   {
-      struct pollfd p;
-      int n;
-
-      p.fd = rxSocket;
-      p.events = POLLIN;
-
-      ANT_DEBUG_V("    RX: Polling HCI for data...");
-
-      /* poll socket, wait for ANT messages */
-      while ((n = poll(&p, 1, 2500)) == -1)
-      {
-         if (errno == EAGAIN || errno == EINTR)
-            continue;
-
-         ANT_ERROR("failed to poll socket: %s", strerror(errno));
-
-         ret = ANT_STATUS_FAILED;
-         goto close;
-      }
-
-      /* we timeout once in a while */
-      /* this let's us the chance to check if we were terminated */
-      if (0 == n)
-      {
-         ANT_DEBUG_V("    RX: Timeout");
-         continue;
-      }
-
-      ANT_DEBUG_D("New HCI data available, reading...");
-
-      /* read newly arrived data */
-      /* TBD: rethink assumption about single arrival */
-      while ((len = read(rxSocket, buf, sizeof(buf))) < 0)
-      {
-         if (errno == EAGAIN || errno == EINTR)
-            continue;
-
-         ANT_ERROR("failed to read socket: %s", strerror(errno));
-
-         ret = ANT_STATUS_FAILED;
-         goto close;
-      }
-
-      hci_event_packet_t *event_packet = (hci_event_packet_t *)buf;
-      int hci_payload_len = validate_hci_event_packet(event_packet, len);
-      if (hci_payload_len == -1)
-      {
-         // part of the message is incorrect, ignore it. validate_event_packet will log error
-         continue;
-      }
-
-      ANT_SERIAL(event_packet->hci_payload, hci_payload_len, 'R');
-
-      if(RxParams.pfRxCallback != NULL)
-      {
-         RxParams.pfRxCallback(hci_payload_len, event_packet->hci_payload);
-      }
-      else
-      {
-         ANT_ERROR("Can't send rx message - no callback registered");
-      }
-   }
-
-close:
-   result = pthread_mutex_trylock(&enableLock);
-   ANT_DEBUG_D("rx thread close: trylock enableLock returned %d", result);
-
-   if (result == 0)
-   {
-      ANT_DEBUG_W("rx thread socket has unexpectedly crashed");
-#if USE_EXTERNAL_POWER_LIBRARY
-      if (RxParams.pfStateCallback)
-         RxParams.pfStateCallback(RADIO_STATUS_DISABLING);
-      ant_disable();
-      get_and_set_radio_status();
-#else
-      radio_status = RADIO_STATUS_DISABLED;
-#endif
-      RxParams.thread = 0;
-      pthread_mutex_unlock(&enableLock);
-   }
-   else if (result == EBUSY)
-   {
-      ANT_DEBUG_V("rx thread socket was closed");
-   }
-   else
-   {
-      ANT_ERROR("rx thread close: trylock failed: %s", strerror(result));
-   }
-
-   if (-1 == close(rxSocket))
-   {
-      ANT_ERROR("failed to close hci device (socket handle=%#x): %s", rxSocket, strerror(errno));
-   }
-   else
-   {
-      ANT_DEBUG_D("closed hci device (socket handle=%#x)", rxSocket);
-   }
-
-out:
-   ANT_FUNC_END();
-
-   pthread_exit((void *)ret);
-
-#if defined(ANDROID)
-   return 0;
-#endif
-}
-
diff --git a/src/bluez_hci/ant_tx.c b/src/bluez_hci/ant_tx.c
deleted file mode 100644
index e1efa7f..0000000
--- a/src/bluez_hci/ant_tx.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2009 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ant_tx.c
-*
-*   BRIEF:
-*      This file Implements the transmit functionality for a BlueZ HCI
-*      implementation using Vendor Specific messages.
-*
-*
-\******************************************************************************/
-
-#include <errno.h>
-#include <poll.h>
-#include <sys/uio.h>
-
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/hci.h>
-#include <bluetooth/hci_lib.h>
-
-#include "ant_types.h"
-#include "ant_hciutils.h"
-#include "ant_framing.h"
-#include "ant_utils.h"
-#include "ant_log.h"
-
-#undef LOG_TAG
-#define LOG_TAG "antradio_tx"
-
-int g_ant_cmd_socket = -1;
-
-int ant_open_tx_transport(void)
-{
-   int socket = -1;
-   struct hci_filter commandCompleteFilter;
-   ANT_FUNC_START();
-
-   socket = create_hci_sock();
-
-   if (socket < 0)
-   {
-      ANT_DEBUG_E("failed to open HCI socket for tx: %s", strerror(errno));
-   }
-   else
-   {
-      g_ant_cmd_socket = socket;
-      ANT_DEBUG_D("socket handle %#x", socket);
-
-      commandCompleteFilter.type_mask = TYPE_MASK_EVENT_PACKET;
-      commandCompleteFilter.event_mask[0] = EVENT_MASK_0_COMMAND_COMPLETE;
-      commandCompleteFilter.event_mask[1] = 0;
-      commandCompleteFilter.opcode = htobs(ANT_COMMAND_OPCODE);
-
-      if (setsockopt(socket, SOL_HCI, HCI_FILTER, &commandCompleteFilter, sizeof(commandCompleteFilter)) < 0)
-      {
-         ANT_ERROR("failed to set socket options: %s", strerror(errno));
-         close(socket);
-         socket = -1;
-      }
-   }
-
-   ANT_FUNC_END();
-   return socket;
-}
-
-void ant_close_tx_transport(int socket)
-{
-   ANT_FUNC_START();
-
-   if(0 < socket)
-   {
-      if (0 == close(socket))
-      {
-         ANT_DEBUG_D("closed hci device (socket handle=%#x)", socket);
-      }
-      else
-      {
-         ANT_ERROR("failed to close hci device (socket handle=%#x): %s", socket, strerror(errno));
-      }
-   }
-   else
-   {
-      ANT_DEBUG_E("requested close on socket %#x. invalid param", socket);
-   }
-
-   ANT_FUNC_END();
-}
-
-/* 
-Format of an HCI WRITE command to ANT chip:
-
-HCI Header:
-----------
-- HCI Packet Type:                                                      1 byte
-
-- HCI Opcode:                                                           2 bytes
-                                                               (LSB, MSB - LE)
-- HCI Parameters Total Len (total length of all subsequent fields):     1 byte
-
-HCI Parameters:
---------------
-- VS Parameters Len (total length of ANT Mesg inculding Len/ID)         2 bytes
-                                                               (LSB, MSB - LE)
-- ANT Mesg Len (N = number of bytes in ANT Mesg Data):                  1 byte
-- ANT Mesg ID:                                                          1 byte
-- ANT Mesg Data:                                                        N bytes 
-*/
-
-ANT_BOOL wait_for_message(int socket)
-{
-   struct pollfd p;
-   int n;
-
-   ANT_BOOL bReturn = ANT_FALSE;
-   ANT_BOOL bRetry = ANT_FALSE;
-
-   ANT_FUNC_START();
-
-   p.fd = socket;
-   p.events = POLLIN;
-
-   do
-   {
-      bRetry = ANT_FALSE;
-   
-      ANT_DEBUG_V("    CC: Polling HCI for data...");
-   
-      /* poll socket, wait for ANT messages */
-      n = poll(&p, 1, 2500);
-      if (0 > n)
-      {
-         if (errno == EAGAIN || errno == EINTR)
-         {
-            ANT_DEBUG_W("    CC: error: %s", strerror(errno));
-            bRetry = ANT_TRUE;
-         }
-         else
-         {
-            ANT_ERROR("failed to poll socket. error: %s", strerror(errno));
-         }
-      }
-
-      /* timeout */
-      else if (0 == n)
-      {
-         ANT_ERROR("SERIOUS: Timeouted getting Command Complete");
-      }
-      else if(0 < n)
-      {
-         // There is data to read.
-         bReturn = ANT_TRUE;
-      }
-
-   } while(ANT_TRUE == bRetry);
-
-   ANT_FUNC_END();
-   
-   return bReturn;
-}
-
-ANTStatus write_data(ANT_U8 ant_message[], int ant_message_len)
-{
-   ANTStatus ret = ANT_STATUS_FAILED;
-   ANT_BOOL retry = ANT_FALSE;
-   int bytes_written;
-   struct iovec iov[2];
-   hci_command_vendor_header_t hci_header;
-
-   ANT_FUNC_START();
-
-   create_command_header(&hci_header, ant_message_len);
-
-   iov[0].iov_base = &hci_header;
-   iov[0].iov_len = sizeof(hci_header);
-   iov[1].iov_base = ant_message;
-   iov[1].iov_len = ant_message_len;
-
-   do //while retry
-   {
-      retry = ANT_FALSE;
-
-      if (g_ant_cmd_socket < 0)
-      {
-         ANT_DEBUG_E("bad socket handle %#x", g_ant_cmd_socket);
-         return ANT_STATUS_INTERNAL_ERROR;
-      }
-
-      ANT_SERIAL(ant_message, ant_message_len, 'T');
-
-      bytes_written = writev(g_ant_cmd_socket, iov, 2);
-
-      ANT_DEBUG_D("writing to socket %#x returned %d", g_ant_cmd_socket, 
-                                                               bytes_written);
-
-//      bytes_written < 0                   = error (check errno)
-//      bytes_written = 0                   = No data written
-//      bytes_written < sizeof(hci_message) = not all data written
-//      bytes_written = sizeof(hci_message) = all data written
-
-      if(bytes_written < 0)
-      {
-         ANT_ERROR("write to HCI failed: %s", strerror(errno));
-
-         if (errno == EAGAIN || errno == EINTR)
-         {
-            ANT_DEBUG_D("Retrying write to HCI");
-            retry = ANT_TRUE;
-         }
-         else
-         {
-            ret = ANT_STATUS_FAILED;
-         }
-      }
-      else if(bytes_written < ((int)sizeof(hci_header) + ant_message_len))
-      {
-         ANT_DEBUG_D("Only %d bytes written to HCI.", bytes_written);
-         ret = ANT_STATUS_FAILED;
-      }
-      else
-      {
-         ANT_DEBUG_V("writev successful");
-         ret = ANT_STATUS_SUCCESS;
-      }
-   } while(retry);
-
-   ANT_FUNC_END();
- 
-   return ret;
-}
-
-// Returns:
-//  ANT_STATUS_NO_VALUE_AVAILABLE          if not a CC packet
-//  ANT_STATUS_FAILED                      if could not read socket or not a 
-//                                                       valid length CC packet
-//  ANT_STATUS_TRANSPORT_UNSPECIFIED_ERROR if CC indicates an unspecified error
-//  ANT_STATUS_COMMAND_WRITE_FAILED        if CC indicates a failure
-//  ANT_STATUS_SUCCESS                     if CC indicates message was received 
-ANTStatus get_command_complete_result(int socket)
-{
-   ANTStatus status = ANT_STATUS_NO_VALUE_AVAILABLE;
-   int len;
-   ANT_U8 ucResult = -1;
-   ANT_U8 buf[HCI_MAX_EVENT_SIZE];
-
-   ANT_FUNC_START();
-   ANT_DEBUG_V("reading off socket %#x", socket);
-
-   /* read newly arrived data */
-   while ((len = read(socket, buf, sizeof(buf))) < 0)
-   {
-      if (errno == EAGAIN || errno == EINTR)
-         continue;
-
-      ANT_ERROR("failed to read socket. error: %s", strerror(errno));
-
-      status = ANT_STATUS_FAILED;
-      goto close;
-   }
-
-   ANT_SERIAL(buf, len, 'C');
-
-   // validate that we have a single command complete packet
-   if (len != sizeof(hci_command_complete_packet_t))
-   {
-       status = ANT_STATUS_FAILED;
-   }
-   else
-   {
-      hci_command_complete_packet_t *command_complete = (hci_command_complete_packet_t *)buf;
-
-      if(command_complete->packet_type == HCI_EVENT_PKT)
-      {
-         ANT_DEBUG_D("Received Event Packet");
-
-         if(command_complete->event_header.evt == EVT_CMD_COMPLETE)
-         {
-            ANT_U16 opcode = ANT_UTILS_LEtoHost16((ANT_U8 *)&command_complete->command_complete_hdr.opcode);
-            if(opcode == ANT_COMMAND_OPCODE)
-            {
-               ANT_DEBUG_V("Received COMMAND COMPLETE");
-               ucResult = command_complete->response;
-
-               if(ucResult == 0)
-               {
-                  ANT_DEBUG_D("Command Complete = SUCCESS");
-                  status = ANT_STATUS_SUCCESS;
-               }
-               else if(ucResult == HCI_UNSPECIFIED_ERROR)
-               {
-                  ANT_DEBUG_D("Command Complete = UNSPECIFIED_ERROR");
-                  status = ANT_STATUS_TRANSPORT_UNSPECIFIED_ERROR;
-               }
-               else
-               {
-                  status = ANT_STATUS_COMMAND_WRITE_FAILED;
-                  ANT_DEBUG_D("Command Complete = WRITE_FAILED");
-               }
-            }
-            else
-            {
-               ANT_DEBUG_W("Command complete has wrong opcode, this should have been filtered out");
-            }
-         }
-         else
-         {
-            ANT_DEBUG_W("Event is not a command complete, this should have been filtered out");
-         }
-      }
-      else
-      {
-         ANT_DEBUG_W("Other Event Packet, this should have been filtered out");
-      }
-   }
-
-close:
-   ANT_FUNC_END();
-   return status;
-}
-
diff --git a/src/bluez_hci/inc/ant_framing.h b/src/bluez_hci/inc/ant_framing.h
deleted file mode 100644
index 59c16ca..0000000
--- a/src/bluez_hci/inc/ant_framing.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2009 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ant_framing.h
-*
-*   BRIEF:
-*      This file defines ANT specific HCI values used by the ANT chip with a
-*      shared BlueZ HCI transport.
-*
-*
-\******************************************************************************/
-
-#ifndef __ANT_HCIFRAMING_H
-#define __ANT_HCIFRAMING_H
-
-#if defined(BOARD_ANT_DEVICE_WL12XX)
-
-#define ANT_COMMAND_OPCODE                         0xFDD1
-#define ANT_EVENT_VENDOR_CODE                      0x0500
-
-typedef struct {
-   ANT_U16                    vendor_msg_len;
-} __attribute__ ((packed)) hci_cmd_vendor_hdr_t;
-#define HCI_COMMAND_VENDOR_HDR_SIZE                2
-
-typedef struct {
-   ANT_U16                    vendor_code;
-   ANT_U16                    vendor_msg_len;
-} __attribute__ ((packed)) hci_evt_vendor_hdr_t;
-#define HCI_EVENT_VENDOR_HDR_SIZE                  4
-
-#elif defined(BOARD_ANT_DEVICE_BCM433X)
-
-#define ANT_COMMAND_OPCODE                         0xFCEC
-#define ANT_EVENT_VENDOR_CODE                      0x2D
-
-typedef struct {
-   ANT_U8                     command_id_padding;
-} __attribute__ ((packed)) hci_cmd_vendor_hdr_t;
-#define HCI_COMMAND_VENDOR_HDR_SIZE                1
-
-typedef struct {
-   ANT_U8                     vendor_code;
-   ANT_U8                     status;
-} __attribute__ ((packed)) hci_evt_vendor_hdr_t;
-#define HCI_EVENT_VENDOR_HDR_SIZE                  2
-
-#define  COMMAND_ID_PADDING                        0xFF
-
-#endif
-
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/hci.h>
-
-#include "ant_native.h"
-#include "ant_types.h"
-#include "ant_utils.h"
-
-#define HCI_EVENT_HEADER_OVERHEAD (HCI_TYPE_LEN + HCI_EVENT_HDR_SIZE)
-#define HCI_EVENT_TOTAL_OVERHEAD (HCI_EVENT_HEADER_OVERHEAD + HCI_EVENT_VENDOR_HDR_SIZE)
-
-#define TYPE_MASK_EVENT_PACKET                     0x00000010
-#define EVENT_MASK_0_COMMAND_COMPLETE              0x00004000
-#define EVENT_MASK_1_EVENT_VENDOR                  0x80000000
-
-// -------------------------------------------------
-
-typedef struct {
-   ANT_U8                     packet_type;         // HCI_COMMAND_PKT
-   hci_command_hdr            command_header;      // from hci.h
-   hci_cmd_vendor_hdr_t       vendor_header;
-} __attribute__ ((packed)) hci_command_vendor_header_t;
-
-
-typedef struct {
-   ANT_U8                     packet_type;         // HCI_EVENT_PKT
-   hci_event_hdr              event_header;        // from hci.h
-   hci_evt_vendor_hdr_t       vendor_header;
-   ANT_U8                     hci_payload[HCI_MAX_EVENT_SIZE];
-} __attribute__ ((packed)) hci_event_packet_t;
-
-typedef struct {
-   ANT_U8                     packet_type;         // HCI_EVENT_PKT
-   hci_event_hdr              event_header;        // from hci.h
-   evt_cmd_complete           command_complete_hdr;// from hci.h
-   ANT_U8                     response;
-} __attribute__ ((packed)) hci_command_complete_packet_t;
-
-// -------------------------------------------------
-
-/**
- * @param header the struct to fill with chip specific hci header
- * @param ant_message_len total ant length, size, id, and data
- */
-static inline void create_command_header(hci_command_vendor_header_t *header, ANT_U8 ant_message_len)
-{
-   header->packet_type = HCI_COMMAND_PKT;
-   header->command_header.opcode = htobs(ANT_COMMAND_OPCODE);
-   header->command_header.plen = ant_message_len + HCI_COMMAND_VENDOR_HDR_SIZE;
-#if defined(BOARD_ANT_DEVICE_WL12XX)
-   header->vendor_header.vendor_msg_len = htobs(ant_message_len);
-#elif defined(BOARD_ANT_DEVICE_BCM433X)
-   header->vendor_header.command_id_padding = COMMAND_ID_PADDING;
-#endif
-}
-
-/**
- * @param packet the struct to check if is an ANT hci payload
- * @param packet_len the total length of the packet
- * @return 0 if valid, -1 if not valid
- */
-static inline int validate_hci_event_vendor(hci_event_packet_t *packet, int packet_len)
-{
-#if defined(BOARD_ANT_DEVICE_WL12XX)
-   ANT_U16 vendor_code = ANT_UTILS_LEtoHost16((ANT_U8 *)&packet->vendor_header.vendor_code);
-#elif defined(BOARD_ANT_DEVICE_BCM433X)
-   ANT_U8 vendor_code = packet->vendor_header.vendor_code;
-#endif
-   if (vendor_code != ANT_EVENT_VENDOR_CODE) {
-      ANT_ERROR("HCI packet vendor event code is not ANT");
-      return -1;
-   }
-
-#if defined(BOARD_ANT_DEVICE_WL12XX)
-   ANT_U16 vendor_msg_len = ANT_UTILS_LEtoHost16((ANT_U8 *)&packet->vendor_header.vendor_msg_len);
-   if (packet_len != vendor_msg_len + HCI_EVENT_TOTAL_OVERHEAD) {
-      ANT_ERROR("HCI packet length (%d) should be %d bytes more than HCI payload length (%d)",
-              packet_len, HCI_EVENT_TOTAL_OVERHEAD, vendor_msg_len);
-      return -1;
-   }
-#elif defined(BOARD_ANT_DEVICE_BCM433X)
-   (void)packet_len; // unused warning
-#endif
-
-   return 0;
-}
-
-/**
- * @param packet the struct to validate
- * @param packet_len the total length of the packet
- * @return -1 if not valid, or length of the ANT hci payload
- */
-static inline int validate_hci_event_packet(hci_event_packet_t *packet, int packet_len)
-{
-   // Make sure we have at the minimum the hci header, vendor header, and ANT size/id bytes
-   if (packet_len < HCI_EVENT_TOTAL_OVERHEAD) {
-      ANT_ERROR("HCI packet length (%d) is less than minimum (%d)",
-              packet_len, HCI_EVENT_TOTAL_OVERHEAD);
-      return -1;
-   }
-
-   if (packet->packet_type != HCI_EVENT_PKT) {
-      ANT_ERROR("HCI packet is not an event packet");
-      return -1;
-   }
-
-   if (packet->event_header.evt != EVT_VENDOR) {
-      ANT_ERROR("HCI packet is not a vendor event");
-      return -1;
-   }
-
-   if (packet_len != packet->event_header.plen + HCI_EVENT_HEADER_OVERHEAD) {
-      ANT_ERROR("HCI packet length (%d) should be %d bytes more than HCI event length (%d)",
-              packet_len, HCI_EVENT_HDR_SIZE, packet->event_header.plen);
-      return -1;
-   }
-
-   if (validate_hci_event_vendor(packet, packet_len) == -1)
-   {
-      return -1;
-   }
-   else
-   {
-      // return HCI payload len
-      return packet_len - HCI_EVENT_TOTAL_OVERHEAD;
-   }
-}
-
-#endif /* __ANT_HCIFRAMING_H */
diff --git a/src/bluez_hci/inc/ant_hciutils.h b/src/bluez_hci/inc/ant_hciutils.h
deleted file mode 100644
index d654ce9..0000000
--- a/src/bluez_hci/inc/ant_hciutils.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2009 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ant_hciutils.h
-*
-*   BRIEF:
-*      This file defines the utility functions for a Bluetooth HCI implementation
-*
-*
-\******************************************************************************/
-
-#ifndef __ANT_HCIUTILS_H
-#define __ANT_HCIUTILS_H
-
-#include <errno.h>
-#include <sys/socket.h>
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/hci.h>
-
-#include "ant_log.h"
-// -------------------------------------------------
-
-static inline int create_hci_sock() {
-   struct sockaddr_hci sa;
-   int sk = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
-   if (sk < 0)
-   {
-      ANT_ERROR("Failed to create bluetooth hci socket: %s", strerror(errno));
-   }
-   else
-   {
-      memset(&sa, 0, sizeof(sa));
-      // sockaddr_hci changed from kernel 2.6.37 to 2.6.38 adding member hci_channel
-      // In order to be backwards compatible set it to 0 if it exists (HCI_CHANNEL_RAW)
-      sa.hci_family = AF_BLUETOOTH;
-      sa.hci_dev = 0;
-      if (bind(sk, (struct sockaddr *) &sa, sizeof(sa)) < 0)
-      {
-         ANT_ERROR("Failed to bind socket %#x to hci0: %s", sk, strerror(errno));
-         close(sk);
-         sk = -1;
-      }
-   }
-   return sk;
-}
-
-#endif /* __ANT_HCIUTILS_H */
-
-
diff --git a/src/bluez_hci/inc/ant_rx.h b/src/bluez_hci/inc/ant_rx.h
deleted file mode 100644
index aff076d..0000000
--- a/src/bluez_hci/inc/ant_rx.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2009 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ant_rx.h
-*
-*   BRIEF:
-*      This file defines the receive thread function and the ANTHCIRxParams
-*      type for storing the configuration of the receive thread.
-*
-*
-\******************************************************************************/
-
-#ifndef __ANT_OS_H
-#define __ANT_OS_H
-
-#include <pthread.h>
-#include "ant_types.h"
-#include "ant_native.h"
-
-// The configuration of a receive thread
-typedef struct
-{
-   //The function to call back with received data
-   ANTNativeANTEventCb pfRxCallback;
-
-   //The function to call back with state changes
-   ANTNativeANTStateCb pfStateCallback;
-
-   //The thread object itself
-   pthread_t thread;
-
-} ANTHCIRxParams;
-
-extern ANTHCIRxParams RxParams;
-
-//The message receive thread
-void* ANTHCIRxThread(void* pvHCIDevice);
-
-#endif  /* __ANT_OS_H */
-
diff --git a/src/bluez_hci/inc/ant_tx.h b/src/bluez_hci/inc/ant_tx.h
deleted file mode 100644
index 0c85a5a..0000000
--- a/src/bluez_hci/inc/ant_tx.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2009 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ant_tx.h
-*
-*   BRIEF:
-*      This file defines the utility functions used by the transmit function.
-*
-*
-\******************************************************************************/
-
-#ifndef __ANT_TX_H
-#define __ANT_TX_H
-
-#include "ant_types.h"
-#include "ant_hciutils.h"
-
-int         ant_open_tx_transport(void);
-void        ant_close_tx_transport(int socket);
-ANT_BOOL    wait_for_message(int socket);
-ANTStatus   write_data(ANT_U8 ant_message[], int ant_message_len);
-
-ANTStatus get_command_complete_result(int socket);
-
-#endif /* __ANT_TX_H */
-
diff --git a/src/bt-vendor_vfs/Android.mk b/src/bt-vendor_vfs/Android.mk
deleted file mode 100644
index e6813d0..0000000
--- a/src/bt-vendor_vfs/Android.mk
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# Copyright (C) 2011 Dynastream Innovations
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include $(CLEAR_VARS)
-
-LOCAL_CFLAGS := -g -c -W -Wall -O2
-
-# needed to pull in the header file for libbt-vendor.so
-BDROID_DIR:= external/bluetooth/bluedroid
-
-# Added hci/include to give access to the header for the libbt-vendorso interface.
-LOCAL_C_INCLUDES := \
-   $(LOCAL_PATH)/src/common/inc \
-   $(LOCAL_PATH)/$(ANT_DIR)/inc \
-   $(BDROID_DIR)/hci/include \
-
-ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"qualcomm-uart")
-LOCAL_C_INCLUDES += \
-   $(LOCAL_PATH)/$(ANT_DIR)/qualcomm/uart \
-
-endif # BOARD_ANT_WIRELESS_DEVICE = "qualcomm-uart"
-
-LOCAL_SRC_FILES := \
-   $(COMMON_DIR)/JAntNative.cpp \
-   $(COMMON_DIR)/ant_utils.c \
-   $(ANT_DIR)/ant_native_chardev.c \
-   $(ANT_DIR)/ant_rx_chardev.c \
-
-# JNI
-LOCAL_C_INCLUDE += $(JNI_H_INCLUDE)
-
-LOCAL_SHARED_LIBRARIES += \
-   libnativehelper \
-
-# logging and dll loading
-LOCAL_SHARED_LIBRARIES += \
-   libcutils \
-   libdl \
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_PRELINK_MODULE := false
-LOCAL_MODULE := libantradio
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/src/bt-vendor_vfs/ant_native_chardev.c b/src/bt-vendor_vfs/ant_native_chardev.c
deleted file mode 100644
index a90c8c4..0000000
--- a/src/bt-vendor_vfs/ant_native_chardev.c
+++ /dev/null
@@ -1,1078 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ant_native_chardev.c
-*
-*   BRIEF:
-*      This file provides the VFS implementation of ant_native.h
-*      VFS could be Character Device, TTY, etc.
-*
-*
-\******************************************************************************/
-
-#include <errno.h>
-#include <fcntl.h> /* for open() */
-#include <linux/ioctl.h> /* For hard reset */
-#include <pthread.h>
-#include <dlfcn.h> /* needed for runtime dll loading. */
-#include <stdint.h> /* for uint64_t */
-#include <sys/eventfd.h> /* For eventfd() */
-#include <unistd.h> /* for read(), write(), and close() */
-
-#include "ant_types.h"
-#include "ant_native.h"
-#include "ant_version.h"
-
-#include "antradio_power.h"
-#include "ant_rx_chardev.h"
-#include "ant_hci_defines.h"
-#include "ant_log.h"
-#include "bt_vendor_lib.h" /* used by qualcomms code to call into libbt-vendor.so */
-#include <cutils/properties.h> /* used by qualcomms additions for logging. */
-// The following functions are dummy implementations of the callbacks required by libbt-vendor.
-static void vendor_fwcfg_cb(bt_vendor_op_result_t result) {
-}
-static void vendor_scocfg_cb(bt_vendor_op_result_t result) {
-}
-static void vendor_lpm_vnd_cb(bt_vendor_op_result_t result) {
-}
-static void* vendor_alloc(int size) {
-    return NULL;
-}
-static void vendor_dealloc(void *p_buf) {
-}
-static uint8_t vendor_xmit_cb(uint16_t opcode, void *p_buf, tINT_CMD_CBACK p_cback) {
-    return 0;
-}
-static void vendor_epilog_cb(bt_vendor_op_result_t result) {
-}
-
-// This struct is used to regsiter the dummy callbacks with libbt-vendor
-bt_vendor_interface_t *vendor_interface=NULL;
-static const bt_vendor_callbacks_t vendor_callbacks = {
-  sizeof(bt_vendor_callbacks_t),
-    vendor_fwcfg_cb,
-    vendor_scocfg_cb,
-    vendor_lpm_vnd_cb,
-    vendor_alloc,
-    vendor_dealloc,
-    vendor_xmit_cb,
-    vendor_epilog_cb
-};
-
-#if ANT_HCI_SIZE_SIZE > 1
-#include "ant_utils.h"  // Put HCI Size value across multiple bytes
-#endif
-
-#define MESG_BROADCAST_DATA_ID               ((ANT_U8)0x4E)
-#define MESG_ACKNOWLEDGED_DATA_ID            ((ANT_U8)0x4F)
-#define MESG_BURST_DATA_ID                   ((ANT_U8)0x50)
-#define MESG_EXT_BROADCAST_DATA_ID           ((ANT_U8)0x5D)
-#define MESG_EXT_ACKNOWLEDGED_DATA_ID        ((ANT_U8)0x5E)
-#define MESG_EXT_BURST_DATA_ID               ((ANT_U8)0x5F)
-#define MESG_ADV_BURST_DATA_ID               ((ANT_U8)0x72)
-
-static ant_rx_thread_info_t stRxThreadInfo;
-static pthread_mutex_t stEnabledStatusLock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t stFlowControlLock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t stFlowControlCond = PTHREAD_COND_INITIALIZER;
-ANTNativeANTStateCb g_fnStateCallback;
-
-static const uint64_t EVENT_FD_PLUS_ONE = 1L;
-
-static void ant_channel_init(ant_channel_info_t *pstChnlInfo, const char *pcCharDevName);
-
-////////////////////////////////////////////////////////////////////
-//  ant_init
-//
-//  Initialises the native environment.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      ANT_STATUS_SUCCESS if intialize completed, else ANT_STATUS_FAILED
-//
-//  Psuedocode:
-/*
-Set variables to defaults
-Initialise each supported path to chip
-Setup eventfd object.
-RESULT = ANT_STATUS_SUCCESS if no problems else ANT_STATUS_FAILED
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_init(void)
-{
-   ANTStatus status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   stRxThreadInfo.stRxThread = 0;
-   stRxThreadInfo.ucRunThread = 0;
-   stRxThreadInfo.ucChipResetting = 0;
-   stRxThreadInfo.pstEnabledStatusLock = &stEnabledStatusLock;
-   g_fnStateCallback = 0;
-
-#ifdef ANT_DEVICE_NAME // Single transport path
-   ant_channel_init(&stRxThreadInfo.astChannels[SINGLE_CHANNEL], ANT_DEVICE_NAME);
-#else // Separate data/command paths
-   ant_channel_init(&stRxThreadInfo.astChannels[COMMAND_CHANNEL], ANT_COMMANDS_DEVICE_NAME);
-   ant_channel_init(&stRxThreadInfo.astChannels[DATA_CHANNEL], ANT_DATA_DEVICE_NAME);
-#endif // Separate data/command paths
-
-   // Make the eventfd. Want it non blocking so that we can easily reset it by reading.
-   stRxThreadInfo.iRxShutdownEventFd = eventfd(0, EFD_NONBLOCK);
-
-   // Check for error case
-   if(stRxThreadInfo.iRxShutdownEventFd == -1)
-   {
-      ANT_ERROR("ANT init failed. Could not create event fd. Reason: %s", strerror(errno));
-   } else {
-      status = ANT_STATUS_SUCCESS;
-   }
-
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_deinit
-//
-//  clean up eventfd object
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      ANT_STATUS_SUCCESS
-//
-//  Psuedocode:
-/*
-RESULT = SUCCESS
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_deinit(void)
-{
-   ANTStatus result_status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   if(close(stRxThreadInfo.iRxShutdownEventFd) < 0)
-   {
-      ANT_ERROR("Could not close eventfd in deinit. Reason: %s", strerror(errno));
-   } else {
-      result_status = ANT_STATUS_SUCCESS;
-   }
-
-   ANT_FUNC_END();
-   return result_status;
-}
-
-
-////////////////////////////////////////////////////////////////////
-//  ant_enable_radio
-//
-//  Powers on the ANT part and initialises the transport to the chip.
-//  Changes occur in part implementing ant_enable() call
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failures:
-//          ANT_STATUS_TRANSPORT_INIT_ERR if could not enable
-//          ANT_STATUS_FAILED if failed to get mutex or init rx thread
-//
-//  Psuedocode:
-/*
-LOCK enable_LOCK
-    State callback: STATE = ENABLING
-    ant enable
-    IF ant_enable success
-        State callback: STATE = ENABLED
-        RESULT = SUCCESS
-    ELSE
-        ant disable
-        State callback: STATE = Current state
-        RESULT = FAILURE
-    ENDIF
-UNLOCK
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_enable_radio(void)
-{
-   int iLockResult;
-   ANTStatus result_status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting stEnabledStatusLock in %s", __FUNCTION__);
-   iLockResult = pthread_mutex_lock(&stEnabledStatusLock);
-   if(iLockResult) {
-      ANT_ERROR("enable failed to get state lock: %s", strerror(iLockResult));
-      goto out;
-   }
-   ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-
-   if (g_fnStateCallback) {
-      g_fnStateCallback(RADIO_STATUS_ENABLING);
-   }
-
-   if (ant_enable() < 0) {
-      ANT_ERROR("ant enable failed: %s", strerror(errno));
-
-      ant_disable();
-
-      if (g_fnStateCallback) {
-         g_fnStateCallback(ant_radio_enabled_status());
-      }
-   } else {
-      if (g_fnStateCallback) {
-         g_fnStateCallback(RADIO_STATUS_ENABLED);
-      }
-
-      result_status = ANT_STATUS_SUCCESS;
-   }
-
-   ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&stEnabledStatusLock);
-   ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-
-out:
-   ANT_FUNC_END();
-   return result_status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_radio_hard_reset
-//
-//  IF SUPPORTED triggers a hard reset of the chip providing ANT functionality.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failures:
-//          ANT_STATUS_NOT_SUPPORTED if the chip can't hard reset
-//          ANT_STATUS_FAILED if failed to get mutex or enable
-//
-//  Psuedocode:
-/*
-IF Hard Reset not supported
-    RESULT = NOT SUPPORTED
-ELSE
-  LOCK enable_LOCK
-  IF Lock failed
-        RESULT = FAILED
-  ELSE
-    Set Flag Rx thread that chip is resetting
-    FOR each path to chip
-        Send Reset IOCTL to path
-    ENDFOR
-    ant disable
-    ant enable
-    IF ant_enable success
-        State callback: STATE = RESET
-        RESULT = SUCCESS
-    ELSE
-        State callback: STATE = DISABLED
-        RESULT = FAILURE
-    ENDIF
-    Clear Flag Rx thread that chip is resetting
-  UNLOCK
-ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_radio_hard_reset(void)
-{
-   ANTStatus result_status = ANT_STATUS_NOT_SUPPORTED;
-   ANT_FUNC_START();
-
-#ifdef ANT_IOCTL_RESET
-   ant_channel_type eChannel;
-   int iLockResult;
-
-   result_status = ANT_STATUS_FAILED;
-
-   ANT_DEBUG_V("getting stEnabledStatusLock in %s", __FUNCTION__);
-   iLockResult = pthread_mutex_lock(&stEnabledStatusLock);
-   if(iLockResult) {
-      ANT_ERROR("enable failed to get state lock: %s", strerror(iLockResult));
-      goto out;
-   }
-   ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-
-   stRxThreadInfo.ucChipResetting = 1;
-   if (g_fnStateCallback)
-      g_fnStateCallback(RADIO_STATUS_RESETTING);
-
-#ifdef ANT_IOCTL_RESET_PARAMETER
-   ioctl(stRxThreadInfo.astChannels[0].iFd, ANT_IOCTL_RESET, ANT_IOCTL_RESET_PARAMETER);
-#else
-   ioctl(stRxThreadInfo.astChannels[0].iFd, ANT_IOCTL_RESET);
-#endif  // ANT_IOCTL_RESET_PARAMETER
-
-   ant_disable();
-
-   if (ant_enable()) { /* failed */
-      if (g_fnStateCallback)
-         g_fnStateCallback(RADIO_STATUS_DISABLED);
-   } else { /* success */
-      if (g_fnStateCallback)
-         g_fnStateCallback(RADIO_STATUS_RESET);
-      result_status = ANT_STATUS_SUCCESS;
-   }
-   stRxThreadInfo.ucChipResetting = 0;
-
-   ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&stEnabledStatusLock);
-   ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-out:
-#endif // ANT_IOCTL_RESET
-
-   ANT_FUNC_END();
-   return result_status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_disable_radio
-//
-//  Powers off the ANT part and closes the transport to the chip.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failures:
-//          ANT_STATUS_FAILED if failed to get mutex
-//
-//  Psuedocode:
-/*
-LOCK enable_LOCK
-    State callback: STATE = DISABLING
-    ant disable
-    State callback: STATE = Current state
-    RESULT = SUCCESS
-UNLOCK
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_disable_radio(void)
-{
-   int iLockResult;
-   ANTStatus ret = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting stEnabledStatusLock in %s", __FUNCTION__);
-   iLockResult = pthread_mutex_lock(&stEnabledStatusLock);
-   if(iLockResult) {
-      ANT_ERROR("disable failed to get state lock: %s", strerror(iLockResult));
-      goto out;
-   }
-   ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-
-   if (g_fnStateCallback) {
-      g_fnStateCallback(RADIO_STATUS_DISABLING);
-   }
-
-   ant_disable();
-
-   if (g_fnStateCallback) {
-      g_fnStateCallback(ant_radio_enabled_status());
-   }
-
-   ret = ANT_STATUS_SUCCESS;
-
-   ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&stEnabledStatusLock);
-   ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-
-out:
-   ANT_FUNC_END();
-   return ret;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_radio_enabled_status
-//
-//  Gets the current chip/transport state; either disabled, disabling,
-//  enabling, enabled, or resetting.  Determines this on the fly by checking
-//  if Rx thread is running and how many of the paths for the ANT chip have
-//  open VFS files.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      The current radio status (ANTRadioEnabledStatus)
-//
-//  Psuedocode:
-/*
-IF Thread Resetting Flag is set
-    RESULT = Resetting
-ELSE
-    COUNT the number of open files
-    IF Thread Run Flag is Not Set
-        IF there are open files OR Rx thread exists
-            RESULT = Disabling
-        ELSE
-            RESULT = Disabled
-        ENDIF
-    ELSE
-        IF All files are open (all paths) AND Rx thread exists
-            RESULT = ENABLED
-        ELSE IF there are open files (Not 0 open files) AND Rx thread exists
-            RESULT = UNKNOWN
-        ELSE (0 open files or Rx thread does not exist [while Thread Run set])
-            RESULT = ENABLING
-        ENDIF
-    ENDIF
-ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTRadioEnabledStatus ant_radio_enabled_status(void)
-{
-   ant_channel_type eChannel;
-   int iOpenFiles = 0;
-   int iOpenThread;
-   ANTRadioEnabledStatus uiRet = RADIO_STATUS_UNKNOWN;
-   ANT_FUNC_START();
-
-   if (stRxThreadInfo.ucChipResetting) {
-      uiRet = RADIO_STATUS_RESETTING;
-      goto out;
-   }
-
-   for (eChannel = 0; eChannel < NUM_ANT_CHANNELS; eChannel++) {
-      if (stRxThreadInfo.astChannels[eChannel].iFd != -1) {
-         iOpenFiles++;
-      }
-   }
-
-   iOpenThread = (stRxThreadInfo.stRxThread) ? 1 : 0;
-
-   if (!stRxThreadInfo.ucRunThread) {
-      if (iOpenFiles || iOpenThread) {
-         uiRet = RADIO_STATUS_DISABLING;
-      } else {
-         uiRet = RADIO_STATUS_DISABLED;
-      }
-   } else {
-      if ((iOpenFiles == NUM_ANT_CHANNELS) && iOpenThread) {
-         uiRet = RADIO_STATUS_ENABLED;
-      } else if (!iOpenFiles && iOpenThread) {
-         uiRet = RADIO_STATUS_UNKNOWN;
-      } else {
-         uiRet = RADIO_STATUS_ENABLING;
-      }
-   }
-
-out:
-   ANT_DEBUG_D("get radio enabled status returned %d", uiRet);
-
-   ANT_FUNC_END();
-   return uiRet;
-}
-
-////////////////////////////////////////////////////////////////////
-//  set_ant_rx_callback
-//
-//  Sets which function to call when an ANT message is received.
-//
-//  Parameters:
-//      rx_callback_func   the ANTNativeANTEventCb function to be used for
-//                         received messages (from all transport paths).
-//
-//  Returns:
-//          ANT_STATUS_SUCCESS
-//
-//  Psuedocode:
-/*
-FOR each transport path
-    Path Rx Callback = rx_callback_func
-ENDFOR
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus set_ant_rx_callback(ANTNativeANTEventCb rx_callback_func)
-{
-   ANTStatus status = ANT_STATUS_SUCCESS;
-   ANT_FUNC_START();
-
-#ifdef ANT_DEVICE_NAME // Single transport path
-   stRxThreadInfo.astChannels[SINGLE_CHANNEL].fnRxCallback = rx_callback_func;
-#else // Separate data/command paths
-   stRxThreadInfo.astChannels[COMMAND_CHANNEL].fnRxCallback = rx_callback_func;
-   stRxThreadInfo.astChannels[DATA_CHANNEL].fnRxCallback = rx_callback_func;
-#endif // Separate data/command paths
-
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  set_ant_state_callback
-//
-//  Sets which function to call when an ANT state change occurs.
-//
-//  Parameters:
-//      state_callback_func   the ANTNativeANTStateCb function to be used
-//                            for received state changes.
-//
-//  Returns:
-//          ANT_STATUS_SUCCESS
-//
-//  Psuedocode:
-/*
-    State Callback = state_callback_func
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus set_ant_state_callback(ANTNativeANTStateCb state_callback_func)
-{
-   ANTStatus status = ANT_STATUS_SUCCESS;
-   ANT_FUNC_START();
-
-   g_fnStateCallback = state_callback_func;
-
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_tx_message_flowcontrol_wait
-//
-//  Sends an ANT message to the chip and waits for a CTS signal
-//
-//  Parameters:
-//      eTxPath          device to transmit message on
-//      eFlowMessagePath device that receives CTS
-//      ucMessageLength  the length of the message
-//      pucMesg          pointer to the message data
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failure:
-//          ANT_STATUS_NOT_ENABLED
-//
-//  Psuedocode:
-/*
-        LOCK flow control
-        IF Lock failed
-            RESULT = FAILED
-        ELSE
-            SET flowMessagePath Flow Control response as FLOW_STOP
-            WRITE txBuffer to txPath (only length of packet part)
-            IF Wrote less then 0 bytes
-                Log error
-                RESULT = FAILED
-            ELSE IF Didn't write 'length of packet' bytes
-                Log error
-                RESULT = FAILED
-            ELSE
-                IF flowMessagePath Flow Control response is not FLOW_GO
-                    WAIT until flowMessagePath Flow Control response is FLOW_GO, UNTIL FLOW_GO Wait Timeout seconds (10) from Now
-                    IF error Waiting
-                        IF error is Timeout
-                            RESULT = HARDWARE ERROR
-                        ELSE
-                            RESULT = FAILED
-                        ENDIF
-                    ELSE
-                        RESULT = SUCCESS
-                    ENDIF
-                ELSE
-                    RESULT = SUCCESS;
-                ENDIF
-            ENDIF
-            UNLOCK flow control
-        ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_tx_message_flowcontrol_wait(ant_channel_type eTxPath, ant_channel_type eFlowMessagePath, ANT_U8 ucMessageLength, ANT_U8 *pucTxMessage)
-{
-   int iMutexResult;
-   int iResult;
-   struct timespec stTimeout;
-   int iCondWaitResult;
-   ANTStatus status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting stFlowControlLock in %s", __FUNCTION__);
-   iMutexResult = pthread_mutex_lock(&stFlowControlLock);
-   if (iMutexResult) {
-      ANT_ERROR("failed to lock flow control mutex during tx: %s", strerror(iMutexResult));
-      goto out;
-   }
-   ANT_DEBUG_V("got stFlowControlLock in %s", __FUNCTION__);
-
-   stRxThreadInfo.astChannels[eFlowMessagePath].ucFlowControlResp = ANT_FLOW_STOP;
-
-#ifdef ANT_FLOW_RESEND
-   // Store Tx message so can resend it from Rx thread
-   stRxThreadInfo.astChannels[eFlowMessagePath].ucResendMessageLength = ucMessageLength;
-   stRxThreadInfo.astChannels[eFlowMessagePath].pucResendMessage = pucTxMessage;
-#endif // ANT_FLOW_RESEND
-
-   iResult = write(stRxThreadInfo.astChannels[eTxPath].iFd, pucTxMessage, ucMessageLength);
-   if (iResult < 0) {
-      ANT_ERROR("failed to write data message to device: %s", strerror(errno));
-   } else if (iResult != ucMessageLength) {
-      ANT_ERROR("bytes written and message size don't match up");
-   } else {
-      stTimeout.tv_sec = time(0) + ANT_FLOW_GO_WAIT_TIMEOUT_SEC;
-      stTimeout.tv_nsec = 0;
-
-      while (stRxThreadInfo.astChannels[eFlowMessagePath].ucFlowControlResp != ANT_FLOW_GO) {
-         iCondWaitResult = pthread_cond_timedwait(&stFlowControlCond, &stFlowControlLock, &stTimeout);
-         if (iCondWaitResult) {
-            ANT_ERROR("failed to wait for flow control response: %s", strerror(iCondWaitResult));
-
-            if (iCondWaitResult == ETIMEDOUT) {
-               status = ANT_STATUS_HARDWARE_ERR;
-
-#ifdef ANT_FLOW_RESEND
-               // Clear Tx message so will stop resending it from Rx thread
-               stRxThreadInfo.astChannels[eFlowMessagePath].ucResendMessageLength = 0;
-               stRxThreadInfo.astChannels[eFlowMessagePath].pucResendMessage = NULL;
-#endif // ANT_FLOW_RESEND
-            }
-            goto wait_error;
-         }
-      }
-
-      status = ANT_STATUS_SUCCESS;
-   }
-
-wait_error:
-   ANT_DEBUG_V("releasing stFlowControlLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&stFlowControlLock);
-   ANT_DEBUG_V("released stFlowControlLock in %s", __FUNCTION__);
-
-out:
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_tx_message_flowcontrol_none
-//
-//  Sends an ANT message to the chip without waiting for flow control
-//
-//  Parameters:
-//      eTxPath         device to transmit on
-//      ucMessageLength the length of the message
-//      pucMesg         pointer to the message data
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failure:
-//          ANT_STATUS_NOT_ENABLED
-//
-//  Psuedocode:
-/*
-        WRITE txBuffer to Tx Path (only length of packet part)
-        IF Wrote less then 0 bytes
-            Log error
-            RESULT = FAILED
-        ELSE IF Didn't write 'length of packet' bytes
-            Log error
-            RESULT = FAILED
-        ELSE
-            RESULT = SUCCESS
-        ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_tx_message_flowcontrol_none(ant_channel_type eTxPath, ANT_U8 ucMessageLength, ANT_U8 *pucTxMessage)
-{
-   int iResult;
-   ANTStatus status = ANT_STATUS_FAILED;\
-   ANT_FUNC_START();
-
-   iResult = write(stRxThreadInfo.astChannels[eTxPath].iFd, pucTxMessage, ucMessageLength);
-   if (iResult < 0) {
-      ANT_ERROR("failed to write message to device: %s", strerror(errno));
-   }  else if (iResult != ucMessageLength) {
-      ANT_ERROR("bytes written and message size don't match up");
-   } else {
-      status = ANT_STATUS_SUCCESS;
-   }
-
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_tx_message
-//
-//  Frames ANT data and decides which flow control method to use for sending the
-//  ANT message to the chip
-//
-//  Parameters:
-//      ucLen   the length of the message
-//      pucMesg pointer to the message data
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failure:
-//          ANT_STATUS_NOT_ENABLED
-//
-//  Psuedocode:
-/*
-IF not enabled
-    RESULT = BT NOT INITIALIZED
-ELSE
-    Create txBuffer, MAX HCI Message Size large
-    PUT ucLen in txBuffer AT ANT HCI Size Offset (0)
-    COPY pucMesg to txBuffer AT ANT HCI Header Size (1)     <- ? Not at offset?
-    LOG txBuffer as a serial Tx (only length of packet part)
-    IF is a data message
-        Tx message on Data Path with FLOW_GO/FLOW_STOP flow control (ant_tx_message_flowcontrol_go_stop())
-    ELSE
-        Tx message on Command Path with no flow control (ant_tx_message_flowcontrol_none())
-    ENDIF
-ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_tx_message(ANT_U8 ucLen, ANT_U8 *pucMesg)
-{
-   // During a tx we must prepend a packet type byte. Thus HCI_PACKET_TYPE_SIZE is added
-   // to all offsets when writing into the tx buffer.
-   ANTStatus status = ANT_STATUS_FAILED;
-   // TODO ANT_HCI_MAX_MSG_SIZE is transport (driver) dependent.
-   ANT_U8 txBuffer[HCI_PACKET_TYPE_SIZE + ANT_HCI_MAX_MSG_SIZE];
-   // TODO Message length can be greater than ANT_U8 can hold.
-   // Not changed as ANT_SERIAL takes length as ANT_U8.
-   ANT_U8 txMessageLength = HCI_PACKET_TYPE_SIZE + ucLen + ANT_HCI_HEADER_SIZE;
-   ANT_FUNC_START();
-
-   if (ant_radio_enabled_status() != RADIO_STATUS_ENABLED) {
-      status = ANT_STATUS_FAILED_BT_NOT_INITIALIZED;
-      goto out;
-   }
-
-#if ANT_HCI_OPCODE_SIZE == 1
-   txBuffer[HCI_PACKET_TYPE_SIZE + ANT_HCI_OPCODE_OFFSET] = ANT_HCI_OPCODE_TX;
-#elif ANT_HCI_OPCODE_SIZE > 1
-#error "Specified ANT_HCI_OPCODE_SIZE not currently supported"
-#endif
-
-#if ANT_HCI_SIZE_SIZE == 1
-   txBuffer[HCI_PACKET_TYPE_SIZE + ANT_HCI_SIZE_OFFSET] = ucLen;
-#elif ANT_HCI_SIZE_SIZE == 2
-   ANT_UTILS_StoreLE16(txBuffer + HCI_PACKET_TYPE_SIZE + ANT_HCI_SIZE_OFFSET, (ANT_U16)ucLen);
-#else
-#error "Specified ANT_HCI_SIZE_SIZE not currently supported"
-#endif
-
-   memcpy(txBuffer + HCI_PACKET_TYPE_SIZE + ANT_HCI_HEADER_SIZE, pucMesg, ucLen);
-
-// We no longer do the serial logging here because the packet type byte is not yet written.
-//ANT_SERIAL(txBuffer, txMessageLength, 'T');
-
-// We only do this if we are using single physical and logical channels.
-#if defined(ANT_DEVICE_NAME) && (HCI_PACKET_TYPE_SIZE == 0) // Single transport path
-   ANT_SERIAL(txBuffer, txMessageLength, 'T');
-   status = ant_tx_message_flowcontrol_wait(SINGLE_CHANNEL, SINGLE_CHANNEL, txMessageLength, txBuffer);
-#else // Separate data/command paths
-   // Each path follows this structure:
-   // write the packet type if needed.
-   // log the packet
-   // Send using the appropriate physical channel, waiting for flow control for data commands.
-   switch (txBuffer[HCI_PACKET_TYPE_SIZE + ANT_HCI_DATA_OFFSET + ANT_MSG_ID_OFFSET]) {
-   case MESG_BROADCAST_DATA_ID:
-   case MESG_ACKNOWLEDGED_DATA_ID:
-   case MESG_BURST_DATA_ID:
-   case MESG_EXT_BROADCAST_DATA_ID:
-   case MESG_EXT_ACKNOWLEDGED_DATA_ID:
-   case MESG_EXT_BURST_DATA_ID:
-   case MESG_ADV_BURST_DATA_ID:
-      ANT_DEBUG_V("Data Path");
-      #if HCI_PACKET_TYPE_SIZE == 1
-      txBuffer[0] = ANT_DATA_TYPE_PACKET;
-      #elif HCI_PACKET_TYPE_SIZE > 1
-      #error "Specified HCI_PACKET_TYPE_SIZE not supported"
-      #endif
-      ANT_SERIAL(txBuffer, txMessageLength, 'T');
-      #ifdef ANT_DEVICE_NAME
-      status = ant_tx_message_flowcontrol_wait(SINGLE_CHANNEL, SINGLE_CHANNEL, txMessageLength, txBuffer);
-      #else
-      status = ant_tx_message_flowcontrol_wait(DATA_CHANNEL, COMMAND_CHANNEL, txMessageLength, txBuffer);
-      #endif
-      break;
-   default:
-      ANT_DEBUG_V("Control Path");
-      #if HCI_PACKET_TYPE_SIZE == 1
-      txBuffer[0] = ANT_CMD_TYPE_PACKET;
-      #elif HCI_PACKET_TYPE_SIZE > 1
-      #error "Specified HCI_PACKET_TYPE_SIZE not supported"
-      #endif
-      ANT_SERIAL(txBuffer, txMessageLength, 'T');
-      #ifdef ANT_DEVICE_NAME
-      status = ant_tx_message_flowcontrol_none(SINGLE_CHANNEL, txMessageLength, txBuffer);
-      #else
-      status = ant_tx_message_flowcontrol_none(COMMAND_CHANNEL, txMessageLength, txBuffer);
-      #endif
-   }
-#endif // Separate data/command paths
-
-out:
-   ANT_FUNC_END();
-   return status;
-}
-
-//----------------- TODO Move these somewhere for multi transport path / dedicated channel support:
-
-static void ant_channel_init(ant_channel_info_t *pstChnlInfo, const char *pcCharDevName)
-{
-   ANT_FUNC_START();
-
-   // TODO Don't need to store, only accessed when trying to open:
-   // Is however useful for logs.
-   pstChnlInfo->pcDevicePath = pcCharDevName;
-
-   // This is the only piece of info that needs to be stored per channel
-   pstChnlInfo->iFd = -1;
-
-   // TODO Only 1 of these (not per-channel) is actually ever used:
-   pstChnlInfo->fnRxCallback = NULL;
-   pstChnlInfo->ucFlowControlResp = ANT_FLOW_GO;
-#ifdef ANT_FLOW_RESEND
-   pstChnlInfo->ucResendMessageLength = 0;
-   pstChnlInfo->pucResendMessage = NULL;
-#endif // ANT_FLOW_RESEND
-   // TODO Only used when Flow Control message received, so must only be Command path Rx thread
-   pstChnlInfo->pstFlowControlCond = &stFlowControlCond;
-   pstChnlInfo->pstFlowControlLock = &stFlowControlLock;
-
-   ANT_FUNC_END();
-}
-
-// This function is used as an alternative to opening the char device directly.
-// It is needed as libbt-vendor does the power up/down control for us when we open/close the file descriptor.
-int init_transport_bdroid(int on) {
-
-    void *so_handle;
-    unsigned char bdaddr[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
-    int  fd[CH_MAX], powerstate, ret;
-
-    if (on) {
-        so_handle = dlopen("libbt-vendor.so", RTLD_NOW);
-        if (!so_handle)
-        {
-           ALOGE("Failed to load vendor component");
-           return -1;
-        }
-
-        vendor_interface = (bt_vendor_interface_t *) dlsym(so_handle, "BLUETOOTH_VENDOR_LIB_INTERFACE");
-        if (!vendor_interface)
-        {
-            ALOGE("Failed to accesst bt vendor interface");
-            return -1;
-        }
-
-        vendor_interface->init(&vendor_callbacks, bdaddr);
-
-        ALOGI("Turn On BT power");
-        powerstate = BT_VND_PWR_ON;
-        ret = vendor_interface->op(BT_VND_OP_POWER_CTRL, &powerstate);
-        if (ret < 0)
-        {
-            ALOGE("Failed to turn on power from  bt vendor interface");
-            return -1;
-        }
-        /*call ANT_USERIAL_OPEN to get ANT handle*/
-        ret = vendor_interface->op(BT_VND_OP_ANT_USERIAL_OPEN, fd);
-        ALOGE("ret value: %d", ret);
-        if (ret != 1)
-        {
-            ALOGE("Failed to get fd from  bt vendor interface");
-            return -1;
-        } else {
-            ALOGE("FD: %x", fd[0]);
-            return fd[0];
-        }
-    } else {
-        if (vendor_interface) {
-            ALOGE("Close and cleanup the interfaces");
-            int ret = vendor_interface->op(BT_VND_OP_ANT_USERIAL_CLOSE, NULL);
-
-            ALOGE("ret value: %d", ret);
-            ALOGI("Turn off BT power");
-            powerstate = BT_VND_PWR_OFF;
-            ret = vendor_interface->op(BT_VND_OP_POWER_CTRL, &powerstate);
-            if (ret < 0)
-            {
-                ALOGE("Failed to turn off power from  bt vendor interface");
-                return -1;
-            }
-            vendor_interface->cleanup();
-            vendor_interface = NULL;
-            return 0;
-        } else {
-
-            ALOGE("Not able to find vendor interface handle");
-            return -1;
-        }
-    }
-}
-
-static void ant_disable_channel(ant_channel_info_t *pstChnlInfo)
-{
-   ANT_FUNC_START();
-   if (!pstChnlInfo) {
-      ANT_ERROR("null channel info passed to channel disable function");
-      goto out;
-   }
-   if (pstChnlInfo->iFd != -1) {
-      // Use the new init_transport function instead of open() to get our fd.
-      if (init_transport_bdroid(0) < 0) {
-         ANT_ERROR("failed to close channel %s(%#x): %s", pstChnlInfo->pcDevicePath, pstChnlInfo->iFd, strerror(errno));
-      }
-
-      pstChnlInfo->iFd = -1; //TODO can this overwrite a still valid fd?
-   } else {
-      ANT_DEBUG_D("%s file is already closed", pstChnlInfo->pcDevicePath);
-   }
-
-out:
-   ANT_FUNC_END();
-}
-
-static int ant_enable_channel(ant_channel_info_t *pstChnlInfo)
-{
-   int iRet = -1;
-   ANT_FUNC_START();
-   if (!pstChnlInfo) {
-      ANT_ERROR("null channel info passed to channel enable function");
-      errno = EINVAL;
-      goto out;
-   }
-   if (pstChnlInfo->iFd == -1) {
-      // Use the init_transport function to release our fd instead of close()
-      pstChnlInfo->iFd = init_transport_bdroid(1);
-      if (pstChnlInfo->iFd < 0) {
-         ANT_ERROR("failed to open dev %s: %s", pstChnlInfo->pcDevicePath, strerror(errno));
-         goto out;
-      }
-   } else {
-      ANT_DEBUG_D("%s is already enabled", pstChnlInfo->pcDevicePath);
-   }
-   iRet = 0;
-out:
-   ANT_FUNC_END();
-   return iRet;
-}
-
-//----------------------------------------------------------------------- This is antradio_power.h:
-
-int ant_enable(void)
-{
-   int iRet = -1;
-   ant_channel_type eChannel;
-   ANT_FUNC_START();
-
-   // Reset the shutdown signal.
-   uint64_t counter;
-   ssize_t result = read(stRxThreadInfo.iRxShutdownEventFd, &counter, sizeof(counter));
-   // EAGAIN result indicates that the counter was already 0 in non-blocking mode.
-   if(result < 0 && errno != EAGAIN)
-   {
-      ANT_ERROR("Could not clear shutdown signal in enable. Reason: %s", strerror(errno));
-      goto out;
-   }
-
-   stRxThreadInfo.ucRunThread = 1;
-
-   for (eChannel = 0; eChannel < NUM_ANT_CHANNELS; eChannel++) {
-      if (ant_enable_channel(&stRxThreadInfo.astChannels[eChannel]) < 0) {
-         ANT_ERROR("failed to enable channel %s: %s",
-                         stRxThreadInfo.astChannels[eChannel].pcDevicePath,
-                         strerror(errno));
-         goto out;
-      }
-   }
-
-   if (stRxThreadInfo.stRxThread == 0) {
-      if (pthread_create(&stRxThreadInfo.stRxThread, NULL, fnRxThread, &stRxThreadInfo) < 0) {
-         ANT_ERROR("failed to start rx thread: %s", strerror(errno));
-         goto out;
-      }
-   } else {
-      ANT_DEBUG_D("rx thread is already running");
-   }
-
-   if (!stRxThreadInfo.ucRunThread) {
-      ANT_ERROR("rx thread crashed during init");
-      goto out;
-   }
-
-   iRet = 0;
-
-out:
-   ANT_FUNC_END();
-   return iRet;
-}
-
-int ant_disable(void)
-{
-   int iRet = -1;
-   ant_channel_type eChannel;
-   ANT_FUNC_START();
-
-   stRxThreadInfo.ucRunThread = 0;
-
-   if (stRxThreadInfo.stRxThread != 0) {
-      ANT_DEBUG_I("Sending shutdown signal to rx thread.");
-      if(write(stRxThreadInfo.iRxShutdownEventFd, &EVENT_FD_PLUS_ONE, sizeof(EVENT_FD_PLUS_ONE)) < 0)
-      {
-         ANT_ERROR("failed to signal rx thread with eventfd. Reason: %s", strerror(errno));
-         goto out;
-      }
-      ANT_DEBUG_I("Waiting for rx thread to finish.");
-      if (pthread_join(stRxThreadInfo.stRxThread, NULL) < 0) {
-         ANT_ERROR("failed to join rx thread: %s", strerror(errno));
-         goto out;
-      }
-   } else {
-      ANT_DEBUG_D("rx thread is not running");
-   }
-
-   for (eChannel = 0; eChannel < NUM_ANT_CHANNELS; eChannel++) {
-      ant_disable_channel(&stRxThreadInfo.astChannels[eChannel]);
-   }
-
-   iRet = 0;
-
-out:
-   stRxThreadInfo.stRxThread = 0;
-   ANT_FUNC_END();
-   return iRet;
-}
-
-//---------------------------------------------------------
-
-const char *ant_get_lib_version()
-{
-   return "libantradio.so: "ANT_CHIP_NAME". Version "
-      LIBANT_STACK_MAJOR"."LIBANT_STACK_MINOR"."LIBANT_STACK_INCRE;
-}
diff --git a/src/bt-vendor_vfs/ant_rx_chardev.c b/src/bt-vendor_vfs/ant_rx_chardev.c
deleted file mode 100644
index 69656b2..0000000
--- a/src/bt-vendor_vfs/ant_rx_chardev.c
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ant_rx_chardev.c
-*
-*   BRIEF:
-*      This file implements the receive thread function which will loop reading
-*      ANT messages until told to exit.
-*
-*
-\******************************************************************************/
-
-#include <errno.h>
-#include <poll.h>
-#include <pthread.h>
-#include <stdint.h> /* for uint64_t */
-
-#include "ant_types.h"
-#include "antradio_power.h"
-#include "ant_rx_chardev.h"
-#include "ant_hci_defines.h"
-#include "ant_log.h"
-#include "ant_native.h"  // ANT_HCI_MAX_MSG_SIZE, ANT_MSG_ID_OFFSET, ANT_MSG_DATA_OFFSET,
-                         // ant_radio_enabled_status()
-
-extern ANTStatus ant_tx_message_flowcontrol_none(ant_channel_type eTxPath, ANT_U8 ucMessageLength, ANT_U8 *pucTxMessage);
-
-#undef LOG_TAG
-#define LOG_TAG "antradio_rx"
-
-#define ANT_POLL_TIMEOUT         ((int)30000)
-#define KEEPALIVE_TIMEOUT        ((int)5000)
-
-static ANT_U8 aucRxBuffer[NUM_ANT_CHANNELS][ANT_HCI_MAX_MSG_SIZE];
-
-#ifdef ANT_DEVICE_NAME // Single transport path
-   static int iRxBufferLength[NUM_ANT_CHANNELS] = {0};
-#else
-   static int iRxBufferLength[NUM_ANT_CHANNELS] = {0, 0};
-#endif //
-
-// Defines for use with the poll() call
-#define EVENT_DATA_AVAILABLE (POLLIN|POLLRDNORM)
-#define EVENT_CHIP_SHUTDOWN (POLLHUP)
-#define EVENT_HARD_RESET (POLLERR|POLLPRI|POLLRDHUP)
-
-#define EVENTS_TO_LISTEN_FOR (EVENT_DATA_AVAILABLE|EVENT_CHIP_SHUTDOWN|EVENT_HARD_RESET)
-
-// Plus one is for the eventfd shutdown signal.
-#define NUM_POLL_FDS (NUM_ANT_CHANNELS + 1)
-#define EVENTFD_IDX NUM_ANT_CHANNELS
-
-static ANT_U8 KEEPALIVE_MESG[] = {0x01, 0x00, 0x00};
-static ANT_U8 KEEPALIVE_RESP[] = {0x03, 0x40, 0x00, 0x00, 0x28};
-
-void doReset(ant_rx_thread_info_t *stRxThreadInfo);
-int readChannelMsg(ant_channel_type eChannel, ant_channel_info_t *pstChnlInfo);
-
-/*
- * Function to check that all given flags are set in a particular value.
- * Designed for use with the revents field of pollfds filled out by poll().
- *
- * Parameters:
- *    - value: The value that will be checked to contain all flags.
- *    - flags: Bitwise-or of the flags that value should be checked for.
- *
- * Returns:
- *    - true IFF all the bits that are set in 'flags' are also set in 'value'
- */
-ANT_BOOL areAllFlagsSet(short value, short flags)
-{
-   value &= flags;
-   return (value == flags);
-}
-
-/*
- * This thread is run occasionally as a detached thread in order to send a keepalive message to the
- * chip.
- */
-void *fnKeepAliveThread(void *unused)
-{
-   ANT_DEBUG_V("Sending dummy keepalive message.");
-   ant_tx_message(sizeof(KEEPALIVE_MESG)/sizeof(ANT_U8), KEEPALIVE_MESG);
-   return NULL;
-}
-
-/*
- * This thread waits for ANT messages from a VFS file.
- */
-void *fnRxThread(void *ant_rx_thread_info)
-{
-   int iMutexLockResult;
-   int iPollRet;
-   ant_rx_thread_info_t *stRxThreadInfo;
-   struct pollfd astPollFd[NUM_POLL_FDS];
-   ant_channel_type eChannel;
-   ANT_FUNC_START();
-
-   stRxThreadInfo = (ant_rx_thread_info_t *)ant_rx_thread_info;
-   for (eChannel = 0; eChannel < NUM_ANT_CHANNELS; eChannel++) {
-      astPollFd[eChannel].fd = stRxThreadInfo->astChannels[eChannel].iFd;
-      astPollFd[eChannel].events = EVENTS_TO_LISTEN_FOR;
-   }
-   // Fill out poll request for the shutdown signaller.
-   astPollFd[EVENTFD_IDX].fd = stRxThreadInfo->iRxShutdownEventFd;
-   astPollFd[EVENTFD_IDX].events = POLL_IN;
-
-   // Reset the waiting for response, since we don't want a stale value if we were reset.
-   stRxThreadInfo->bWaitingForKeepaliveResponse = ANT_FALSE;
-
-   /* continue running as long as not terminated */
-   while (stRxThreadInfo->ucRunThread) {
-      /* Wait for data available on any file (transport path), shorter wait if we just timed out. */
-      int timeout = stRxThreadInfo->bWaitingForKeepaliveResponse ? KEEPALIVE_TIMEOUT : ANT_POLL_TIMEOUT;
-      iPollRet = poll(astPollFd, NUM_POLL_FDS, timeout);
-      if (!iPollRet) {
-         if(!stRxThreadInfo->bWaitingForKeepaliveResponse)
-         {
-            stRxThreadInfo->bWaitingForKeepaliveResponse = ANT_TRUE;
-            // Keep alive is done on a separate thread so that rxThread can handle flow control during
-            // the message.
-            pthread_t thread;
-            // Don't care if it failed as the consequence is just a missed keep-alive.
-            pthread_create(&thread, NULL, fnKeepAliveThread, NULL);
-            // Detach the thread so that we don't need to join it later.
-            pthread_detach(thread);
-            ANT_DEBUG_V("poll timed out, checking exit cond");
-         } else
-         {
-            ANT_DEBUG_E("No response to keepalive, attempting recovery.");
-            doReset(stRxThreadInfo);
-            goto out;
-         }
-      } else if (iPollRet < 0) {
-         ANT_ERROR("unhandled error: %s, attempting recovery.", strerror(errno));
-         doReset(stRxThreadInfo);
-         goto out;
-      } else {
-         for (eChannel = 0; eChannel < NUM_ANT_CHANNELS; eChannel++) {
-            if (areAllFlagsSet(astPollFd[eChannel].revents, EVENT_HARD_RESET)) {
-               ANT_ERROR("Hard reset indicated by %s. Attempting recovery.",
-                            stRxThreadInfo->astChannels[eChannel].pcDevicePath);
-               doReset(stRxThreadInfo);
-               goto out;
-            } else if (areAllFlagsSet(astPollFd[eChannel].revents, EVENT_CHIP_SHUTDOWN)) {
-               /* chip reported it was unexpectedly disabled */
-               ANT_DEBUG_D(
-                     "poll hang-up from %s. exiting rx thread", stRxThreadInfo->astChannels[eChannel].pcDevicePath);
-
-               doReset(stRxThreadInfo);
-               goto out;
-            } else if (areAllFlagsSet(astPollFd[eChannel].revents, EVENT_DATA_AVAILABLE)) {
-               ANT_DEBUG_D("data on %s. reading it",
-                            stRxThreadInfo->astChannels[eChannel].pcDevicePath);
-
-               // Doesn't matter what data we received, we know the chip is alive.
-               stRxThreadInfo->bWaitingForKeepaliveResponse = ANT_FALSE;
-
-               if (readChannelMsg(eChannel, &stRxThreadInfo->astChannels[eChannel]) < 0) {
-                  // set flag to exit out of Rx Loop
-                  stRxThreadInfo->ucRunThread = 0;
-               }
-            } else if (areAllFlagsSet(astPollFd[eChannel].revents, POLLNVAL)) {
-               ANT_ERROR("poll was called on invalid file descriptor %s. Attempting recovery.",
-                     stRxThreadInfo->astChannels[eChannel].pcDevicePath);
-               doReset(stRxThreadInfo);
-               goto out;
-            } else if (areAllFlagsSet(astPollFd[eChannel].revents, POLLERR)) {
-               ANT_ERROR("Unknown error from %s. Attempting recovery.",
-                     stRxThreadInfo->astChannels[eChannel].pcDevicePath);
-               doReset(stRxThreadInfo);
-               goto out;
-            } else if (astPollFd[eChannel].revents) {
-               ANT_DEBUG_W("unhandled poll result %#x from %s",
-                            astPollFd[eChannel].revents,
-                            stRxThreadInfo->astChannels[eChannel].pcDevicePath);
-            }
-         }
-         // Now check for shutdown signal
-         if(areAllFlagsSet(astPollFd[EVENTFD_IDX].revents, POLLIN))
-         {
-            ANT_DEBUG_I("rx thread caught shutdown signal.");
-            // reset the counter by reading.
-            uint64_t counter;
-            read(stRxThreadInfo->iRxShutdownEventFd, &counter, sizeof(counter));
-            // don't care if read error, going to close the thread anyways.
-            stRxThreadInfo->ucRunThread = 0;
-         } else if (astPollFd[EVENTFD_IDX].revents != 0) {
-            ANT_ERROR("Shutdown event descriptor had unexpected event: %#x. exiting rx thread.",
-                  astPollFd[EVENTFD_IDX].revents);
-            stRxThreadInfo->ucRunThread = 0;
-         }
-      }
-   }
-
-   /* disable ANT radio if not already disabling */
-   // Try to get stEnabledStatusLock.
-   // if you get it then no one is enabling or disabling
-   // if you can't get it assume something made you exit
-   ANT_DEBUG_V("try getting stEnabledStatusLock in %s", __FUNCTION__);
-   iMutexLockResult = pthread_mutex_trylock(stRxThreadInfo->pstEnabledStatusLock);
-   if (!iMutexLockResult) {
-      ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-      ANT_WARN("rx thread has unexpectedly crashed, cleaning up");
-
-      // spoof our handle as closed so we don't try to join ourselves in disable
-      stRxThreadInfo->stRxThread = 0;
-
-      if (g_fnStateCallback) {
-         g_fnStateCallback(RADIO_STATUS_DISABLING);
-      }
-
-      ant_disable();
-
-      if (g_fnStateCallback) {
-         g_fnStateCallback(ant_radio_enabled_status());
-      }
-
-      ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-      pthread_mutex_unlock(stRxThreadInfo->pstEnabledStatusLock);
-      ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-   } else if (iMutexLockResult != EBUSY) {
-      ANT_ERROR("rx thread closing code, trylock on state lock failed: %s",
-            strerror(iMutexLockResult));
-   } else {
-      ANT_DEBUG_V("stEnabledStatusLock busy");
-   }
-
-   out:
-   ANT_FUNC_END();
-#ifdef ANDROID
-   return NULL;
-#endif
-}
-
-void doReset(ant_rx_thread_info_t *stRxThreadInfo)
-{
-   int iMutexLockResult;
-
-   ANT_FUNC_START();
-   /* Chip was reset or other error, only way to recover is to
-    * close and open ANT chardev */
-   stRxThreadInfo->ucChipResetting = 1;
-
-   if (g_fnStateCallback) {
-      g_fnStateCallback(RADIO_STATUS_RESETTING);
-   }
-
-   stRxThreadInfo->ucRunThread = 0;
-
-   ANT_DEBUG_V("getting stEnabledStatusLock in %s", __FUNCTION__);
-   iMutexLockResult = pthread_mutex_lock(stRxThreadInfo->pstEnabledStatusLock);
-   if (iMutexLockResult < 0) {
-      ANT_ERROR("chip was reset, getting state mutex failed: %s",
-            strerror(iMutexLockResult));
-      stRxThreadInfo->stRxThread = 0;
-      stRxThreadInfo->ucChipResetting = 0;
-   } else {
-      ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-
-      stRxThreadInfo->stRxThread = 0; /* spoof our handle as closed so we don't
-                                       * try to join ourselves in disable */
-
-      ant_disable();
-
-      int enableResult = ant_enable();
-
-      stRxThreadInfo->ucChipResetting = 0;
-      if (enableResult) { /* failed */
-         if (g_fnStateCallback) {
-            g_fnStateCallback(RADIO_STATUS_DISABLED);
-         }
-      } else { /* success */
-         if (g_fnStateCallback) {
-            g_fnStateCallback(RADIO_STATUS_RESET);
-         }
-      }
-
-      ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-      pthread_mutex_unlock(stRxThreadInfo->pstEnabledStatusLock);
-      ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-   }
-
-   ANT_FUNC_END();
-}
-
-////////////////////////////////////////////////////////////////////
-//  setFlowControl
-//
-//  Sets the flow control "flag" to the value provided and signals the transmit
-//  thread to check the value.
-//
-//  Parameters:
-//      pstChnlInfo   the details of the channel being updated
-//      ucFlowSetting the value to use
-//
-//  Returns:
-//      Success:
-//          0
-//      Failure:
-//          -1
-////////////////////////////////////////////////////////////////////
-int setFlowControl(ant_channel_info_t *pstChnlInfo, ANT_U8 ucFlowSetting)
-{
-   int iRet = -1;
-   int iMutexResult;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting stFlowControlLock in %s", __FUNCTION__);
-   iMutexResult = pthread_mutex_lock(pstChnlInfo->pstFlowControlLock);
-   if (iMutexResult) {
-      ANT_ERROR("failed to lock flow control mutex during response: %s", strerror(iMutexResult));
-   } else {
-      ANT_DEBUG_V("got stFlowControlLock in %s", __FUNCTION__);
-
-      pstChnlInfo->ucFlowControlResp = ucFlowSetting;
-
-      ANT_DEBUG_V("releasing stFlowControlLock in %s", __FUNCTION__);
-      pthread_mutex_unlock(pstChnlInfo->pstFlowControlLock);
-      ANT_DEBUG_V("released stFlowControlLock in %s", __FUNCTION__);
-
-      pthread_cond_signal(pstChnlInfo->pstFlowControlCond);
-
-      iRet = 0;
-   }
-
-   ANT_FUNC_END();
-   return iRet;
-}
-
-int readChannelMsg(ant_channel_type eChannel, ant_channel_info_t *pstChnlInfo)
-{
-   int iRet = -1;
-   int iRxLenRead;
-   int iCurrentHciPacketOffset;
-   int iHciDataSize;
-   ANT_FUNC_START();
-
-   // Keep trying to read while there is an error, and that error is EAGAIN
-   while (((iRxLenRead = read(pstChnlInfo->iFd, &aucRxBuffer[eChannel][iRxBufferLength[eChannel]], (sizeof(aucRxBuffer[eChannel]) - iRxBufferLength[eChannel]))) < 0)
-                   && errno == EAGAIN)
-      ;
-
-   if (iRxLenRead < 0) {
-      if (errno == ENODEV) {
-         ANT_ERROR("%s not enabled, exiting rx thread",
-               pstChnlInfo->pcDevicePath);
-
-         goto out;
-      } else if (errno == ENXIO) {
-         ANT_ERROR("%s there is no physical ANT device connected",
-               pstChnlInfo->pcDevicePath);
-
-         goto out;
-      } else {
-         ANT_ERROR("%s read thread exiting, unhandled error: %s",
-               pstChnlInfo->pcDevicePath, strerror(errno));
-
-         goto out;
-      }
-   } else {
-      ANT_SERIAL(aucRxBuffer[eChannel], iRxLenRead, 'R');
-
-      iRxLenRead += iRxBufferLength[eChannel];   // add existing data on
-
-      // if we didn't get a full packet, then just exit
-      if (iRxLenRead < (aucRxBuffer[eChannel][ANT_HCI_SIZE_OFFSET] + ANT_HCI_HEADER_SIZE + ANT_HCI_FOOTER_SIZE)) {
-         iRxBufferLength[eChannel] = iRxLenRead;
-         iRet = 0;
-         goto out;
-      }
-
-      iRxBufferLength[eChannel] = 0;    // reset buffer length here since we should have a full packet
-
-#if ANT_HCI_OPCODE_SIZE == 1  // Check the different message types by opcode
-      ANT_U8 opcode = aucRxBuffer[eChannel][ANT_HCI_OPCODE_OFFSET];
-
-      if(ANT_HCI_OPCODE_COMMAND_COMPLETE == opcode) {
-         // Command Complete, so signal a FLOW_GO
-         if(setFlowControl(pstChnlInfo, ANT_FLOW_GO)) {
-            goto out;
-         }
-      } else if(ANT_HCI_OPCODE_FLOW_ON == opcode) {
-         // FLow On, so resend the last Tx
-#ifdef ANT_FLOW_RESEND
-         // Check if there is a message to resend
-         if(pstChnlInfo->ucResendMessageLength > 0) {
-            ant_tx_message_flowcontrol_none(eChannel, pstChnlInfo->ucResendMessageLength, pstChnlInfo->pucResendMessage);
-         } else {
-            ANT_DEBUG_D("Resend requested by chip, but tx request cancelled");
-         }
-#endif // ANT_FLOW_RESEND
-      } else if(ANT_HCI_OPCODE_ANT_EVENT == opcode)
-         // ANT Event, send ANT packet to Rx Callback
-#endif // ANT_HCI_OPCODE_SIZE == 1
-      {
-      // Received an ANT packet
-         iCurrentHciPacketOffset = 0;
-
-         while(iCurrentHciPacketOffset < iRxLenRead) {
-
-            // TODO Allow HCI Packet Size value to be larger than 1 byte
-            // This currently works as no size value is greater than 255, and little endian
-            iHciDataSize = aucRxBuffer[eChannel][iCurrentHciPacketOffset + ANT_HCI_SIZE_OFFSET];
-
-            if ((iHciDataSize + ANT_HCI_HEADER_SIZE + ANT_HCI_FOOTER_SIZE + iCurrentHciPacketOffset) >
-                  iRxLenRead) {
-               // we don't have a whole packet
-               iRxBufferLength[eChannel] = iRxLenRead - iCurrentHciPacketOffset;
-               memcpy(aucRxBuffer[eChannel], &aucRxBuffer[eChannel][iCurrentHciPacketOffset], iRxBufferLength[eChannel]);
-               // the increment at the end should push us out of the while loop
-            } else
-#ifdef ANT_MESG_FLOW_CONTROL
-            if (aucRxBuffer[eChannel][iCurrentHciPacketOffset + ANT_HCI_DATA_OFFSET + ANT_MSG_ID_OFFSET] ==
-                  ANT_MESG_FLOW_CONTROL) {
-               // This is a flow control packet, not a standard ANT message
-               if(setFlowControl(pstChnlInfo, \
-                     aucRxBuffer[eChannel][iCurrentHciPacketOffset + ANT_HCI_DATA_OFFSET + ANT_MSG_DATA_OFFSET])) {
-                  goto out;
-               }
-            } else
-#endif // ANT_MESG_FLOW_CONTROL
-            {
-               ANT_U8 *msg = aucRxBuffer[eChannel] + iCurrentHciPacketOffset + ANT_HCI_DATA_OFFSET;
-               ANT_BOOL bIsKeepAliveResponse = memcmp(msg, KEEPALIVE_RESP, sizeof(KEEPALIVE_RESP)/sizeof(ANT_U8)) == 0;
-               if (bIsKeepAliveResponse) {
-                  ANT_DEBUG_V("Filtered out keepalive response.");
-               } else if (pstChnlInfo->fnRxCallback != NULL) {
-
-                  // Loop through read data until all HCI packets are written to callback
-                     pstChnlInfo->fnRxCallback(iHciDataSize, \
-                           msg);
-               } else {
-                  ANT_WARN("%s rx callback is null", pstChnlInfo->pcDevicePath);
-               }
-            }
-
-            iCurrentHciPacketOffset = iCurrentHciPacketOffset + ANT_HCI_HEADER_SIZE + ANT_HCI_FOOTER_SIZE + iHciDataSize;
-         }
-      }
-
-      iRet = 0;
-   }
-
-out:
-   ANT_FUNC_END();
-   return iRet;
-}
diff --git a/src/bt-vendor_vfs/inc/ant_hci_defines.h b/src/bt-vendor_vfs/inc/ant_hci_defines.h
deleted file mode 100644
index 3ffe672..0000000
--- a/src/bt-vendor_vfs/inc/ant_hci_defines.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2013 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*******************************************************************************\
-*
-*   FILE NAME:    ant_hci_defines.h
-*
-*   BRIEF:
-*      This file defines ANT specific HCI values used by the ANT chip that are
-*      not specific to the underlying chip. These should not need to be modified,
-*      but should be verified they are correct.
-*
-\*******************************************************************************/
-
-#ifndef __VFS_INDEPENDENT_H
-#define __VFS_INDEPENDENT_H
-
-// ANT HCI Packet Structure
-// -----------------------------------------
-// |         Header       | Data |  Footer  |
-// |----------------------|-----------------|
-// |Optional| Data | Opt. | ...  | Optional |
-// | Opcode | Size | Sync |      | Checksum |
-// Data may include any number of ANT packets, with no sync byte or checksum.
-// A read from the driver may return any number of ANT HCI packets.
-
-#include "ant_driver_defines.h"
-
-#define ANT_HCI_HEADER_SIZE                  ((ANT_HCI_OPCODE_SIZE) + (ANT_HCI_SIZE_SIZE) + (ANT_HCI_SYNC_SIZE))
-#define ANT_HCI_FOOTER_SIZE                  (ANT_HCI_CHECKSUM_SIZE)
-
-#define ANT_HCI_OPCODE_OFFSET                0
-#define ANT_HCI_SIZE_OFFSET                  ((ANT_HCI_OPCODE_OFFSET) + (ANT_HCI_OPCODE_SIZE))
-#define ANT_HCI_SYNC_OFFSET                  ((ANT_HCI_SIZE_OFFSET) + (ANT_HCI_SIZE_SIZE))
-#define ANT_HCI_DATA_OFFSET                  (ANT_HCI_HEADER_SIZE)
-
-#define ANT_FLOW_GO_WAIT_TIMEOUT_SEC         10
-
-#endif /* ifndef __VFS_INDEPENDENT_H */
diff --git a/src/bt-vendor_vfs/inc/ant_rx_chardev.h b/src/bt-vendor_vfs/inc/ant_rx_chardev.h
deleted file mode 100644
index 12ba629..0000000
--- a/src/bt-vendor_vfs/inc/ant_rx_chardev.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*******************************************************************************\
-*
-*   FILE NAME:      ant_rx_chardev.h
-*
-*   BRIEF:
-*      This file defines the receive thread function, the ant_rx_thread_info_t
-*      type for storing the -configuration- <state> of the receive thread, the
-*      ant_channel_info_t type for storing a channel's (transport path)
-*      configuration, and an enumeration of all ANT channels (transport paths).
-*
-*
-\*******************************************************************************/
-
-#ifndef __ANT_RX_NATIVE_H
-#define __ANT_RX_NATIVE_H
-
-#include "ant_native.h"
-#include "ant_hci_defines.h"
-
-/* same as HCI_MAX_EVENT_SIZE from hci.h, but hci.h is not included for vfs */
-#define ANT_HCI_MAX_MSG_SIZE 260
-
-#define ANT_MSG_SIZE_OFFSET     ((ANT_U8)0)
-#define ANT_MSG_ID_OFFSET       ((ANT_U8)1)
-#define ANT_MSG_DATA_OFFSET     ((ANT_U8)2)
-
-/* This struct defines the info passed to an rx thread */
-typedef struct {
-   /* Device path */
-   const char *pcDevicePath;
-   /* File descriptor to read from */
-   int iFd;
-   /* Callback to call with ANT packet */
-   ANTNativeANTEventCb fnRxCallback;
-   /* Flow control response if channel supports it */
-   ANT_U8 ucFlowControlResp;
-   /* Handle to flow control condition */
-   pthread_cond_t *pstFlowControlCond;
-   /* Handle to flow control mutex */
-   pthread_mutex_t *pstFlowControlLock;
-#ifdef ANT_FLOW_RESEND
-   /* Length of message to resend on request from chip */
-   ANT_U8 ucResendMessageLength;
-   /* The message to resend on request from chip */
-   ANT_U8 *pucResendMessage;
-#endif // ANT_FLOW_RESEND
-} ant_channel_info_t;
-
-typedef enum {
-#ifdef ANT_DEVICE_NAME // Single transport path
-   SINGLE_CHANNEL,
-#else // Separate data/command paths
-   DATA_CHANNEL,
-   COMMAND_CHANNEL,
-#endif // Separate data/command paths
-   NUM_ANT_CHANNELS
-} ant_channel_type;
-
-typedef struct {
-   /* Thread handle */
-   pthread_t stRxThread;
-   /* Exit condition */
-   ANT_U8 ucRunThread;
-   /* Set state as resetting override */
-   ANT_U8 ucChipResetting;
-   /* Handle to state change lock for crash cleanup */
-   pthread_mutex_t *pstEnabledStatusLock;
-   /* ANT channels */
-   ant_channel_info_t astChannels[NUM_ANT_CHANNELS];
-   /* Event file descriptor used to interrupt the poll() loop in the rx thread. */
-   int iRxShutdownEventFd;
-   /* Indicates whether thread is waiting for a keepalive response. */
-   ANT_BOOL bWaitingForKeepaliveResponse;
-} ant_rx_thread_info_t;
-
-extern ANTNativeANTStateCb g_fnStateCallback;  // TODO State callback should be inside ant_rx_thread_info_t.
-
-/* This is the rx thread function. It loops reading ANT packets until told to
- * exit */
-void *fnRxThread(void *ant_rx_thread_info);
-
-#endif /* ifndef __ANT_RX_NATIVE_H */
-
diff --git a/src/bt-vendor_vfs/inc/antradio_power.h b/src/bt-vendor_vfs/inc/antradio_power.h
deleted file mode 100644
index 1aa0b24..0000000
--- a/src/bt-vendor_vfs/inc/antradio_power.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __ANTRADIOPM_H
-#define __ANTRADIOPM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Enable the ANT radio interface.
- *
- * Responsible for power on, and bringing up HCI interface.
- * Will block until the HCI interface is ready to use.
- *
- * Returns 0 on success, -ve on error */
-int ant_enable();
-
-/* Disable the ANT radio interface.
- *
- * Responsbile for pulling down the HCI interface, and powering down the chip.
- * Will block until power down is complete, and it is safe to immediately call 
- * enable().
- *
- * Returns 0 on success, -ve on error */
-int ant_disable();
-
-/* Returns 1 if enabled, 0 if disabled, and -ve on error */
-int ant_is_enabled();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/bt-vendor_vfs/qualcomm/uart/ant_driver_defines.h b/src/bt-vendor_vfs/qualcomm/uart/ant_driver_defines.h
deleted file mode 100644
index 06b2e22..0000000
--- a/src/bt-vendor_vfs/qualcomm/uart/ant_driver_defines.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*******************************************************************************\
-*
-*   FILE NAME:    ant_driver_defines.h
-*
-*   BRIEF:
-*      This file defines ANT specific HCI values used by the ANT chip for a
-*      Qualcomm UART implementation.
-*
-*
-\*******************************************************************************/
-
-#ifndef __VFS_PRERELEASE_H
-#define __VFS_PRERELEASE_H
-
-// Packets may be prefixed with an optional packet type byte when being sent to
-// the chip. Will not be present in messages received.
-
-// -----------------------------------------
-// |         Header       | Data |  Footer  |
-// |----------------------|-----------------|
-// |Optional| Data | Opt. | ...  | Optional |
-// | Opcode | Size | Sync |      | Checksum |
-
-// Data may include any number of ANT packets, with no sync byte or checksum.
-// A read from the driver may return any number of ANT HCI packets.
-
-
-// ---------------------- REQUIRED
-
-// Which chip is this library being built for:
-#define ANT_CHIP_NAME                        "Qualcomm UART"
-
-// Set the file name the driver creates for the ANT device:
-//   If chip uses separate command and data paths:
-// #define ANT_COMMANDS_DEVICE_NAME             "/dev/X"
-// #define ANT_DATA_DEVICE_NAME                 "/dev/Y"
-// OR
-//   If chip uses one path:
-
-#define ANT_DEVICE_NAME                          "/dev/ttyHS0"
-
-// Optional Packet prefix byte.
-#define HCI_PACKET_TYPE_SIZE                 1
-
-// Set to the number of bytes of header is for Opcode:
-#define ANT_HCI_OPCODE_SIZE                  0
-
-// Set to the number of bytes of header is for Data Size:
-#define ANT_HCI_SIZE_SIZE                    1
-
-// Set to the number of bytes of header is for Sync:
-#define ANT_HCI_SYNC_SIZE                    0
-
-// Set to the number of bytes of footer is for Checksum:
-#define ANT_HCI_CHECKSUM_SIZE                0
-
-// ---------------------- OPTIONAL
-
-// If hard reset is supported, define ANT_IOCTL_RESET
-// #define ANT_IOCTL_RESET                      _IOW('U', 210, int)
-// #define ANT_IOCTL_RESET_PARAMETER            (0)
-
-// If the chip sends flow control messages:
-//  Define the Opcode for a Flow Control message:
-#define ANT_MESG_FLOW_CONTROL                ((ANT_U8)0xC9)
-// AND
-//   define the message content:
-//     That signals Flow Go:
-#define ANT_FLOW_GO                          ((ANT_U8)0x00)
-
-//     That signals Flow Stop:
-#define ANT_FLOW_STOP                        ((ANT_U8)0x80)
-
-// Define protocol byte to be added
-// as multiple data will be sent/received over
-// same transport(BT, ANT ..etc)
-// needed for HCI_PACKET_TYPE_SIZE > 1.
-#define ANT_CMD_TYPE_PACKET                  ((ANT_U8)0x0C)
-#define ANT_DATA_TYPE_PACKET                 ((ANT_U8)0x0E)
-
-#endif /* ifndef __VFS_PRERELEASE_H */
diff --git a/src/common/JAntNative.cpp b/src/common/JAntNative.cpp
deleted file mode 100644
index 2e3beb0..0000000
--- a/src/common/JAntNative.cpp
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2009 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*******************************************************************************\
-*
-*   FILE NAME:     JAntNative.cpp
-*
-*   BRIEF:
-*      This file provides the implementation of the native interface functions for ANT
-*
-*
-\*******************************************************************************/
-
-#include "android_runtime/AndroidRuntime.h"
-#include "jni.h"
-#include "nativehelper/JNIHelp.h"
-
-static JNIEnv *g_jEnv = NULL;
-static JavaVM *g_jVM = NULL;
-static jclass g_sJClazz;
-static jmethodID g_sMethodId_nativeCb_AntRxMessage;
-static jmethodID g_sMethodId_nativeCb_AntStateChange;
-
-extern "C"
-{
-   #include "ant_native.h"
-   #include "ant_log.h"
-   #undef LOG_TAG
-   #define LOG_TAG "JAntNative"
-
-   void nativeJAnt_RxCallback(ANT_U8 ucLen, ANT_U8* pucData);
-   void nativeJAnt_StateCallback(ANTRadioEnabledStatus uiNewState);
-}
-
-static jint nativeJAnt_Create(JNIEnv *env, jobject obj)
-{
-   ANTStatus antStatus = ANT_STATUS_FAILED;
-   (void)env; //unused warning
-   (void)obj; //unused warning
-
-   ANT_FUNC_START();
-
-   antStatus = ant_init();
-   if (antStatus)
-   {
-      ANT_DEBUG_D("failed to init ANT stack");
-      goto CLEANUP;
-   }
-
-   antStatus = set_ant_rx_callback(nativeJAnt_RxCallback);
-   if (antStatus)
-   {
-      ANT_DEBUG_D("failed to set ANT rx callback");
-      goto CLEANUP;
-   }
-
-   antStatus = set_ant_state_callback(nativeJAnt_StateCallback);
-   if (antStatus)
-   {
-      ANT_DEBUG_D("failed to set ANT state callback");
-      goto CLEANUP;
-   }
-
-CLEANUP:
-   ANT_FUNC_END();
-   return antStatus;
-}
-
-static jint nativeJAnt_Destroy(JNIEnv *env, jobject obj)
-{
-   (void)env; //unused warning
-   (void)obj; //unused warning
-   ANTStatus status;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_D("nativeJAnt_Destroy(): calling ant_deinit");
-   status = ant_deinit();
-   if (status)
-   {
-      ANT_DEBUG_D("failed to deinit ANT stack returned %d",(int)status);
-      return status;
-   }
-   else
-   {
-      ANT_DEBUG_D("deinit ANT stack Success");
-   }
-
-   ANT_FUNC_END();
-   return status;
-}
-
-static jint nativeJAnt_Enable(JNIEnv *env, jobject obj)
-{
-   (void)env; //unused warning
-   (void)obj; //unused warning
-   ANT_FUNC_START();
-
-   ANTStatus status = ant_enable_radio();
-
-   ANT_FUNC_END();
-   return status;
-}
-
-static jint nativeJAnt_Disable(JNIEnv *env, jobject obj)
-{
-   (void)env; //unused warning
-   (void)obj; //unused warning
-   ANT_FUNC_START();
-
-   ANTStatus status = ant_disable_radio();
-
-   ANT_FUNC_END();
-   return status;
-}
-
-static jint nativeJAnt_GetRadioEnabledStatus(JNIEnv *env, jobject obj)
-{
-   (void)env; //unused warning
-   (void)obj; //unused warning
-   ANT_FUNC_START();
-
-   jint status = ant_radio_enabled_status();
-
-   ANT_FUNC_END();
-   return status;
-}
-
-static jint nativeJAnt_TxMessage(JNIEnv *env, jobject obj, jbyteArray msg)
-{
-   (void)obj; //unused warning
-   ANT_FUNC_START();
-
-   if (msg == NULL)
-   {
-      if (jniThrowException(env, "java/lang/NullPointerException", NULL))
-      {
-         ANT_ERROR("Unable to throw NullPointerException");
-      }
-      return -1;
-   }
-
-   jbyte* msgBytes = env->GetByteArrayElements(msg, NULL);
-   jint msgLength = env->GetArrayLength(msg);
-
-   ANTStatus status = ant_tx_message((ANT_U8) msgLength, (ANT_U8 *)msgBytes);
-   ANT_DEBUG_D("nativeJAnt_TxMessage: ant_tx_message() returned %d", (int)status);
-
-   env->ReleaseByteArrayElements(msg, msgBytes, JNI_ABORT);
-
-   ANT_FUNC_END();
-   return status;
-}
-
-static jint nativeJAnt_HardReset(JNIEnv *env, jobject obj)
-{
-   (void)env; //unused warning
-   (void)obj; //unused warning
-   ANT_FUNC_START();
-
-   ANTStatus status = ant_radio_hard_reset();
-
-   ANT_FUNC_END();
-   return status;
-}
-
-extern "C"
-{
-
-   /**********************************************************************
-    *                              Callback registration
-    ***********************************************************************/
-   void nativeJAnt_RxCallback(ANT_U8 ucLen, ANT_U8* pucData)
-   {
-      JNIEnv* env = NULL;
-      jbyteArray jAntRxMsg = NULL;
-      ANT_FUNC_START();
-
-      ANT_DEBUG_D( "got message %d bytes", ucLen);
-
-      g_jVM->AttachCurrentThread((&env), NULL);
-
-      if (env == NULL)
-      {
-         ANT_DEBUG_D("nativeJAnt_RxCallback: Entered, env is null");
-         return; // log error? cleanup?
-      }
-      else
-      {
-         ANT_DEBUG_D("nativeJAnt_RxCallback: jEnv %p", env);
-      }
-
-      jAntRxMsg = env->NewByteArray(ucLen);
-
-      if (jAntRxMsg == NULL)
-      {
-         ANT_ERROR("nativeJAnt_RxCallback: Failed creating java byte[]");
-         goto CLEANUP;
-      }
-
-      env->SetByteArrayRegion(jAntRxMsg,0,ucLen,(jbyte*)pucData);
-
-      if (env->ExceptionOccurred())
-      {
-         ANT_ERROR("nativeJAnt_RxCallback: ExceptionOccurred during byte[] copy");
-         goto CLEANUP;
-      }
-      ANT_DEBUG_V("nativeJAnt_RxCallback: Calling java rx callback");
-      env->CallStaticVoidMethod(g_sJClazz, g_sMethodId_nativeCb_AntRxMessage, jAntRxMsg);
-      ANT_DEBUG_V("nativeJAnt_RxCallback: Called java rx callback");
-
-      if (env->ExceptionOccurred())
-      {
-         ANT_ERROR("nativeJAnt_RxCallback: Calling Java nativeCb_AntRxMessage failed");
-         goto CLEANUP;
-      }
-
-      //Delete the local references
-      if (jAntRxMsg != NULL)
-      {
-         env->DeleteLocalRef(jAntRxMsg);
-      }
-
-      ANT_DEBUG_D("nativeJAnt_RxCallback: Exiting, Calling DetachCurrentThread at the END");
-
-      g_jVM->DetachCurrentThread();
-
-      ANT_FUNC_END();
-      return;
-
-   CLEANUP:
-      ANT_ERROR("nativeJAnt_RxCallback: Exiting due to failure");
-      if (jAntRxMsg != NULL)
-      {
-         env->DeleteLocalRef(jAntRxMsg);
-      }
-
-      if (env->ExceptionOccurred())
-      {
-         env->ExceptionDescribe();
-         env->ExceptionClear();
-      }
-
-      g_jVM->DetachCurrentThread();
-
-      return;
-   }
-
-   void nativeJAnt_StateCallback(ANTRadioEnabledStatus uiNewState)
-   {
-      JNIEnv* env = NULL;
-      jint jNewState = uiNewState;
-      ANT_BOOL iShouldDetach = ANT_FALSE;
-      ANT_FUNC_START();
-
-      g_jVM->GetEnv((void**) &env, JNI_VERSION_1_4);
-      if (env == NULL)
-      {
-         ANT_DEBUG_D("nativeJAnt_StateCallback: called from rx thread, attaching to VM");
-         g_jVM->AttachCurrentThread((&env), NULL);
-         if (env == NULL)
-         {
-            ANT_DEBUG_E("nativeJAnt_StateCallback: failed to attach rx thread to VM");
-            return;
-         }
-         iShouldDetach = ANT_TRUE;
-      }
-      else
-      {
-         ANT_DEBUG_D("nativeJAnt_StateCallback: called from java enable/disable"
-                         ", already attached, don't detach");
-      }
-
-      ANT_DEBUG_V("nativeJAnt_StateCallback: Calling java state callback");
-      env->CallStaticVoidMethod(g_sJClazz, g_sMethodId_nativeCb_AntStateChange, jNewState);
-      ANT_DEBUG_V("nativeJAnt_StateCallback: Called java state callback");
-
-      if (env->ExceptionOccurred())
-      {
-         ANT_ERROR("nativeJAnt_StateCallback: Calling Java nativeCb_AntStateChange failed");
-         env->ExceptionDescribe();
-         env->ExceptionClear();
-      }
-
-      if (iShouldDetach)
-      {
-         ANT_DEBUG_D("nativeJAnt_StateCallback: env was attached, detaching");
-         g_jVM->DetachCurrentThread();
-      }
-
-      ANT_FUNC_END();
-      return;
-   }
-}
-
-static JNINativeMethod g_sMethods[] =
-{
-   /* name, signature, funcPtr */
-   {"nativeJAnt_Create", "()I", (void*)nativeJAnt_Create},
-   {"nativeJAnt_Destroy", "()I", (void*)nativeJAnt_Destroy},
-   {"nativeJAnt_Enable", "()I", (void*)nativeJAnt_Enable},
-   {"nativeJAnt_Disable", "()I", (void*)nativeJAnt_Disable},
-   {"nativeJAnt_GetRadioEnabledStatus", "()I", (void*)nativeJAnt_GetRadioEnabledStatus},
-   {"nativeJAnt_TxMessage","([B)I", (void*)nativeJAnt_TxMessage},
-   {"nativeJAnt_HardReset", "()I", (void *)nativeJAnt_HardReset}
-};
-
-jint JNI_OnLoad(JavaVM* vm, void* reserved) {
-   ANT_FUNC_START();
-   (void)reserved; //unused warning
-
-   g_jVM = vm;
-   if (g_jVM->GetEnv((void**) &g_jEnv, JNI_VERSION_1_4) != JNI_OK) {
-      ANT_ERROR("GetEnv failed");
-      return -1;
-   }
-   if (NULL == g_jEnv) {
-      ANT_ERROR("env is null");
-      return -1;
-   }
-
-   g_sJClazz = g_jEnv->FindClass("com/dsi/ant/core/JAntJava");
-   if (NULL == g_sJClazz) {
-      ANT_ERROR("could not find class \"com/dsi/ant/core/JAntJava\"");
-      return -1;
-   }
-
-   /* Save class information in global reference to prevent class unloading */
-   g_sJClazz = (jclass)g_jEnv->NewGlobalRef(g_sJClazz);
-
-   if (g_jEnv->RegisterNatives(g_sJClazz, g_sMethods, NELEM(g_sMethods)) != JNI_OK) {
-      ANT_ERROR("failed to register methods");
-      return -1;
-   }
-
-   g_sMethodId_nativeCb_AntRxMessage = g_jEnv->GetStaticMethodID(g_sJClazz,
-                                             "nativeCb_AntRxMessage", "([B)V");
-   if (NULL == g_sMethodId_nativeCb_AntRxMessage) {
-      ANT_ERROR("VerifyMethodId: Failed getting method id of \"void nativeCb_AntRxMessage(byte[])\"");
-      return -1;
-   }
-
-   g_sMethodId_nativeCb_AntStateChange = g_jEnv->GetStaticMethodID(g_sJClazz,
-                                             "nativeCb_AntStateChange", "(I)V");
-   if (NULL == g_sMethodId_nativeCb_AntStateChange) {
-      ANT_ERROR("VerifyMethodId: Failed getting method id of \"void nativeCb_AntStateChange(int)\"");
-      return -1;
-   }
-
-   ANT_FUNC_END();
-   return JNI_VERSION_1_4;
-}
-
diff --git a/src/common/ant_utils.c b/src/common/ant_utils.c
deleted file mode 100644
index 65b35de..0000000
--- a/src/common/ant_utils.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2009 Dynastream Innovations
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and  
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ANT_utils.c
-*
-*   BRIEF:          
-*		This file contains utility functions
-*
-*
-\******************************************************************************/
-
-#include "ant_types.h"
-#include "ant_utils.h"
-
-
-ANT_U16 ANT_UTILS_BEtoHost16(ANT_U8 * num)
-{
-    return (ANT_U16)(((ANT_U16) *(num) << 8) | ((ANT_U16) *(num+1)));
-}
-ANT_U16 ANT_UTILS_LEtoHost16(ANT_U8 * num)
-{
-    return (ANT_U16)(((ANT_U16) *(num+1) << 8) | ((ANT_U16) *(num)));
-}
-void ANT_UTILS_StoreBE16(ANT_U8 *buff, ANT_U16 be_value) 
-{
-   buff[0] = (ANT_U8)(be_value>>8);
-   buff[1] = (ANT_U8)be_value;
-}
-void ANT_UTILS_StoreLE16(ANT_U8 *buff, ANT_U16 le_value) 
-{
-   buff[1] = (ANT_U8)(le_value>>8);
-   buff[0] = (ANT_U8)le_value;
-}
-
-void ANT_UTILS_StoreBE32(ANT_U8 *buff, ANT_U32 be_value) 
-{
-   buff[0] = (ANT_U8)(be_value>>24);
-   buff[1] = (ANT_U8)(be_value>>16);
-   buff[2] = (ANT_U8)(be_value>>8);
-   buff[3] = (ANT_U8)be_value;
-}
diff --git a/src/common/inc/ant_log.h b/src/common/inc/ant_log.h
deleted file mode 100644
index bc45462..0000000
--- a/src/common/inc/ant_log.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
-* ANT Stack
-*
-* Copyright 2009 Dynastream Innovations
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/******************************************************************************\
-*
-* FILE NAME: ANT_log.h
-*
-* BRIEF:
-* This file defines logging functions
-*
-*
-\******************************************************************************/
-
-#ifndef __ANT_LOG_H
-#define __ANT_LOG_H
-
-#include <unistd.h>
-#include "ant_types.h"
-
-#define LEVEL_NONE      0
-#define LEVEL_ERROR     1
-#define LEVEL_WARNING   2
-#define LEVEL_INFO      3
-#define LEVEL_DEBUG     4
-#define LEVEL_VERBOSE   5
-
-#define STREAM_STDOUT   16
-#define STREAM_LOGCAT   17
-
-/* Define what stream output should go to depending on platform */
-#if defined(__ANDROID__) || defined(ANDROID)
-   #define ANT_OUTPUT_STREAM STREAM_LOGCAT
-#elif defined(__linux__) || defined(__linux) || defined(linux)
-   #define ANT_OUTPUT_STREAM STREAM_STDOUT
-#endif
-
-/* If no debug level defined, set default as none */
-#if !defined(ANT_DEBUG)
-   #define ANT_DEBUG LEVEL_NONE
-#endif
-
-/* Define to show function entry and exit */
-//#define ANT_STACK_TRACE
-
-/* Define to show message in byte form */
-//#define ANT_LOG_SERIAL
-
-/* Define to write serial log to file instead of logcat */
-//#define ANT_LOG_SERIAL_FILE "/data/system/antseriallog.txt"
-
-#undef LOG_TAG
-#define LOG_TAG "antradio"
-
-#if ANT_DEBUG == LEVEL_NONE
-   #undef ANT_STACK_TRACE
-   #undef ANT_LOG_SERIAL
-#endif
-
-#if ANT_DEBUG >= LEVEL_ERROR
-   #define OUTPUT_LEVEL_ERROR(...)     OUTPUT_ERROR(__VA_ARGS__)
-#else
-   #define OUTPUT_LEVEL_ERROR(...)     ((void)0)
-#endif
-#if ANT_DEBUG >= LEVEL_WARNING
-   #define OUTPUT_LEVEL_WARNING(...)   OUTPUT_WARNING(__VA_ARGS__)
-#else
-   #define OUTPUT_LEVEL_WARNING(...)   ((void)0)
-#endif
-#if ANT_DEBUG >= LEVEL_INFO
-   #define OUTPUT_LEVEL_INFO(...)      OUTPUT_INFO(__VA_ARGS__)
-#else
-   #define OUTPUT_LEVEL_INFO(...)      ((void)0)
-#endif
-#if ANT_DEBUG >= LEVEL_DEBUG
-   #define OUTPUT_LEVEL_DEBUG(...)     OUTPUT_DEBUG(__VA_ARGS__)
-#else
-   #define OUTPUT_LEVEL_DEBUG(...)     ((void)0)
-#endif
-#if ANT_DEBUG >= LEVEL_VERBOSE
-   #define OUTPUT_LEVEL_VERBOSE(...)   OUTPUT_VERBOSE(__VA_ARGS__)
-#else
-   #define OUTPUT_LEVEL_VERBOSE(...)   ((void)0)
-#endif
-
-#if ANT_OUTPUT_STREAM == STREAM_STDOUT
-   #include <stdio.h>
-   #define OUTPUT_VERBOSE(fmt, ...)    fprintf(stdout, LOG_TAG "<V>: " fmt "\n", ##__VA_ARGS__)
-   #define OUTPUT_DEBUG(fmt, ...)      fprintf(stdout, LOG_TAG "<D>: " fmt "\n", ##__VA_ARGS__)
-   #define OUTPUT_INFO(fmt, ...)       fprintf(stdout, LOG_TAG "<I>: " fmt "\n", ##__VA_ARGS__)
-   #define OUTPUT_WARNING(fmt, ...)    fprintf(stdout, LOG_TAG "<W>: " fmt "\n", ##__VA_ARGS__)
-   #define OUTPUT_ERROR(fmt, ...)      fprintf(stdout, LOG_TAG "<E>: " fmt "\n", ##__VA_ARGS__)
-#elif ANT_OUTPUT_STREAM == STREAM_LOGCAT
-   #if (ANT_DEBUG >= LEVEL_VERBOSE) || (defined(ANT_LOG_SERIAL) && !defined(ANT_LOG_SERIAL_FILE))
-      #undef NDEBUG /* Define verbose logging for logcat if required */
-   #endif
-   #include <cutils/log.h>
-   #define OUTPUT_VERBOSE(...)         ALOGV(__VA_ARGS__)
-   #define OUTPUT_DEBUG(...)           ALOGD(__VA_ARGS__)
-   #define OUTPUT_INFO(...)            ALOGI(__VA_ARGS__)
-   #define OUTPUT_WARNING(...)         ALOGW(__VA_ARGS__)
-   #define OUTPUT_ERROR(...)           ALOGE(__VA_ARGS__)
-#endif
-
-#define ANT_WARN(...)                  OUTPUT_WARNING(__VA_ARGS__)
-#define ANT_ERROR(...)                 OUTPUT_ERROR(__VA_ARGS__)
-
-#define ANT_DEBUG_V(...)               OUTPUT_LEVEL_VERBOSE(__VA_ARGS__)
-#define ANT_DEBUG_D(...)               OUTPUT_LEVEL_DEBUG(__VA_ARGS__)
-#define ANT_DEBUG_I(...)               OUTPUT_LEVEL_INFO(__VA_ARGS__)
-#define ANT_DEBUG_W(...)               OUTPUT_LEVEL_WARNING(__VA_ARGS__)
-#define ANT_DEBUG_E(...)               OUTPUT_LEVEL_ERROR(__VA_ARGS__)
-
-#if defined(ANT_STACK_TRACE)
-   #define ANT_FUNC_START()            OUTPUT_DEBUG("->  FUNC start %s", __FUNCTION__)
-   #define ANT_FUNC_END()              OUTPUT_DEBUG("<-  FUNC end   %s", __FUNCTION__)
-#else
-   #define ANT_FUNC_START()            ((void)0)
-   #define ANT_FUNC_END()              ((void)0)
-#endif
-
-#if defined(ANT_LOG_SERIAL)
-static inline void ANT_SERIAL(ANT_U8 *buf, ANT_U8 len, char dir)
-{
-   static const char hexToChar[] = {'0','1','2','3','4','5','6','7',
-                                    '8','9','A','B','C','D','E','F'};
-   int i;
-   static char log[1024];
-   char *ptr = log;
-
-   *(ptr++) = dir;
-   *(ptr++) = 'x';
-   *(ptr++) = ' ';
-   for (i = 0; i < len; i++) {
-      *(ptr++) = '[';
-      *(ptr++) = hexToChar[(buf[i] & 0xF0) >> 4];
-      *(ptr++) = hexToChar[(buf[i] & 0x0F) >> 0];
-      *(ptr++) = ']';
-   }
-#if defined(ANT_LOG_SERIAL_FILE)
-   *(ptr++) = '\n';
-   FILE *fd = NULL;
-   fd = fopen(ANT_LOG_SERIAL_FILE, "a");
-   if (NULL == fd) {
-      LOGW("Could not open %s for serial output. %s", ANT_LOG_SERIAL_FILE, strerror(errno));
-   } else {
-      fwrite(log, 1, (ptr - log), fd);
-      if (fclose(fd)) {
-         LOGW("Could not close file for serial output. %s", strerror(errno));
-      }
-   }
-#else
-   *(ptr++) = '\0';
-   OUTPUT_VERBOSE("%s", log);
-#endif
-}
-#else
-   #define ANT_SERIAL(...)             ((void)0)
-#endif
-
-#endif /* __ANT_LOG_H */
diff --git a/src/common/inc/ant_native.h b/src/common/inc/ant_native.h
deleted file mode 100644
index 6fe106d..0000000
--- a/src/common/inc/ant_native.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2009 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ant_native.h
-*
-*   BRIEF:
-*		This file defines the interface to the ANT transport layer
-*
-*
-\******************************************************************************/
-
-#ifndef __ANT_NATIVE_H
-#define __ANT_NATIVE_H
-
-/*******************************************************************************
- *
- * Include files
- *
- ******************************************************************************/
-#include "ant_types.h"
-
-/*******************************************************************************
- *
- * Constants
- *
- ******************************************************************************/
-
-/*******************************************************************************
- *
- * Types
- *
- ******************************************************************************/
-typedef void (*ANTNativeANTEventCb)(ANT_U8 ucLen, ANT_U8* pucData);
-typedef void (*ANTNativeANTStateCb)(ANTRadioEnabledStatus uiNewState);
-
-/*******************************************************************************
- *
- * Data Structures
- *
- ******************************************************************************/
-
-/*******************************************************************************
- *
- * Function declarations
- *
- ******************************************************************************/
-
-/*------------------------------------------------------------------------------
- * ant_init()
- *
- * Called to initialize the ANT stack
- */
-ANTStatus ant_init(void);
-
-/*------------------------------------------------------------------------------
- * ant_deinit()
- *
- * Called to de-initialize the ANT stack
- */
-ANTStatus ant_deinit(void);
-
-/*------------------------------------------------------------------------------
- * ant_enable_radio()
- *
- * Power on the chip and set it to a state which can read / write to it
- */
-ANTStatus ant_enable_radio(void);
-
-/*------------------------------------------------------------------------------
- * ant_disable_radio()
- *
- * Kill power to the ANT chip and set state which doesnt allow read / write
- */
-ANTStatus ant_disable_radio(void);
-
-/*------------------------------------------------------------------------------
- * ant_radio_enabled_status()
- *
- * Gets if the chip/transport is disabled/disabling/enabling/enabled
- */
-ANTRadioEnabledStatus ant_radio_enabled_status(void);
-
-/*------------------------------------------------------------------------------
- * set_ant_rx_callback()
- *
- * Sets the callback function for receiving ANT messages
- */
-ANTStatus set_ant_rx_callback(ANTNativeANTEventCb rx_callback_func);
-
-/*------------------------------------------------------------------------------
- * set_ant_state_callback()
- *
- * Sets the callback function for any ANT radio enabled status state changes
- */
-ANTStatus set_ant_state_callback(ANTNativeANTStateCb state_callback_func);
-
-/*------------------------------------------------------------------------------
- * ant_tx_message()
- *
- * Sends an ANT message command to the chip.
- */
-ANTStatus ant_tx_message(ANT_U8 ucLen, ANT_U8 *pucMesg);
-
-/*------------------------------------------------------------------------------
- * ant_radio_hard_reset()
- *
- * If supported, forces the chip to do a power cycle reset
- */
-ANTStatus ant_radio_hard_reset(void);
-
-/*------------------------------------------------------------------------------
- * ant_get_lib_version()
- *
- * Gets the current version and transport type of libantradio.so
- */
-const char *ant_get_lib_version(void);
-
-#endif /* ifndef __ANT_NATIVE_H */
-
diff --git a/src/common/inc/ant_types.h b/src/common/inc/ant_types.h
deleted file mode 100644
index bc896b6..0000000
--- a/src/common/inc/ant_types.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2009 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ANT_types.h
-*
-*   BRIEF:
-*		This file defines types used in the ANT stack
-*
-*
-\******************************************************************************/
-
-#ifndef __ANT_TYPES_H
-#define __ANT_TYPES_H
-
-#include <stdint.h>
-
-/* -------------------------------------------------------------
- *                  8 Bits Types
- */
-typedef uint8_t     ANT_U8;
-typedef int8_t      ANT_S8;
-
-/* -------------------------------------------------------------
- *                  16 Bits Types
- */
-typedef uint16_t    ANT_U16;
-typedef int8_t      ANT_S16;
-
-/* -------------------------------------------------------------
- *                  32 Bits Types
- */
-typedef uint32_t    ANT_U32;
-typedef int32_t     ANT_S32;
-
-
-/* -------------------------------------------------------------
- *          Native Integer Types (# of bits irrelevant)
- */
-typedef int          ANT_INT;
-typedef unsigned int ANT_UINT;
-
-
-/* --------------------------------------------------------------
- *                  Boolean Definitions
- */
-typedef ANT_INT     ANT_BOOL;
-
-#define ANT_TRUE    (1 == 1)
-#define ANT_FALSE   (1 == 0)
-
-/*
-*/
-#define ANT_NO_VALUE                                    ((ANT_U32)0xFFFFFFFFUL)
-
-
-/* -------------------------------------------------------------
- *              ANTRadioEnabledStatus Type
- */
-typedef ANT_UINT ANTRadioEnabledStatus;
-
-#define RADIO_STATUS_UNKNOWN                          ((ANTRadioEnabledStatus)0)
-#define RADIO_STATUS_ENABLING                         ((ANTRadioEnabledStatus)1)
-#define RADIO_STATUS_ENABLED                          ((ANTRadioEnabledStatus)2)
-#define RADIO_STATUS_DISABLING                        ((ANTRadioEnabledStatus)3)
-#define RADIO_STATUS_DISABLED                         ((ANTRadioEnabledStatus)4)
-#define RADIO_STATUS_NOT_SUPPORTED                    ((ANTRadioEnabledStatus)5)
-#define RADIO_STATUS_SERVICE_NOT_INSTALLED            ((ANTRadioEnabledStatus)6)
-#define RADIO_STATUS_SERVICE_NOT_CONNECTED            ((ANTRadioEnabledStatus)7)
-#define RADIO_STATUS_RESETTING                        ((ANTRadioEnabledStatus)8)
-#define RADIO_STATUS_RESET                            ((ANTRadioEnabledStatus)9)
-
-/*------------------------------------------------------------------------------
- * ANTStatus Type
- *
- */
-typedef ANT_UINT ANTStatus;
-
-#define ANT_STATUS_SUCCESS                                  ((ANTStatus)0)
-#define ANT_STATUS_FAILED                                   ((ANTStatus)1)
-#define ANT_STATUS_PENDING                                  ((ANTStatus)2)
-#define ANT_STATUS_INVALID_PARM                             ((ANTStatus)3)
-#define ANT_STATUS_IN_PROGRESS                              ((ANTStatus)4)
-#define ANT_STATUS_NOT_APPLICABLE                           ((ANTStatus)5)
-#define ANT_STATUS_NOT_SUPPORTED                            ((ANTStatus)6)
-#define ANT_STATUS_INTERNAL_ERROR                           ((ANTStatus)7)
-#define ANT_STATUS_TRANSPORT_INIT_ERR                       ((ANTStatus)8)
-#define ANT_STATUS_HARDWARE_ERR                             ((ANTStatus)9)
-#define ANT_STATUS_NO_VALUE_AVAILABLE                       ((ANTStatus)10)
-#define ANT_STATUS_CONTEXT_DOESNT_EXIST                     ((ANTStatus)11)
-#define ANT_STATUS_CONTEXT_NOT_DESTROYED                    ((ANTStatus)12)
-#define ANT_STATUS_CONTEXT_NOT_ENABLED                      ((ANTStatus)13)
-#define ANT_STATUS_CONTEXT_NOT_DISABLED                     ((ANTStatus)14)
-#define ANT_STATUS_NOT_DE_INITIALIZED                       ((ANTStatus)15)
-#define ANT_STATUS_NOT_INITIALIZED                          ((ANTStatus)16)
-#define ANT_STATUS_TOO_MANY_PENDING_CMDS                    ((ANTStatus)17)
-#define ANT_STATUS_DISABLING_IN_PROGRESS                    ((ANTStatus)18)
-
-#define ANT_STATUS_COMMAND_WRITE_FAILED                     ((ANTStatus)20)
-#define ANT_STATUS_SCRIPT_EXEC_FAILED                       ((ANTStatus)21)
-
-#define ANT_STATUS_FAILED_BT_NOT_INITIALIZED                ((ANTStatus)23)
-#define ANT_STATUS_AUDIO_OPERATION_UNAVAILIBLE_RESOURCES    ((ANTStatus)24)
-
-#define ANT_STATUS_TRANSPORT_UNSPECIFIED_ERROR              ((ANTStatus)30)
-
-#define ANT_STATUS_NO_VALUE                                 ((ANTStatus)100)
-
-#endif  /* __ANT_TYPES_H */
-
diff --git a/src/common/inc/ant_utils.h b/src/common/inc/ant_utils.h
deleted file mode 100644
index 60abe8c..0000000
--- a/src/common/inc/ant_utils.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2009 Dynastream Innovations
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and  
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ANT_utils.h
-*
-*   BRIEF:          
-*		This file defines utility functions
-*
-*
-\******************************************************************************/
-#ifndef __ANT_UTILS_H
-#define __ANT_UTILS_H
-
-#include "ant_types.h"
-
-/****************************************************************************
- *
- * Type Definitions
- *
- ****************************************************************************/
-
-
-
-/*------------------------------------------------------------------------------
- * ANT_xxx()
- *
- * Brief:  
- *      xxx
- *
- * Description:
- *      xxx
- *
- * Type:
- *      Syxxx/As
- *
- * Parameters:
- *      xxx [in]    - 
- *
- * Returns:
- *      xxx
- */
-ANT_U16 ANT_UTILS_BEtoHost16(ANT_U8 * num);
-/*------------------------------------------------------------------------------
- * ANT_xxx()
- *
- * Brief:  
- *      xxx
- *
- * Description:
- *      xxx
- *
- * Type:
- *      Syxxx/As
- *
- * Parameters:
- *      xxx [in]    - 
- *
- * Returns:
- *      xxx
- */
-ANT_U16 ANT_UTILS_LEtoHost16(ANT_U8 * num);
-/*------------------------------------------------------------------------------
- * ANT_xxx()
- *
- * Brief:  
- *      xxx
- *
- * Description:
- *      xxx
- *
- * Type:
- *      Syxxx/As
- *
- * Parameters:
- *      xxx [in]    - 
- *
- * Returns:
- *      xxx
- */
-void ANT_UTILS_StoreBE16(ANT_U8 *buff, ANT_U16 be_value) ;
-/*------------------------------------------------------------------------------
- * ANT_xxx()
- *
- * Brief:  
- *      xxx
- *
- * Description:
- *      xxx
- *
- * Type:
- *      Syxxx/As
- *
- * Parameters:
- *      xxx [in]    - 
- *
- * Returns:
- *      xxx
- */
-void ANT_UTILS_StoreLE16(ANT_U8 *buff, ANT_U16 le_value) ;
-/*------------------------------------------------------------------------------
- * ANT_xxx()
- *
- * Brief:  
- *      xxx
- *
- * Description:
- *      xxx
- *
- * Type:
- *      Syxxx/As
- *
- * Parameters:
- *      xxx [in]    - 
- *
- * Returns:
- *      xxx
- */
-void ANT_UTILS_StoreBE32(ANT_U8 *buff, ANT_U32 be_value) ;
-
-
-
-#endif  /* __ANT_UTILS_H */
-
diff --git a/src/common/inc/ant_version.h b/src/common/inc/ant_version.h
deleted file mode 100644
index 4a8881a..0000000
--- a/src/common/inc/ant_version.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __ANT_VERSION_H
-#define __ANT_VERSION_H
-
-#define LIBANT_STACK_MAJOR "1"
-#define LIBANT_STACK_MINOR "9"
-#define LIBANT_STACK_INCRE "7"
-
-#endif // __ANT_VERSION_H
-
diff --git a/src/qcomm-hidl/Android.mk b/src/qcomm-hidl/Android.mk
deleted file mode 100644
index 55f8d3d..0000000
--- a/src/qcomm-hidl/Android.mk
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# Copyright (C) 2011 Dynastream Innovations
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include $(CLEAR_VARS)
-
-LOCAL_CFLAGS := -g -c -W -Wall -O2
-
-# needed to pull in the header file for libbt-vendor.so
-BDROID_DIR:= system/bt
-HWBINDER_DIR := system/hwbinder
-QCOM_DIR:= hardware/qcom/bt/libbt-vendor
-
-# Added hci/include to give access to the header for the libbt-vendorso interface.
-LOCAL_C_INCLUDES := \
-   $(LOCAL_PATH)/src/common/inc \
-   $(LOCAL_PATH)/$(ANT_DIR)/inc \
-   $(BDROID_DIR)/hci/include \
-   $(QCOM_DIR)/include \
-   $(HWBINDER_DIR)/include
-
-
-ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"qualcomm-hidl")
-LOCAL_C_INCLUDES += \
-   $(LOCAL_PATH)/$(ANT_DIR)/qualcomm/hidl
-
-endif # BOARD_ANT_WIRELESS_DEVICE = "qualcomm-hidl"
-
-LOCAL_SRC_FILES := \
-   $(COMMON_DIR)/ant_utils.c \
-   $(ANT_DIR)/ant_native_chardev.c \
-   $(ANT_DIR)/ant_rx_chardev.c \
-   $(ANT_DIR)/AntHidlClient.cpp
-
-LOCAL_SRC_FILES += $(COMMON_DIR)/JAntNative.cpp
-
-
-# JNI
-LOCAL_C_INCLUDE += $(JNI_H_INCLUDE)
-
-LOCAL_SHARED_LIBRARIES += \
-   libnativehelper \
-   libbase \
-   libhidlbase \
-   libhidltransport \
-   libhwbinder \
-   libutils \
-   com.qualcomm.qti.ant@1.0 \
-   android.hardware.bluetooth@1.0 \
-
-# logging and dll loading
-LOCAL_SHARED_LIBRARIES += \
-   libcutils \
-   libdl \
-   liblog
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE := libantradio
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/src/qcomm-hidl/AntHidlClient.cpp b/src/qcomm-hidl/AntHidlClient.cpp
deleted file mode 100644
index 616a5a6..0000000
--- a/src/qcomm-hidl/AntHidlClient.cpp
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- *Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- *
- *Redistribution and use in source and binary forms, with or without
- *modification, are permitted provided that the following conditions are
- *met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer in the documentation and/or other materials provided
- *      with the distribution.
- *    * Neither the name of The Linux Foundation nor the names of its
- *      contributors may be used to endorse or promote products derived
- *      from this software without specific prior written permission.
- *
- *
- *THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- *WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- *ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- *BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- *WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- *OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- *IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#include <iostream>       // std::cin, std::cout
-#include <queue>          // std::queue
-#include <mutex>              // std::mutex, std::unique_lock
-#include <condition_variable> // std::condition_variable
-#include <cstdlib>
-#include <thread>
-
-#include <hwbinder/ProcessState.h>
-
-#include <com/qualcomm/qti/ant/1.0/IAntHci.h>
-#include <com/qualcomm/qti/ant/1.0/IAntHciCallbacks.h>
-#include <com/qualcomm/qti/ant/1.0/types.h>
-
-#include <utils/Log.h>
-
-
-#include <hidl/Status.h>
-#include <hwbinder/ProcessState.h>
-#include "ant_types.h"
-#include "AntHidlClient.h"
-
-using com::qualcomm::qti::ant::V1_0::IAntHci;
-using com::qualcomm::qti::ant::V1_0::IAntHciCallbacks;
-using com::qualcomm::qti::ant::V1_0::AntPacket;
-using com::qualcomm::qti::ant::V1_0::Status;
-
-using ::android::hardware::hidl_vec;
-
-
-using android::hardware::ProcessState;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::sp;
-android::sp<IAntHci> anthci;
-typedef std::unique_lock<std::mutex> Lock;
-
-#define POLL_TIMEOUT_MS    100
-
-struct ant_hci_t {
-public:
-   std::condition_variable rx_cond;
-   std::condition_variable on_cond;
-   std::condition_variable data_cond;
-   std::mutex on_mtx;
-   std::mutex rx_mtx;
-   std::mutex data_mtx;
-   ant_power_state_t state;
-   volatile bool rx_processing;
-};
-
-static struct ant_hci_t ant_hci;
-
-Return<void> initialization_complete(bool is_hci_initialize)
-{
-   ALOGI("%s start ", __func__ );
-
-   Lock lk(ant_hci.on_mtx);
-   if (is_hci_initialize)
-   {
-      ant_hci.state = ANT_RADIO_ENABLED;
-   }
-   else
-   {
-      ALOGE("%s:Ant hci init failed :%d", __func__, is_hci_initialize);
-      ant_hci.state = ANT_RADIO_DISABLED;
-   }
-   ant_hci.on_cond.notify_all();
-   ALOGI("%s: exit", __func__);
-   return Void();
-}
-
-
-class AntHciCallbacks : public IAntHciCallbacks {
-public:
-   AntHciCallbacks() {};
-   virtual ~AntHciCallbacks() = default;
-
-   Return<void> initializationComplete(Status status)
-   {
-      ALOGI("%s", __func__);
-      if(status == Status::SUCCESS)
-      {
-         initialization_complete(true);
-      } else {
-         initialization_complete(false);
-      }
-      ALOGI("%s: exit", __func__);
-      return Void();
-   }
-
-   Return<void> antControlReceived(const hidl_vec<uint8_t>& event)
-   {
-      ALOGV("%s:start ", __func__);
-      // Make sure we don't overwrite a message still processing.
-      Lock lk(ant_hci.rx_mtx);
-      if(ant_hci.rx_processing && ant_hci.state == ANT_RADIO_ENABLED)
-      {
-         ant_hci.rx_cond.wait(lk);
-      }
-
-      memcpy(&aucRxBuffer[0][0], event.data(), event.size());
-      iRxBufferLength[0] = event.size();
-      std::unique_lock< std::mutex> lock(ant_hci.data_mtx);
-      ALOGD("%s:  notify data avail", __func__);
-      ant_hci.rx_processing = true;
-      ant_hci.data_cond.notify_all();
-      ALOGV("%s:  End", __func__);
-      return Void();
-   }
-
-   Return<void> antDataReceived(const hidl_vec<uint8_t>& event)
-   {
-      ALOGV("%s:start  ", __func__);
-      // Make sure we don't overwrite a message still processing.
-      Lock lk(ant_hci.rx_mtx);
-      if(ant_hci.rx_processing && ant_hci.state == ANT_RADIO_ENABLED)
-      {
-         ant_hci.rx_cond.wait(lk);
-      }
-
-      memcpy(&aucRxBuffer[0][0], event.data(), event.size());
-      iRxBufferLength[0] = event.size();
-      std::unique_lock< std::mutex> lock(ant_hci.data_mtx);
-      ALOGD("%s:  notify data avail", __func__);
-      ant_hci.rx_processing = true;
-      ant_hci.data_cond.notify_all();
-      ALOGV("%s: exit", __func__);
-      return Void();
-   }
-};
-
-bool hci_initialize()
-{
-   ALOGI("%s", __func__);
-
-   anthci = IAntHci::getService();
-
-   if(anthci != nullptr)
-   {
-      ant_hci.state = ANT_RADIO_ENABLING;
-      ant_hci.rx_processing = false;
-      android::sp<IAntHciCallbacks> callbacks = new AntHciCallbacks();
-      anthci->initialize(callbacks);
-      ALOGV("%s: exit", __func__);
-      return true;
-   } else {
-      return false;
-   }
-}
-
-void hci_close() {
-   ALOGV("%s", __func__);
-
-   if(anthci != nullptr)
-   {
-      std::unique_lock< std::mutex> lock(ant_hci.data_mtx);
-      ant_hci.data_cond.notify_all();
-      auto hidl_daemon_status = anthci->close();
-      if(!hidl_daemon_status.isOk())
-      {
-         ALOGE("%s: HIDL daemon is dead", __func__);
-      }
-   }
-   ant_hci.state = ANT_RADIO_DISABLED;
-   ant_rx_clear();
-   anthci =nullptr;
-   ALOGI("%s: exit", __func__);
-}
-
-ANT_UINT ant_get_status()
-{
-   return ant_hci.state;
-}
-
-ANTStatus ant_tx_write(ANT_U8 *pucTxMessage,ANT_U8 ucMessageLength)
-{
-   AntPacket data;
-   ANT_U8  packet_type;
-   ALOGI("%s: start", __func__);
-   packet_type = *pucTxMessage;
-   ALOGV("%s: proto type  :%d", __func__, packet_type);
-   if (anthci != nullptr)
-   {
-      data.setToExternal(pucTxMessage+1, ucMessageLength-1);
-      if (packet_type == ANT_DATA_TYPE_PACKET)
-      {
-         auto hidl_daemon_status = anthci->sendAntData(data);
-         if (!hidl_daemon_status.isOk())
-         {
-            ALOGE("%s:sendAntData failed,HIDL dead", __func__);
-            return -1;
-         }
-      } else {
-         auto hidl_daemon_status = anthci->sendAntControl(data);
-         if (!hidl_daemon_status.isOk())
-         {
-            ALOGE("%s:sendAntControl failed,HIDL dead", __func__);
-            return -1;
-         }
-      }
-   } else {
-      ALOGE("%s: antHci is NULL", __func__);
-      return -1;
-   }
-   ALOGI("%s: exit", __func__);
-   return ucMessageLength;
-}
-
-ANTStatus ant_rx_check()
-{
-   ALOGV("%s: start", __func__);
-   Lock lock(ant_hci.data_mtx);
-   while (ant_hci.rx_processing == 0)
-   {
-      ant_hci.data_cond.wait_for(lock,std::chrono::milliseconds(POLL_TIMEOUT_MS));
-      if (ant_hci.state != ANT_RADIO_ENABLED)
-      {
-         return ANT_STATUS_NO_VALUE_AVAILABLE;
-      }
-   }
-   ALOGV("%s:  exit rx_processing =%d", __func__,ant_hci.rx_processing);
-   return ANT_STATUS_SUCCESS;
-}
-
-void ant_rx_clear()
-{
-   ALOGI("%s: start", __func__);
-   Lock lk(ant_hci.rx_mtx);
-   ant_hci.rx_processing = false;
-   ant_hci.rx_cond.notify_all();
-   ALOGI("%s: exit", __func__);
-}
-
-void ant_interface_init()
-{
-   ALOGI("%s: start", __func__);
-   bool status;
-   status = hci_initialize();
-   if (status)
-   {
-      ALOGV("%s waiting for iniialization complete hci state: %d ", __func__, ant_hci.state);
-      Lock lk(ant_hci.on_mtx);
-      while(ant_hci.state == ANT_RADIO_ENABLING)
-      {
-         ant_hci.on_cond.wait(lk);
-         ALOGV(LOG_TAG,"%s:after on_cond wait  ",__func__);
-      }
-   } else {
-      ALOGE(LOG_TAG,"%s:Failed ",__func__);
-      ant_hci.state = ANT_RADIO_DISABLED;
-   }
-   ALOGI(LOG_TAG,"%s:exit ",__func__);
-}
diff --git a/src/qcomm-hidl/ant_native_chardev.c b/src/qcomm-hidl/ant_native_chardev.c
deleted file mode 100644
index 072dbb7..0000000
--- a/src/qcomm-hidl/ant_native_chardev.c
+++ /dev/null
@@ -1,918 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ant_native_chardev.c
-*
-*   BRIEF:
-*      This file provides the VFS implementation of ant_native.h
-*      VFS could be Character Device, TTY, etc.
-*
-*
-\******************************************************************************/
-
-#include <errno.h>
-#include <fcntl.h> /* for open() */
-#include <linux/ioctl.h> /* For hard reset */
-#include <pthread.h>
-#include <dlfcn.h> /* needed for runtime dll loading. */
-#include <stdint.h> /* for uint64_t */
-#include <sys/eventfd.h> /* For eventfd() */
-#include <unistd.h> /* for read(), write(), and close() */
-#include <string.h>
-
-#include "ant_types.h"
-#include "ant_native.h"
-#include "ant_version.h"
-
-#include "AntHidlClient.h"
-#include "antradio_power.h"
-#include "ant_rx_chardev.h"
-#include "ant_hci_defines.h"
-#include "ant_log.h"
-#include <cutils/properties.h> /* used by qualcomms additions for logging. */
-
-
-#if ANT_HCI_SIZE_SIZE > 1
-#include "ant_utils.h"  // Put HCI Size value across multiple bytes
-#endif
-
-#define MESG_BROADCAST_DATA_ID               ((ANT_U8)0x4E)
-#define MESG_ACKNOWLEDGED_DATA_ID            ((ANT_U8)0x4F)
-#define MESG_BURST_DATA_ID                   ((ANT_U8)0x50)
-#define MESG_EXT_BROADCAST_DATA_ID           ((ANT_U8)0x5D)
-#define MESG_EXT_ACKNOWLEDGED_DATA_ID        ((ANT_U8)0x5E)
-#define MESG_EXT_BURST_DATA_ID               ((ANT_U8)0x5F)
-#define MESG_ADV_BURST_DATA_ID               ((ANT_U8)0x72)
-
-static ant_rx_thread_info_t stRxThreadInfo;
-static pthread_mutex_t stEnabledStatusLock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t stFlowControlLock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t stFlowControlCond = PTHREAD_COND_INITIALIZER;
-ANTNativeANTStateCb g_fnStateCallback;
-
-static const uint64_t EVENT_FD_PLUS_ONE = 1L;
-
-static void ant_channel_init(ant_channel_info_t *pstChnlInfo, const char *pcCharDevName);
-
-////////////////////////////////////////////////////////////////////
-//  ant_init
-//
-//  Initialises the native environment.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      ANT_STATUS_SUCCESS if intialize completed, else ANT_STATUS_FAILED
-//
-//  Psuedocode:
-/*
-Set variables to defaults
-Initialise each supported path to chip
-Setup eventfd object.
-RESULT = ANT_STATUS_SUCCESS if no problems else ANT_STATUS_FAILED
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_init(void)
-{
-   ANTStatus status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   stRxThreadInfo.stRxThread = 0;
-   stRxThreadInfo.ucRunThread = 0;
-   stRxThreadInfo.ucChipResetting = 0;
-   stRxThreadInfo.pstEnabledStatusLock = &stEnabledStatusLock;
-   g_fnStateCallback = 0;
-
-#ifdef ANT_DEVICE_NAME // Single transport path
-   ant_channel_init(&stRxThreadInfo.astChannels[SINGLE_CHANNEL], ANT_DEVICE_NAME);
-#else // Separate data/command paths
-   ant_channel_init(&stRxThreadInfo.astChannels[COMMAND_CHANNEL], ANT_COMMANDS_DEVICE_NAME);
-   ant_channel_init(&stRxThreadInfo.astChannels[DATA_CHANNEL], ANT_DATA_DEVICE_NAME);
-#endif // Separate data/command paths
-
-   // Make the eventfd. Want it non blocking so that we can easily reset it by reading.
-   stRxThreadInfo.iRxShutdownEventFd = eventfd(0, EFD_NONBLOCK);
-
-   // Check for error case
-   if(stRxThreadInfo.iRxShutdownEventFd == -1)
-   {
-      ANT_ERROR("ANT init failed. Could not create event fd. Reason: %s", strerror(errno));
-   } else {
-      status = ANT_STATUS_SUCCESS;
-   }
-
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_deinit
-//
-//  clean up eventfd object
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      ANT_STATUS_SUCCESS
-//
-//  Psuedocode:
-/*
-RESULT = SUCCESS
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_deinit(void)
-{
-   ANTStatus result_status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   if(close(stRxThreadInfo.iRxShutdownEventFd) < 0)
-   {
-      ANT_ERROR("Could not close eventfd in deinit. Reason: %s", strerror(errno));
-   } else {
-      result_status = ANT_STATUS_SUCCESS;
-   }
-
-   ANT_FUNC_END();
-   return result_status;
-}
-
-
-////////////////////////////////////////////////////////////////////
-//  ant_enable_radio
-//
-//  Powers on the ANT part and initialises the transport to the chip.
-//  Changes occur in part implementing ant_enable() call
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failures:
-//          ANT_STATUS_TRANSPORT_INIT_ERR if could not enable
-//          ANT_STATUS_FAILED if failed to get mutex or init rx thread
-//
-//  Psuedocode:
-/*
-LOCK enable_LOCK
-    State callback: STATE = ENABLING
-    ant enable
-    IF ant_enable success
-        State callback: STATE = ENABLED
-        RESULT = SUCCESS
-    ELSE
-        ant disable
-        State callback: STATE = Current state
-        RESULT = FAILURE
-    ENDIF
-UNLOCK
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_enable_radio(void)
-{
-   int iLockResult;
-   ANTStatus result_status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting stEnabledStatusLock in %s", __FUNCTION__);
-   iLockResult = pthread_mutex_lock(&stEnabledStatusLock);
-   if(iLockResult) {
-      ANT_ERROR("enable failed to get state lock: %s", strerror(iLockResult));
-      goto out;
-   }
-   ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-
-   if (g_fnStateCallback) {
-      g_fnStateCallback(RADIO_STATUS_ENABLING);
-   }
-
-   if (ant_enable() < 0) {
-      ANT_ERROR("ant enable failed: %s", strerror(errno));
-
-      ant_disable();
-
-      if (g_fnStateCallback) {
-         g_fnStateCallback(ant_radio_enabled_status());
-      }
-   } else {
-      if (g_fnStateCallback) {
-         g_fnStateCallback(RADIO_STATUS_ENABLED);
-      }
-
-      result_status = ANT_STATUS_SUCCESS;
-   }
-
-   ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&stEnabledStatusLock);
-   ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-
-out:
-   ANT_FUNC_END();
-   return result_status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_radio_hard_reset
-//
-//  IF SUPPORTED triggers a hard reset of the chip providing ANT functionality.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failures:
-//          ANT_STATUS_NOT_SUPPORTED if the chip can't hard reset
-//          ANT_STATUS_FAILED if failed to get mutex or enable
-//
-//  Psuedocode:
-/*
-IF Hard Reset not supported
-    RESULT = NOT SUPPORTED
-ELSE
-  LOCK enable_LOCK
-  IF Lock failed
-        RESULT = FAILED
-  ELSE
-    Set Flag Rx thread that chip is resetting
-    FOR each path to chip
-        Send Reset IOCTL to path
-    ENDFOR
-    ant disable
-    ant enable
-    IF ant_enable success
-        State callback: STATE = RESET
-        RESULT = SUCCESS
-    ELSE
-        State callback: STATE = DISABLED
-        RESULT = FAILURE
-    ENDIF
-    Clear Flag Rx thread that chip is resetting
-  UNLOCK
-ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_radio_hard_reset(void)
-{
-   ANTStatus result_status = ANT_STATUS_NOT_SUPPORTED;
-   ANT_FUNC_START();
-
-#ifdef ANT_IOCTL_RESET
-   ant_channel_type eChannel;
-   int iLockResult;
-
-   result_status = ANT_STATUS_FAILED;
-
-   ANT_DEBUG_V("getting stEnabledStatusLock in %s", __FUNCTION__);
-   iLockResult = pthread_mutex_lock(&stEnabledStatusLock);
-   if(iLockResult) {
-      ANT_ERROR("enable failed to get state lock: %s", strerror(iLockResult));
-      goto out;
-   }
-   ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-
-   stRxThreadInfo.ucChipResetting = 1;
-   if (g_fnStateCallback)
-      g_fnStateCallback(RADIO_STATUS_RESETTING);
-
-#ifdef ANT_IOCTL_RESET_PARAMETER
-   ioctl(stRxThreadInfo.astChannels[0].iFd, ANT_IOCTL_RESET, ANT_IOCTL_RESET_PARAMETER);
-#else
-   ioctl(stRxThreadInfo.astChannels[0].iFd, ANT_IOCTL_RESET);
-#endif  // ANT_IOCTL_RESET_PARAMETER
-
-   ant_disable();
-
-   if (ant_enable()) { /* failed */
-      if (g_fnStateCallback)
-         g_fnStateCallback(RADIO_STATUS_DISABLED);
-   } else { /* success */
-      if (g_fnStateCallback)
-         g_fnStateCallback(RADIO_STATUS_RESET);
-      result_status = ANT_STATUS_SUCCESS;
-   }
-   stRxThreadInfo.ucChipResetting = 0;
-
-   ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&stEnabledStatusLock);
-   ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-out:
-#endif // ANT_IOCTL_RESET
-
-   ANT_FUNC_END();
-   return result_status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_disable_radio
-//
-//  Powers off the ANT part and closes the transport to the chip.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failures:
-//          ANT_STATUS_FAILED if failed to get mutex
-//
-//  Psuedocode:
-/*
-LOCK enable_LOCK
-    State callback: STATE = DISABLING
-    ant disable
-    State callback: STATE = Current state
-    RESULT = SUCCESS
-UNLOCK
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_disable_radio(void)
-{
-   int iLockResult;
-   ANTStatus ret = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting stEnabledStatusLock in %s", __FUNCTION__);
-   iLockResult = pthread_mutex_lock(&stEnabledStatusLock);
-   if(iLockResult) {
-      ANT_ERROR("disable failed to get state lock: %s", strerror(iLockResult));
-      goto out;
-   }
-   ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-
-   if (g_fnStateCallback) {
-      g_fnStateCallback(RADIO_STATUS_DISABLING);
-   }
-
-   ant_disable();
-
-   if (g_fnStateCallback) {
-      g_fnStateCallback(ant_radio_enabled_status());
-   }
-
-   ret = ANT_STATUS_SUCCESS;
-
-   ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&stEnabledStatusLock);
-   ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-
-out:
-   ANT_FUNC_END();
-   return ret;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_radio_enabled_status
-//
-//  Gets the current chip/transport state; either disabled, disabling,
-//  enabling, enabled, or resetting.  Determines this on the fly by checking
-//  if Rx thread is running and how many of the paths for the ANT chip have
-//  open VFS files.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      The current radio status (ANTRadioEnabledStatus)
-//
-//  Psuedocode:
-/*
-IF Thread Resetting Flag is set
-    RESULT = Resetting
-ELSE
-    COUNT the number of open files
-    IF Thread Run Flag is Not Set
-        IF there are open files OR Rx thread exists
-            RESULT = Disabling
-        ELSE
-            RESULT = Disabled
-        ENDIF
-    ELSE
-        IF All files are open (all paths) AND Rx thread exists
-            RESULT = ENABLED
-        ELSE IF there are open files (Not 0 open files) AND Rx thread exists
-            RESULT = UNKNOWN
-        ELSE (0 open files or Rx thread does not exist [while Thread Run set])
-            RESULT = ENABLING
-        ENDIF
-    ENDIF
-ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTRadioEnabledStatus ant_radio_enabled_status(void)
-{
-   ant_channel_type eChannel;
-   int iOpenFiles = 0;
-   int iOpenThread;
-   ANTRadioEnabledStatus uiRet = RADIO_STATUS_UNKNOWN;
-   ANT_FUNC_START();
-
-   if (stRxThreadInfo.ucChipResetting) {
-      uiRet = RADIO_STATUS_RESETTING;
-      goto out;
-   }
-
-   uiRet = ant_get_status();
-   ANT_ERROR("ANT radio status =%d",uiRet);
-
-out:
-   ANT_DEBUG_D("get radio enabled status returned %d", uiRet);
-
-   ANT_FUNC_END();
-   return uiRet;
-}
-
-////////////////////////////////////////////////////////////////////
-//  set_ant_rx_callback
-//
-//  Sets which function to call when an ANT message is received.
-//
-//  Parameters:
-//      rx_callback_func   the ANTNativeANTEventCb function to be used for
-//                         received messages (from all transport paths).
-//
-//  Returns:
-//          ANT_STATUS_SUCCESS
-//
-//  Psuedocode:
-/*
-FOR each transport path
-    Path Rx Callback = rx_callback_func
-ENDFOR
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus set_ant_rx_callback(ANTNativeANTEventCb rx_callback_func)
-{
-   ANTStatus status = ANT_STATUS_SUCCESS;
-   ANT_FUNC_START();
-
-#ifdef ANT_DEVICE_NAME // Single transport path
-   stRxThreadInfo.astChannels[SINGLE_CHANNEL].fnRxCallback = rx_callback_func;
-#else // Separate data/command paths
-   stRxThreadInfo.astChannels[COMMAND_CHANNEL].fnRxCallback = rx_callback_func;
-   stRxThreadInfo.astChannels[DATA_CHANNEL].fnRxCallback = rx_callback_func;
-#endif // Separate data/command paths
-
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  set_ant_state_callback
-//
-//  Sets which function to call when an ANT state change occurs.
-//
-//  Parameters:
-//      state_callback_func   the ANTNativeANTStateCb function to be used
-//                            for received state changes.
-//
-//  Returns:
-//          ANT_STATUS_SUCCESS
-//
-//  Psuedocode:
-/*
-    State Callback = state_callback_func
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus set_ant_state_callback(ANTNativeANTStateCb state_callback_func)
-{
-   ANTStatus status = ANT_STATUS_SUCCESS;
-   ANT_FUNC_START();
-
-   g_fnStateCallback = state_callback_func;
-
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_tx_message_flowcontrol_wait
-//
-//  Sends an ANT message to the chip and waits for a CTS signal
-//
-//  Parameters:
-//      eTxPath          device to transmit message on
-//      eFlowMessagePath device that receives CTS
-//      ucMessageLength  the length of the message
-//      pucMesg          pointer to the message data
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failure:
-//          ANT_STATUS_NOT_ENABLED
-//
-//  Psuedocode:
-/*
-        LOCK flow control
-        IF Lock failed
-            RESULT = FAILED
-        ELSE
-            SET flowMessagePath Flow Control response as FLOW_STOP
-            WRITE txBuffer to txPath (only length of packet part)
-            IF Wrote less then 0 bytes
-                Log error
-                RESULT = FAILED
-            ELSE IF Didn't write 'length of packet' bytes
-                Log error
-                RESULT = FAILED
-            ELSE
-                IF flowMessagePath Flow Control response is not FLOW_GO
-                    WAIT until flowMessagePath Flow Control response is FLOW_GO, UNTIL FLOW_GO Wait Timeout seconds (10) from Now
-                    IF error Waiting
-                        IF error is Timeout
-                            RESULT = HARDWARE ERROR
-                        ELSE
-                            RESULT = FAILED
-                        ENDIF
-                    ELSE
-                        RESULT = SUCCESS
-                    ENDIF
-                ELSE
-                    RESULT = SUCCESS;
-                ENDIF
-            ENDIF
-            UNLOCK flow control
-        ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_tx_message_flowcontrol_wait(ant_channel_type eTxPath, ant_channel_type eFlowMessagePath, ANT_U8 ucMessageLength, ANT_U8 *pucTxMessage)
-{
-   int iMutexResult;
-   int iResult;
-   struct timespec stTimeout;
-   int iCondWaitResult;
-   ANTStatus status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting stFlowControlLock in %s", __FUNCTION__);
-   iMutexResult = pthread_mutex_lock(&stFlowControlLock);
-   if (iMutexResult) {
-      ANT_ERROR("failed to lock flow control mutex during tx: %s", strerror(iMutexResult));
-      goto out;
-   }
-   ANT_DEBUG_V("got stFlowControlLock in %s", __FUNCTION__);
-
-   stRxThreadInfo.astChannels[eFlowMessagePath].ucFlowControlResp = ANT_FLOW_STOP;
-
-#ifdef ANT_FLOW_RESEND
-   // Store Tx message so can resend it from Rx thread
-   stRxThreadInfo.astChannels[eFlowMessagePath].ucResendMessageLength = ucMessageLength;
-   stRxThreadInfo.astChannels[eFlowMessagePath].pucResendMessage = pucTxMessage;
-#endif // ANT_FLOW_RESEND
-
-   iResult = ant_tx_write(pucTxMessage,ucMessageLength);
-   if (iResult < 0) {
-      ANT_ERROR("failed to write data message to device: %s", strerror(errno));
-   } else if (iResult != ucMessageLength) {
-      ANT_ERROR("bytes written and message size don't match up");
-   } else {
-      stTimeout.tv_sec = time(0) + ANT_FLOW_GO_WAIT_TIMEOUT_SEC;
-      stTimeout.tv_nsec = 0;
-
-      while (stRxThreadInfo.astChannels[eFlowMessagePath].ucFlowControlResp != ANT_FLOW_GO) {
-         iCondWaitResult = pthread_cond_timedwait(&stFlowControlCond, &stFlowControlLock, &stTimeout);
-         if (iCondWaitResult) {
-            ANT_ERROR("failed to wait for flow control response: %s", strerror(iCondWaitResult));
-
-            if (iCondWaitResult == ETIMEDOUT) {
-               status = ANT_STATUS_HARDWARE_ERR;
-
-#ifdef ANT_FLOW_RESEND
-               // Clear Tx message so will stop resending it from Rx thread
-               stRxThreadInfo.astChannels[eFlowMessagePath].ucResendMessageLength = 0;
-               stRxThreadInfo.astChannels[eFlowMessagePath].pucResendMessage = NULL;
-#endif // ANT_FLOW_RESEND
-            }
-            goto wait_error;
-         }
-      }
-
-      status = ANT_STATUS_SUCCESS;
-   }
-
-wait_error:
-   ANT_DEBUG_V("releasing stFlowControlLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&stFlowControlLock);
-   ANT_DEBUG_V("released stFlowControlLock in %s", __FUNCTION__);
-
-out:
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_tx_message_flowcontrol_none
-//
-//  Sends an ANT message to the chip without waiting for flow control
-//
-//  Parameters:
-//      eTxPath         device to transmit on
-//      ucMessageLength the length of the message
-//      pucMesg         pointer to the message data
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failure:
-//          ANT_STATUS_NOT_ENABLED
-//
-//  Psuedocode:
-/*
-        WRITE txBuffer to Tx Path (only length of packet part)
-        IF Wrote less then 0 bytes
-            Log error
-            RESULT = FAILED
-        ELSE IF Didn't write 'length of packet' bytes
-            Log error
-            RESULT = FAILED
-        ELSE
-            RESULT = SUCCESS
-        ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_tx_message_flowcontrol_none(ant_channel_type eTxPath, ANT_U8 ucMessageLength, ANT_U8 *pucTxMessage)
-{
-   int iResult;
-   ANTStatus status = ANT_STATUS_FAILED;\
-   ANT_FUNC_START();
-
-   iResult = ant_tx_write(pucTxMessage, ucMessageLength);
-   if (iResult < 0) {
-      ANT_ERROR("failed to write message to device: %s", strerror(errno));
-   }  else if (iResult != ucMessageLength) {
-      ANT_ERROR("bytes written and message size don't match up");
-   } else {
-      status = ANT_STATUS_SUCCESS;
-   }
-
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_tx_message
-//
-//  Frames ANT data and decides which flow control method to use for sending the
-//  ANT message to the chip
-//
-//  Parameters:
-//      ucLen   the length of the message
-//      pucMesg pointer to the message data
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failure:
-//          ANT_STATUS_NOT_ENABLED
-//
-//  Psuedocode:
-/*
-IF not enabled
-    RESULT = BT NOT INITIALIZED
-ELSE
-    Create txBuffer, MAX HCI Message Size large
-    PUT ucLen in txBuffer AT ANT HCI Size Offset (0)
-    COPY pucMesg to txBuffer AT ANT HCI Header Size (1)     <- ? Not at offset?
-    LOG txBuffer as a serial Tx (only length of packet part)
-    IF is a data message
-        Tx message on Data Path with FLOW_GO/FLOW_STOP flow control (ant_tx_message_flowcontrol_go_stop())
-    ELSE
-        Tx message on Command Path with no flow control (ant_tx_message_flowcontrol_none())
-    ENDIF
-ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_tx_message(ANT_U8 ucLen, ANT_U8 *pucMesg)
-{
-   // During a tx we must prepend a packet type byte. Thus HCI_PACKET_TYPE_SIZE is added
-   // to all offsets when writing into the tx buffer.
-   ANTStatus status = ANT_STATUS_FAILED;
-   // TODO ANT_HCI_MAX_MSG_SIZE is transport (driver) dependent.
-   ANT_U8 txBuffer[HCI_PACKET_TYPE_SIZE + ANT_HCI_MAX_MSG_SIZE];
-   // TODO Message length can be greater than ANT_U8 can hold.
-   // Not changed as ANT_SERIAL takes length as ANT_U8.
-   ANT_U8 txMessageLength = HCI_PACKET_TYPE_SIZE + ucLen + ANT_HCI_HEADER_SIZE;
-   ANT_FUNC_START();
-
-   if (ant_radio_enabled_status() != RADIO_STATUS_ENABLED) {
-      status = ANT_STATUS_FAILED_BT_NOT_INITIALIZED;
-      goto out;
-   }
-
-#if ANT_HCI_OPCODE_SIZE == 1
-   txBuffer[HCI_PACKET_TYPE_SIZE + ANT_HCI_OPCODE_OFFSET] = ANT_HCI_OPCODE_TX;
-#elif ANT_HCI_OPCODE_SIZE > 1
-#error "Specified ANT_HCI_OPCODE_SIZE not currently supported"
-#endif
-
-#if ANT_HCI_SIZE_SIZE == 1
-   txBuffer[HCI_PACKET_TYPE_SIZE + ANT_HCI_SIZE_OFFSET] = ucLen;
-#elif ANT_HCI_SIZE_SIZE == 2
-   ANT_UTILS_StoreLE16(txBuffer + HCI_PACKET_TYPE_SIZE + ANT_HCI_SIZE_OFFSET, (ANT_U16)ucLen);
-#else
-#error "Specified ANT_HCI_SIZE_SIZE not currently supported"
-#endif
-
-   memcpy(txBuffer + HCI_PACKET_TYPE_SIZE + ANT_HCI_HEADER_SIZE, pucMesg, ucLen);
-
-// We no longer do the serial logging here because the packet type byte is not yet written.
-//ANT_SERIAL(txBuffer, txMessageLength, 'T');
-
-// We only do this if we are using single physical and logical channels.
-#if defined(ANT_DEVICE_NAME) && (HCI_PACKET_TYPE_SIZE == 0) // Single transport path
-   ANT_SERIAL(txBuffer, txMessageLength, 'T');
-   status = ant_tx_message_flowcontrol_wait(SINGLE_CHANNEL, SINGLE_CHANNEL, txMessageLength, txBuffer);
-#else // Separate data/command paths
-   // Each path follows this structure:
-   // write the packet type if needed.
-   // log the packet
-   // Send using the appropriate physical channel, waiting for flow control for data commands.
-   switch (txBuffer[HCI_PACKET_TYPE_SIZE + ANT_HCI_DATA_OFFSET + ANT_MSG_ID_OFFSET]) {
-   case MESG_BROADCAST_DATA_ID:
-   case MESG_ACKNOWLEDGED_DATA_ID:
-   case MESG_BURST_DATA_ID:
-   case MESG_EXT_BROADCAST_DATA_ID:
-   case MESG_EXT_ACKNOWLEDGED_DATA_ID:
-   case MESG_EXT_BURST_DATA_ID:
-   case MESG_ADV_BURST_DATA_ID:
-      ANT_DEBUG_V("Data Path");
-      #if HCI_PACKET_TYPE_SIZE == 1
-      txBuffer[0] = ANT_DATA_TYPE_PACKET;
-      #elif HCI_PACKET_TYPE_SIZE > 1
-      #error "Specified HCI_PACKET_TYPE_SIZE not supported"
-      #endif
-      ANT_SERIAL(txBuffer, txMessageLength, 'T');
-      #ifdef ANT_DEVICE_NAME
-      status = ant_tx_message_flowcontrol_wait(SINGLE_CHANNEL, SINGLE_CHANNEL, txMessageLength, txBuffer);
-      #else
-      status = ant_tx_message_flowcontrol_wait(DATA_CHANNEL, COMMAND_CHANNEL, txMessageLength, txBuffer);
-      #endif
-      break;
-   default:
-      ANT_DEBUG_V("Control Path");
-      #if HCI_PACKET_TYPE_SIZE == 1
-      txBuffer[0] = ANT_CMD_TYPE_PACKET;
-      #elif HCI_PACKET_TYPE_SIZE > 1
-      #error "Specified HCI_PACKET_TYPE_SIZE not supported"
-      #endif
-      ANT_SERIAL(txBuffer, txMessageLength, 'T');
-      #ifdef ANT_DEVICE_NAME
-      status = ant_tx_message_flowcontrol_none(SINGLE_CHANNEL, txMessageLength, txBuffer);
-      #else
-      status = ant_tx_message_flowcontrol_none(COMMAND_CHANNEL, txMessageLength, txBuffer);
-      #endif
-   }
-#endif // Separate data/command paths
-
-out:
-   ANT_FUNC_END();
-   return status;
-}
-
-//----------------- TODO Move these somewhere for multi transport path / dedicated channel support:
-
-static void ant_channel_init(ant_channel_info_t *pstChnlInfo, const char *pcCharDevName)
-{
-   ANT_FUNC_START();
-
-   // TODO Don't need to store, only accessed when trying to open:
-   // Is however useful for logs.
-   pstChnlInfo->pcDevicePath = pcCharDevName;
-
-   // This is the only piece of info that needs to be stored per channel
-   pstChnlInfo->iFd = -1;
-
-   // TODO Only 1 of these (not per-channel) is actually ever used:
-   pstChnlInfo->fnRxCallback = NULL;
-   pstChnlInfo->ucFlowControlResp = ANT_FLOW_GO;
-#ifdef ANT_FLOW_RESEND
-   pstChnlInfo->ucResendMessageLength = 0;
-   pstChnlInfo->pucResendMessage = NULL;
-#endif // ANT_FLOW_RESEND
-   // TODO Only used when Flow Control message received, so must only be Command path Rx thread
-   pstChnlInfo->pstFlowControlCond = &stFlowControlCond;
-   pstChnlInfo->pstFlowControlLock = &stFlowControlLock;
-
-   ANT_FUNC_END();
-}
-
-static void ant_disable_channel(ant_channel_info_t *pstChnlInfo)
-{
-   ANT_FUNC_START();
-   if (!pstChnlInfo) {
-      ANT_ERROR("null channel info passed to channel disable function");
-      goto out;
-   }
-
-   hci_close();
-
-out:
-   ANT_FUNC_END();
-}
-
-static int ant_enable_channel(ant_channel_info_t *pstChnlInfo)
-{
-   int iRet = -1;
-   ANT_FUNC_START();
-   if (!pstChnlInfo) {
-      ANT_ERROR("null channel info passed to channel enable function");
-      errno = EINVAL;
-      goto out;
-   }
-   ANT_DEBUG_V("call HIDL init");
-   ant_interface_init();
-   iRet = 0;
-out:
-   ANT_FUNC_END();
-   return iRet;
-}
-
-//----------------------------------------------------------------------- This is antradio_power.h:
-
-int ant_enable(void)
-{
-   int iRet = -1;
-   ant_channel_type eChannel;
-   ANT_FUNC_START();
-
-   stRxThreadInfo.ucRunThread = 1;
-
-   for (eChannel = 0; eChannel < NUM_ANT_CHANNELS; eChannel++) {
-      if (ant_enable_channel(&stRxThreadInfo.astChannels[eChannel]) < 0) {
-         ANT_ERROR("failed to enable channel %s: %s",
-                         stRxThreadInfo.astChannels[eChannel].pcDevicePath,
-                         strerror(errno));
-         goto out;
-      }
-   }
-
-   if (stRxThreadInfo.stRxThread == 0) {
-      if (pthread_create(&stRxThreadInfo.stRxThread, NULL, fnRxThread, &stRxThreadInfo) < 0) {
-         ANT_ERROR("failed to start rx thread: %s", strerror(errno));
-         goto out;
-      }
-   } else {
-      ANT_DEBUG_D("rx thread is already running");
-   }
-
-   if (!stRxThreadInfo.ucRunThread) {
-      ANT_ERROR("rx thread crashed during init");
-      goto out;
-   }
-
-   iRet = 0;
-
-out:
-   ANT_FUNC_END();
-   return iRet;
-}
-
-int ant_disable(void)
-{
-   int iRet = -1;
-   ant_channel_type eChannel;
-   ANT_FUNC_START();
-
-   stRxThreadInfo.ucRunThread = 0;
-
-   for (eChannel = 0; eChannel < NUM_ANT_CHANNELS; eChannel++) {
-      ant_disable_channel(&stRxThreadInfo.astChannels[eChannel]);
-   }
-
-   iRet = 0;
-
-out:
-   stRxThreadInfo.stRxThread = 0;
-   ANT_FUNC_END();
-   return iRet;
-}
-
-//---------------------------------------------------------
-
-const char *ant_get_lib_version()
-{
-   return "libantradio.so: "ANT_CHIP_NAME". Version "
-      LIBANT_STACK_MAJOR"."LIBANT_STACK_MINOR"."LIBANT_STACK_INCRE;
-}
diff --git a/src/qcomm-hidl/ant_rx_chardev.c b/src/qcomm-hidl/ant_rx_chardev.c
deleted file mode 100644
index 3e102d2..0000000
--- a/src/qcomm-hidl/ant_rx_chardev.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ant_rx_chardev.c
-*
-*   BRIEF:
-*      This file implements the receive thread function which will loop reading
-*      ANT messages until told to exit.
-*
-*
-\******************************************************************************/
-
-#include <errno.h>
-#include <poll.h>
-#include <pthread.h>
-#include <stdint.h> /* for uint64_t */
-#include <string.h>
-
-#include "ant_types.h"
-#include "antradio_power.h"
-#include "ant_rx_chardev.h"
-#include "ant_hci_defines.h"
-#include "ant_log.h"
-#include "ant_native.h"  // ANT_HCI_MAX_MSG_SIZE, ANT_MSG_ID_OFFSET, ANT_MSG_DATA_OFFSET,
-                         // ant_radio_enabled_status()
-
-#include "AntHidlClient.h"
-extern ANTStatus ant_tx_message_flowcontrol_none(ant_channel_type eTxPath, ANT_U8 ucMessageLength, ANT_U8 *pucTxMessage);
-
-#undef LOG_TAG
-#define LOG_TAG "antradio_rx"
-
-#define ANT_POLL_TIMEOUT         ((int)30000)
-#define KEEPALIVE_TIMEOUT        ((int)5000)
-
-ANT_U8 aucRxBuffer[NUM_ANT_CHANNELS][ANT_HCI_MAX_MSG_SIZE];
-
-#ifdef ANT_DEVICE_NAME // Single transport path
-   int iRxBufferLength[NUM_ANT_CHANNELS] = {0};
-#else
-   int iRxBufferLength[NUM_ANT_CHANNELS] = {0, 0};
-#endif //
-
-// Plus one is for the eventfd shutdown signal.
-#define NUM_POLL_FDS (NUM_ANT_CHANNELS + 1)
-#define EVENTFD_IDX NUM_ANT_CHANNELS
-
-static ANT_U8 KEEPALIVE_MESG[] = {0x01, 0x00, 0x00};
-static ANT_U8 KEEPALIVE_RESP[] = {0x03, 0x40, 0x00, 0x00, 0x28};
-
-void doReset(ant_rx_thread_info_t *stRxThreadInfo);
-int readChannelMsg(ant_channel_type eChannel, ant_channel_info_t *pstChnlInfo);
-
-
-/*
- * This thread is run occasionally as a detached thread in order to send a keepalive message to the
- * chip.
- */
-void *fnKeepAliveThread(void *unused)
-{
-   ANT_DEBUG_V("Sending dummy keepalive message.");
-   ant_tx_message(sizeof(KEEPALIVE_MESG)/sizeof(ANT_U8), KEEPALIVE_MESG);
-   return NULL;
-}
-
-/*
- * This thread waits for ANT messages from a VFS file.
- */
-void *fnRxThread(void *ant_rx_thread_info)
-{
-   int iMutexLockResult;
-   int iPollRet;
-   ant_rx_thread_info_t *stRxThreadInfo;
-   struct pollfd astPollFd[NUM_POLL_FDS];
-   ANT_FUNC_START();
-
-   stRxThreadInfo = (ant_rx_thread_info_t *)ant_rx_thread_info;
-   // Fill out poll request for the shutdown signaller.
-   astPollFd[EVENTFD_IDX].fd = stRxThreadInfo->iRxShutdownEventFd;
-   astPollFd[EVENTFD_IDX].events = POLL_IN;
-
-   // Reset the waiting for response, since we don't want a stale value if we were reset.
-   stRxThreadInfo->bWaitingForKeepaliveResponse = ANT_FALSE;
-
-   /* continue running as long as not terminated */
-   while (stRxThreadInfo->ucRunThread) {
-      iPollRet = ant_rx_check();
-      if(iPollRet == 0)
-      {
-         readChannelMsg(0, &stRxThreadInfo->astChannels[0]);
-      }
-      else
-      {
-         ANT_WARN("rx check failed , cleaning up");
-         break;
-      }
-      // Need to indicate that we are done handling the rx buffer and it can be
-      // overwritten again.
-      ant_rx_clear();
-   }
-
-   /* disable ANT radio if not already disabling */
-   // Try to get stEnabledStatusLock.
-   // if you get it then no one is enabling or disabling
-   // if you can't get it assume something made you exit
-   ANT_DEBUG_V("try getting stEnabledStatusLock in %s", __FUNCTION__);
-   iMutexLockResult = pthread_mutex_trylock(stRxThreadInfo->pstEnabledStatusLock);
-   if (!iMutexLockResult) {
-      ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-      ANT_WARN("rx thread has unexpectedly crashed, cleaning up");
-
-      // spoof our handle as closed so we don't try to join ourselves in disable
-      stRxThreadInfo->stRxThread = 0;
-
-      if (g_fnStateCallback) {
-         g_fnStateCallback(RADIO_STATUS_DISABLING);
-      }
-
-      ant_disable();
-
-      if (g_fnStateCallback) {
-         g_fnStateCallback(ant_radio_enabled_status());
-      }
-
-      ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-      pthread_mutex_unlock(stRxThreadInfo->pstEnabledStatusLock);
-      ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-   } else if (iMutexLockResult != EBUSY) {
-      ANT_ERROR("rx thread closing code, trylock on state lock failed: %s",
-            strerror(iMutexLockResult));
-   } else {
-      ANT_DEBUG_V("stEnabledStatusLock busy");
-   }
-
-   out:
-   ANT_FUNC_END();
-#ifdef ANDROID
-   return NULL;
-#endif
-}
-
-void doReset(ant_rx_thread_info_t *stRxThreadInfo)
-{
-   int iMutexLockResult;
-
-   ANT_FUNC_START();
-   /* Chip was reset or other error, only way to recover is to
-    * close and open ANT chardev */
-   stRxThreadInfo->ucChipResetting = 1;
-
-   if (g_fnStateCallback) {
-      g_fnStateCallback(RADIO_STATUS_RESETTING);
-   }
-
-   stRxThreadInfo->ucRunThread = 0;
-
-   ANT_DEBUG_V("getting stEnabledStatusLock in %s", __FUNCTION__);
-   iMutexLockResult = pthread_mutex_lock(stRxThreadInfo->pstEnabledStatusLock);
-   if (iMutexLockResult < 0) {
-      ANT_ERROR("chip was reset, getting state mutex failed: %s",
-            strerror(iMutexLockResult));
-      stRxThreadInfo->stRxThread = 0;
-      stRxThreadInfo->ucChipResetting = 0;
-   } else {
-      ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-
-      stRxThreadInfo->stRxThread = 0; /* spoof our handle as closed so we don't
-                                       * try to join ourselves in disable */
-
-      ant_disable();
-
-      int enableResult = ant_enable();
-
-      stRxThreadInfo->ucChipResetting = 0;
-      if (enableResult) { /* failed */
-         if (g_fnStateCallback) {
-            g_fnStateCallback(RADIO_STATUS_DISABLED);
-         }
-      } else { /* success */
-         if (g_fnStateCallback) {
-            g_fnStateCallback(RADIO_STATUS_RESET);
-         }
-      }
-
-      ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-      pthread_mutex_unlock(stRxThreadInfo->pstEnabledStatusLock);
-      ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-   }
-
-   ANT_FUNC_END();
-}
-
-////////////////////////////////////////////////////////////////////
-//  setFlowControl
-//
-//  Sets the flow control "flag" to the value provided and signals the transmit
-//  thread to check the value.
-//
-//  Parameters:
-//      pstChnlInfo   the details of the channel being updated
-//      ucFlowSetting the value to use
-//
-//  Returns:
-//      Success:
-//          0
-//      Failure:
-//          -1
-////////////////////////////////////////////////////////////////////
-int setFlowControl(ant_channel_info_t *pstChnlInfo, ANT_U8 ucFlowSetting)
-{
-   int iRet = -1;
-   int iMutexResult;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting stFlowControlLock in %s", __FUNCTION__);
-   iMutexResult = pthread_mutex_lock(pstChnlInfo->pstFlowControlLock);
-   if (iMutexResult) {
-      ANT_ERROR("failed to lock flow control mutex during response: %s", strerror(iMutexResult));
-   } else {
-      ANT_DEBUG_V("got stFlowControlLock in %s", __FUNCTION__);
-
-      pstChnlInfo->ucFlowControlResp = ucFlowSetting;
-
-      ANT_DEBUG_V("releasing stFlowControlLock in %s", __FUNCTION__);
-      pthread_mutex_unlock(pstChnlInfo->pstFlowControlLock);
-      ANT_DEBUG_V("released stFlowControlLock in %s", __FUNCTION__);
-
-      pthread_cond_signal(pstChnlInfo->pstFlowControlCond);
-
-      iRet = 0;
-   }
-
-   ANT_FUNC_END();
-   return iRet;
-}
-
-int readChannelMsg(ant_channel_type eChannel, ant_channel_info_t *pstChnlInfo)
-{
-   int iRet = -1;
-   int iRxLenRead = 0;
-   int iCurrentHciPacketOffset;
-   int iHciDataSize;
-   ANT_FUNC_START();
-
-   // Keep trying to read while there is an error, and that error is EAGAIN
-   {
-      iRxLenRead += iRxBufferLength[eChannel];   // add existing data on
-      ANT_DEBUG_D("iRxLenRead %d",iRxLenRead);
-      ANT_SERIAL(aucRxBuffer[eChannel], iRxLenRead, 'R');
-
-      // if we didn't get a full packet, then just exit
-      if (iRxLenRead < (aucRxBuffer[eChannel][ANT_HCI_SIZE_OFFSET] + ANT_HCI_HEADER_SIZE + ANT_HCI_FOOTER_SIZE)) {
-         iRxBufferLength[eChannel] = iRxLenRead;
-         iRet = 0;
-         goto out;
-      }
-
-      iRxBufferLength[eChannel] = 0;    // reset buffer length here since we should have a full packet
-
-#if ANT_HCI_OPCODE_SIZE == 1  // Check the different message types by opcode
-      ANT_U8 opcode = aucRxBuffer[eChannel][ANT_HCI_OPCODE_OFFSET];
-
-      if(ANT_HCI_OPCODE_COMMAND_COMPLETE == opcode) {
-         // Command Complete, so signal a FLOW_GO
-         if(setFlowControl(pstChnlInfo, ANT_FLOW_GO)) {
-            goto out;
-         }
-      } else if(ANT_HCI_OPCODE_FLOW_ON == opcode) {
-         // FLow On, so resend the last Tx
-#ifdef ANT_FLOW_RESEND
-         // Check if there is a message to resend
-         if(pstChnlInfo->ucResendMessageLength > 0) {
-            ant_tx_message_flowcontrol_none(eChannel, pstChnlInfo->ucResendMessageLength, pstChnlInfo->pucResendMessage);
-         } else {
-            ANT_DEBUG_D("Resend requested by chip, but tx request cancelled");
-         }
-#endif // ANT_FLOW_RESEND
-      } else if(ANT_HCI_OPCODE_ANT_EVENT == opcode)
-         // ANT Event, send ANT packet to Rx Callback
-#endif // ANT_HCI_OPCODE_SIZE == 1
-      {
-      // Received an ANT packet
-         iCurrentHciPacketOffset = 0;
-
-         while(iCurrentHciPacketOffset < iRxLenRead) {
-            ANT_DEBUG_D("iRxLenRead = %d",iRxLenRead);
-
-            // TODO Allow HCI Packet Size value to be larger than 1 byte
-            // This currently works as no size value is greater than 255, and little endian
-            iHciDataSize = aucRxBuffer[eChannel][iCurrentHciPacketOffset + ANT_HCI_SIZE_OFFSET];
-
-            if ((iHciDataSize + ANT_HCI_HEADER_SIZE + ANT_HCI_FOOTER_SIZE + iCurrentHciPacketOffset) >
-                  iRxLenRead) {
-               // we don't have a whole packet
-               iRxBufferLength[eChannel] = iRxLenRead - iCurrentHciPacketOffset;
-               memcpy(aucRxBuffer[eChannel], &aucRxBuffer[eChannel][iCurrentHciPacketOffset], iRxBufferLength[eChannel]);
-               // the increment at the end should push us out of the while loop
-            } else
-#ifdef ANT_MESG_FLOW_CONTROL
-            if (aucRxBuffer[eChannel][iCurrentHciPacketOffset + ANT_HCI_DATA_OFFSET + ANT_MSG_ID_OFFSET] ==
-                  ANT_MESG_FLOW_CONTROL) {
-               // This is a flow control packet, not a standard ANT message
-               if(setFlowControl(pstChnlInfo, \
-                     aucRxBuffer[eChannel][iCurrentHciPacketOffset + ANT_HCI_DATA_OFFSET + ANT_MSG_DATA_OFFSET])) {
-                  goto out;
-               }
-            } else
-#endif // ANT_MESG_FLOW_CONTROL
-            {
-               ANT_U8 *msg = aucRxBuffer[eChannel] + iCurrentHciPacketOffset + ANT_HCI_DATA_OFFSET;
-               ANT_BOOL bIsKeepAliveResponse = memcmp(msg, KEEPALIVE_RESP, sizeof(KEEPALIVE_RESP)/sizeof(ANT_U8)) == 0;
-               if (bIsKeepAliveResponse) {
-                  ANT_DEBUG_V("Filtered out keepalive response.");
-               } else if (pstChnlInfo->fnRxCallback != NULL) {
-                  ANT_DEBUG_V("call rx callback hci data size = %d",iHciDataSize);
-
-                  // Loop through read data until all HCI packets are written to callback
-                     pstChnlInfo->fnRxCallback(iHciDataSize, \
-                           msg);
-               } else {
-                  ANT_WARN("%s rx callback is null", pstChnlInfo->pcDevicePath);
-               }
-            }
-
-            iCurrentHciPacketOffset = iCurrentHciPacketOffset + ANT_HCI_HEADER_SIZE + ANT_HCI_FOOTER_SIZE + iHciDataSize;
-         }
-      }
-
-      iRet = 0;
-   }
-
-out:
-   ANT_FUNC_END();
-   return iRet;
-}
diff --git a/src/qcomm-hidl/inc/AntHidlClient.h b/src/qcomm-hidl/inc/AntHidlClient.h
deleted file mode 100644
index cbb81d8..0000000
--- a/src/qcomm-hidl/inc/AntHidlClient.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- *
- *Redistribution and use in source and binary forms, with or without
- *modification, are permitted provided that the following conditions are
- *met:
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer in the documentation and/or other materials provided
- *      with the distribution.
- *    * Neither the name of The Linux Foundation nor the names of its
- *      contributors may be used to endorse or promote products derived
- *      from this software without specific prior written permission.
- *
- *
- *THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- *WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- *ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- *BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- *WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- *OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- *IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#include "ant_driver_defines.h"
-#include "ant_rx_chardev.h"
-
-extern ANT_U8 aucRxBuffer[NUM_ANT_CHANNELS][ANT_HCI_MAX_MSG_SIZE];
-
-extern int iRxBufferLength[NUM_ANT_CHANNELS];
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-   void ant_interface_init();
-   void hci_close();
-
-   ANTStatus ant_tx_write(ANT_U8 *pucTxMessage,ANT_U8 ucMessageLength);
-   ANTStatus ant_rx_check();
-   void ant_rx_clear();
-
-   ANT_UINT ant_get_status();
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/src/qcomm-hidl/inc/ant_hci_defines.h b/src/qcomm-hidl/inc/ant_hci_defines.h
deleted file mode 100644
index 3ffe672..0000000
--- a/src/qcomm-hidl/inc/ant_hci_defines.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2013 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*******************************************************************************\
-*
-*   FILE NAME:    ant_hci_defines.h
-*
-*   BRIEF:
-*      This file defines ANT specific HCI values used by the ANT chip that are
-*      not specific to the underlying chip. These should not need to be modified,
-*      but should be verified they are correct.
-*
-\*******************************************************************************/
-
-#ifndef __VFS_INDEPENDENT_H
-#define __VFS_INDEPENDENT_H
-
-// ANT HCI Packet Structure
-// -----------------------------------------
-// |         Header       | Data |  Footer  |
-// |----------------------|-----------------|
-// |Optional| Data | Opt. | ...  | Optional |
-// | Opcode | Size | Sync |      | Checksum |
-// Data may include any number of ANT packets, with no sync byte or checksum.
-// A read from the driver may return any number of ANT HCI packets.
-
-#include "ant_driver_defines.h"
-
-#define ANT_HCI_HEADER_SIZE                  ((ANT_HCI_OPCODE_SIZE) + (ANT_HCI_SIZE_SIZE) + (ANT_HCI_SYNC_SIZE))
-#define ANT_HCI_FOOTER_SIZE                  (ANT_HCI_CHECKSUM_SIZE)
-
-#define ANT_HCI_OPCODE_OFFSET                0
-#define ANT_HCI_SIZE_OFFSET                  ((ANT_HCI_OPCODE_OFFSET) + (ANT_HCI_OPCODE_SIZE))
-#define ANT_HCI_SYNC_OFFSET                  ((ANT_HCI_SIZE_OFFSET) + (ANT_HCI_SIZE_SIZE))
-#define ANT_HCI_DATA_OFFSET                  (ANT_HCI_HEADER_SIZE)
-
-#define ANT_FLOW_GO_WAIT_TIMEOUT_SEC         10
-
-#endif /* ifndef __VFS_INDEPENDENT_H */
diff --git a/src/qcomm-hidl/inc/ant_rx_chardev.h b/src/qcomm-hidl/inc/ant_rx_chardev.h
deleted file mode 100644
index 12ba629..0000000
--- a/src/qcomm-hidl/inc/ant_rx_chardev.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*******************************************************************************\
-*
-*   FILE NAME:      ant_rx_chardev.h
-*
-*   BRIEF:
-*      This file defines the receive thread function, the ant_rx_thread_info_t
-*      type for storing the -configuration- <state> of the receive thread, the
-*      ant_channel_info_t type for storing a channel's (transport path)
-*      configuration, and an enumeration of all ANT channels (transport paths).
-*
-*
-\*******************************************************************************/
-
-#ifndef __ANT_RX_NATIVE_H
-#define __ANT_RX_NATIVE_H
-
-#include "ant_native.h"
-#include "ant_hci_defines.h"
-
-/* same as HCI_MAX_EVENT_SIZE from hci.h, but hci.h is not included for vfs */
-#define ANT_HCI_MAX_MSG_SIZE 260
-
-#define ANT_MSG_SIZE_OFFSET     ((ANT_U8)0)
-#define ANT_MSG_ID_OFFSET       ((ANT_U8)1)
-#define ANT_MSG_DATA_OFFSET     ((ANT_U8)2)
-
-/* This struct defines the info passed to an rx thread */
-typedef struct {
-   /* Device path */
-   const char *pcDevicePath;
-   /* File descriptor to read from */
-   int iFd;
-   /* Callback to call with ANT packet */
-   ANTNativeANTEventCb fnRxCallback;
-   /* Flow control response if channel supports it */
-   ANT_U8 ucFlowControlResp;
-   /* Handle to flow control condition */
-   pthread_cond_t *pstFlowControlCond;
-   /* Handle to flow control mutex */
-   pthread_mutex_t *pstFlowControlLock;
-#ifdef ANT_FLOW_RESEND
-   /* Length of message to resend on request from chip */
-   ANT_U8 ucResendMessageLength;
-   /* The message to resend on request from chip */
-   ANT_U8 *pucResendMessage;
-#endif // ANT_FLOW_RESEND
-} ant_channel_info_t;
-
-typedef enum {
-#ifdef ANT_DEVICE_NAME // Single transport path
-   SINGLE_CHANNEL,
-#else // Separate data/command paths
-   DATA_CHANNEL,
-   COMMAND_CHANNEL,
-#endif // Separate data/command paths
-   NUM_ANT_CHANNELS
-} ant_channel_type;
-
-typedef struct {
-   /* Thread handle */
-   pthread_t stRxThread;
-   /* Exit condition */
-   ANT_U8 ucRunThread;
-   /* Set state as resetting override */
-   ANT_U8 ucChipResetting;
-   /* Handle to state change lock for crash cleanup */
-   pthread_mutex_t *pstEnabledStatusLock;
-   /* ANT channels */
-   ant_channel_info_t astChannels[NUM_ANT_CHANNELS];
-   /* Event file descriptor used to interrupt the poll() loop in the rx thread. */
-   int iRxShutdownEventFd;
-   /* Indicates whether thread is waiting for a keepalive response. */
-   ANT_BOOL bWaitingForKeepaliveResponse;
-} ant_rx_thread_info_t;
-
-extern ANTNativeANTStateCb g_fnStateCallback;  // TODO State callback should be inside ant_rx_thread_info_t.
-
-/* This is the rx thread function. It loops reading ANT packets until told to
- * exit */
-void *fnRxThread(void *ant_rx_thread_info);
-
-#endif /* ifndef __ANT_RX_NATIVE_H */
-
diff --git a/src/qcomm-hidl/inc/antradio_power.h b/src/qcomm-hidl/inc/antradio_power.h
deleted file mode 100644
index d0f8478..0000000
--- a/src/qcomm-hidl/inc/antradio_power.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __ANTRADIOPM_H
-#define __ANTRADIOPM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Enable the ANT radio interface.
- *
- * Responsible for power on, and bringing up HCI interface.
- * Will block until the HCI interface is ready to use.
- *
- * Returns 0 on success, -ve on error */
-int ant_enable();
-
-/* Disable the ANT radio interface.
- *
- * Responsbile for pulling down the HCI interface, and powering down the chip.
- * Will block until power down is complete, and it is safe to immediately call
- * enable().
- *
- * Returns 0 on success, -ve on error */
-int ant_disable();
-
-/* Returns 1 if enabled, 0 if disabled, and -ve on error */
-int ant_is_enabled();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/qcomm-hidl/qualcomm/hidl/ant_driver_defines.h b/src/qcomm-hidl/qualcomm/hidl/ant_driver_defines.h
deleted file mode 100644
index 0f4ed7a..0000000
--- a/src/qcomm-hidl/qualcomm/hidl/ant_driver_defines.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*******************************************************************************\
-*
-*   FILE NAME:    ant_driver_defines.h
-*
-*   BRIEF:
-*      This file defines ANT specific HCI values used by the ANT chip for a
-*      Qualcomm UART implementation.
-*
-*
-\*******************************************************************************/
-
-#ifndef __VFS_PRERELEASE_H
-#define __VFS_PRERELEASE_H
-
-// Packets may be prefixed with an optional packet type byte when being sent to
-// the chip. Will not be present in messages received.
-
-// -----------------------------------------
-// |         Header       | Data |  Footer  |
-// |----------------------|-----------------|
-// |Optional| Data | Opt. | ...  | Optional |
-// | Opcode | Size | Sync |      | Checksum |
-
-// Data may include any number of ANT packets, with no sync byte or checksum.
-// A read from the driver may return any number of ANT HCI packets.
-
-
-// ---------------------- REQUIRED
-
-// Which chip is this library being built for:
-#define ANT_CHIP_NAME                        "Qualcomm HIDL"
-
-// Set the file name the driver creates for the ANT device:
-//   If chip uses separate command and data paths:
-// #define ANT_COMMANDS_DEVICE_NAME             "/dev/X"
-// #define ANT_DATA_DEVICE_NAME                 "/dev/Y"
-// OR
-//   If chip uses one path:
-
-#define ANT_DEVICE_NAME                          "/dev/ttyHS0"
-
-// Optional Packet prefix byte.
-#define HCI_PACKET_TYPE_SIZE                 1
-
-// Set to the number of bytes of header is for Opcode:
-#define ANT_HCI_OPCODE_SIZE                  0
-
-// Set to the number of bytes of header is for Data Size:
-#define ANT_HCI_SIZE_SIZE                    1
-
-// Set to the number of bytes of header is for Sync:
-#define ANT_HCI_SYNC_SIZE                    0
-
-// Set to the number of bytes of footer is for Checksum:
-#define ANT_HCI_CHECKSUM_SIZE                0
-
-// ---------------------- OPTIONAL
-
-// If hard reset is supported, define ANT_IOCTL_RESET
-// #define ANT_IOCTL_RESET                      _IOW('U', 210, int)
-// #define ANT_IOCTL_RESET_PARAMETER            (0)
-
-// If the chip sends flow control messages:
-//  Define the Opcode for a Flow Control message:
-#define ANT_MESG_FLOW_CONTROL                ((ANT_U8)0xC9)
-// AND
-//   define the message content:
-//     That signals Flow Go:
-#define ANT_FLOW_GO                          ((ANT_U8)0x00)
-
-//     That signals Flow Stop:
-#define ANT_FLOW_STOP                        ((ANT_U8)0x80)
-
-// Define protocol byte to be added
-// as multiple data will be sent/received over
-// same transport(BT, ANT ..etc)
-// needed for HCI_PACKET_TYPE_SIZE > 1.
-#define ANT_CMD_TYPE_PACKET                  ((ANT_U8)0x0C)
-#define ANT_DATA_TYPE_PACKET                 ((ANT_U8)0x0E)
-
-
-typedef enum {
-   ANT_RADIO_UNKNOWN,
-   ANT_RADIO_ENABLING,
-   ANT_RADIO_ENABLED,
-   ANT_RADIO_DISABLING,
-   ANT_RADIO_DISABLED
-} ant_power_state_t;
-
-
-
-#endif /* ifndef __VFS_PRERELEASE_H */
diff --git a/src/vfs/Android.mk b/src/vfs/Android.mk
deleted file mode 100644
index 3d0af04..0000000
--- a/src/vfs/Android.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# Copyright (C) 2011 Dynastream Innovations
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include $(CLEAR_VARS)
-
-LOCAL_CFLAGS := -g -c -W -Wall -O2
-
-LOCAL_C_INCLUDES := \
-   $(LOCAL_PATH)/src/common/inc \
-   $(LOCAL_PATH)/$(ANT_DIR)/inc \
-
-ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"cg29xx")
-LOCAL_C_INCLUDES += \
-   $(LOCAL_PATH)/$(ANT_DIR)/ste/cg29xx \
-
-else ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"qualcomm-smd")
-LOCAL_C_INCLUDES += \
-   $(LOCAL_PATH)/$(ANT_DIR)/qualcomm/smd \
-
-else ifeq ($(BOARD_ANT_WIRELESS_DEVICE),"vfs-prerelease")
-LOCAL_C_INCLUDES += \
-   $(LOCAL_PATH)/$(ANT_DIR)/prerelease \
-
-endif # BOARD_ANT_WIRELESS_DEVICE = "vfs-prerelease"
-
-LOCAL_SRC_FILES := \
-   $(COMMON_DIR)/JAntNative.cpp \
-   $(COMMON_DIR)/ant_utils.c \
-   $(ANT_DIR)/ant_native_chardev.c \
-   $(ANT_DIR)/ant_rx_chardev.c \
-
-# JNI
-LOCAL_C_INCLUDE += $(JNI_H_INCLUDE)
-
-LOCAL_SHARED_LIBRARIES += \
-   libnativehelper \
-
-# logging
-LOCAL_SHARED_LIBRARIES += \
-   libcutils \
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_PRELINK_MODULE := false
-LOCAL_MODULE := libantradio
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/src/vfs/ant_native_chardev.c b/src/vfs/ant_native_chardev.c
deleted file mode 100644
index 1ab8f29..0000000
--- a/src/vfs/ant_native_chardev.c
+++ /dev/null
@@ -1,1001 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ant_native_chardev.c
-*
-*   BRIEF:
-*      This file provides the VFS implementation of ant_native.h
-*      VFS could be Character Device, TTY, etc.
-*
-*
-\******************************************************************************/
-
-#include <errno.h>
-#include <fcntl.h> /* for open() */
-#include <linux/ioctl.h> /* For hard reset */
-#include <pthread.h>
-#include <stdint.h> /* for uint64_t */
-#include <sys/eventfd.h> /* For eventfd() */
-#include <unistd.h> /* for read(), write(), and close() */
-#include <string.h>
-
-#include "ant_types.h"
-#include "ant_native.h"
-#include "ant_version.h"
-
-#include "antradio_power.h"
-#include "ant_rx_chardev.h"
-#include "ant_hci_defines.h"
-#include "ant_log.h"
-
-#if (ANT_HCI_CHANNEL_SIZE > 0) || !defined(ANT_DEVICE_NAME)
-#define MULTIPATH_TX
-#endif
-
-#if ANT_HCI_SIZE_SIZE > 1
-#include "ant_utils.h"  // Put HCI Size value across multiple bytes
-#endif
-
-#define MESG_BROADCAST_DATA_ID               ((ANT_U8)0x4E)
-#define MESG_ACKNOWLEDGED_DATA_ID            ((ANT_U8)0x4F)
-#define MESG_BURST_DATA_ID                   ((ANT_U8)0x50)
-#define MESG_EXT_BROADCAST_DATA_ID           ((ANT_U8)0x5D)
-#define MESG_EXT_ACKNOWLEDGED_DATA_ID        ((ANT_U8)0x5E)
-#define MESG_EXT_BURST_DATA_ID               ((ANT_U8)0x5F)
-#define MESG_ADV_BURST_DATA_ID               ((ANT_U8)0x72)
-
-static ant_rx_thread_info_t stRxThreadInfo;
-static pthread_mutex_t stEnabledStatusLock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t stFlowControlLock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t stFlowControlCond = PTHREAD_COND_INITIALIZER;
-ANTNativeANTStateCb g_fnStateCallback;
-
-static const uint64_t EVENT_FD_PLUS_ONE = 1L;
-
-static void ant_channel_init(ant_channel_info_t *pstChnlInfo, const char *pcCharDevName);
-
-////////////////////////////////////////////////////////////////////
-//  ant_init
-//
-//  Initialises the native environment.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      ANT_STATUS_SUCCESS if intialize completed, else ANT_STATUS_FAILED
-//
-//  Psuedocode:
-/*
-Set variables to defaults
-Initialise each supported path to chip
-Setup eventfd object.
-RESULT = ANT_STATUS_SUCCESS if no problems else ANT_STATUS_FAILED
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_init(void)
-{
-   ANTStatus status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   stRxThreadInfo.stRxThread = 0;
-   stRxThreadInfo.ucRunThread = 0;
-   stRxThreadInfo.ucChipResetting = 0;
-   stRxThreadInfo.pstEnabledStatusLock = &stEnabledStatusLock;
-   g_fnStateCallback = 0;
-
-#ifdef ANT_DEVICE_NAME // Single transport path
-   ant_channel_init(&stRxThreadInfo.astChannels[SINGLE_CHANNEL], ANT_DEVICE_NAME);
-#else // Separate data/command paths
-   ant_channel_init(&stRxThreadInfo.astChannels[COMMAND_CHANNEL], ANT_COMMANDS_DEVICE_NAME);
-   ant_channel_init(&stRxThreadInfo.astChannels[DATA_CHANNEL], ANT_DATA_DEVICE_NAME);
-#endif // Separate data/command paths
-
-   // Make the eventfd. Want it non blocking so that we can easily reset it by reading.
-   stRxThreadInfo.iRxShutdownEventFd = eventfd(0, EFD_NONBLOCK);
-
-   // Check for error case
-   if(stRxThreadInfo.iRxShutdownEventFd == -1)
-   {
-      ANT_ERROR("ANT init failed. Could not create event fd. Reason: %s", strerror(errno));
-   } else {
-      status = ANT_STATUS_SUCCESS;
-   }
-
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_deinit
-//
-//  clean up eventfd object
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      ANT_STATUS_SUCCESS
-//
-//  Psuedocode:
-/*
-RESULT = SUCCESS
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_deinit(void)
-{
-   ANTStatus result_status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   if(close(stRxThreadInfo.iRxShutdownEventFd) < 0)
-   {
-      ANT_ERROR("Could not close eventfd in deinit. Reason: %s", strerror(errno));
-   } else {
-      result_status = ANT_STATUS_SUCCESS;
-   }
-
-   ANT_FUNC_END();
-   return result_status;
-}
-
-
-////////////////////////////////////////////////////////////////////
-//  ant_enable_radio
-//
-//  Powers on the ANT part and initialises the transport to the chip.
-//  Changes occur in part implementing ant_enable() call
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failures:
-//          ANT_STATUS_TRANSPORT_INIT_ERR if could not enable
-//          ANT_STATUS_FAILED if failed to get mutex or init rx thread
-//
-//  Psuedocode:
-/*
-LOCK enable_LOCK
-   IF current_state != ENABLED
-      State callback: STATE = ENABLING
-      ant enable
-      IF ant_enable success
-         State callback: STATE = ENABLED
-         RESULT = SUCCESS
-      ELSE
-         ant disable
-         State callback: STATE = Current state
-         RESULT = FAILURE
-      ENDIF
-   ELSE
-      RESULT = SUCCESS
-   ENDIF
-UNLOCK
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_enable_radio(void)
-{
-   int iLockResult;
-   ANTStatus result_status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting stEnabledStatusLock in %s", __FUNCTION__);
-   iLockResult = pthread_mutex_lock(&stEnabledStatusLock);
-   if(iLockResult) {
-      ANT_ERROR("enable failed to get state lock: %s", strerror(iLockResult));
-      goto out;
-   }
-   ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-
-   if (ant_radio_enabled_status() != RADIO_STATUS_ENABLED) {
-      if (g_fnStateCallback) {
-         g_fnStateCallback(RADIO_STATUS_ENABLING);
-      }
-
-      if (ant_enable() < 0) {
-         ANT_ERROR("ant enable failed: %s", strerror(errno));
-
-         ant_disable();
-
-         if (g_fnStateCallback) {
-            g_fnStateCallback(ant_radio_enabled_status());
-         }
-      } else {
-         if (g_fnStateCallback) {
-            g_fnStateCallback(RADIO_STATUS_ENABLED);
-         }
-
-         result_status = ANT_STATUS_SUCCESS;
-      }
-   } else {
-      ANT_DEBUG_D("Ignoring redundant enable call.");
-      result_status = ANT_STATUS_SUCCESS;
-   }
-
-   ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&stEnabledStatusLock);
-   ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-
-out:
-   ANT_FUNC_END();
-   return result_status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_radio_hard_reset
-//
-//  IF SUPPORTED triggers a hard reset of the chip providing ANT functionality.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failures:
-//          ANT_STATUS_NOT_SUPPORTED if the chip can't hard reset
-//          ANT_STATUS_FAILED if failed to get mutex or enable
-//
-//  Psuedocode:
-/*
-IF Hard Reset not supported
-    RESULT = NOT SUPPORTED
-ELSE
-  LOCK enable_LOCK
-  IF Lock failed
-        RESULT = FAILED
-  ELSE
-    Set Flag Rx thread that chip is resetting
-    FOR each path to chip
-        Send Reset IOCTL to path
-    ENDFOR
-    ant disable
-    ant enable
-    IF ant_enable success
-        State callback: STATE = RESET
-        RESULT = SUCCESS
-    ELSE
-        State callback: STATE = DISABLED
-        RESULT = FAILURE
-    ENDIF
-    Clear Flag Rx thread that chip is resetting
-  UNLOCK
-ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_radio_hard_reset(void)
-{
-   ANTStatus result_status = ANT_STATUS_NOT_SUPPORTED;
-   ANT_FUNC_START();
-
-#ifdef ANT_IOCTL_RESET
-   ant_channel_type eChannel;
-   int iLockResult;
-
-   result_status = ANT_STATUS_FAILED;
-
-   ANT_DEBUG_V("getting stEnabledStatusLock in %s", __FUNCTION__);
-   iLockResult = pthread_mutex_lock(&stEnabledStatusLock);
-   if(iLockResult) {
-      ANT_ERROR("enable failed to get state lock: %s", strerror(iLockResult));
-      goto out;
-   }
-   ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-
-   stRxThreadInfo.ucChipResetting = 1;
-   if (g_fnStateCallback)
-      g_fnStateCallback(RADIO_STATUS_RESETTING);
-
-#ifdef ANT_IOCTL_RESET_PARAMETER
-   ioctl(stRxThreadInfo.astChannels[0].iFd, ANT_IOCTL_RESET, ANT_IOCTL_RESET_PARAMETER);
-#else
-   ioctl(stRxThreadInfo.astChannels[0].iFd, ANT_IOCTL_RESET);
-#endif  // ANT_IOCTL_RESET_PARAMETER
-
-   ant_disable();
-
-   if (ant_enable()) { /* failed */
-      if (g_fnStateCallback)
-         g_fnStateCallback(RADIO_STATUS_DISABLED);
-   } else { /* success */
-      if (g_fnStateCallback)
-         g_fnStateCallback(RADIO_STATUS_RESET);
-      result_status = ANT_STATUS_SUCCESS;
-   }
-   stRxThreadInfo.ucChipResetting = 0;
-
-   ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&stEnabledStatusLock);
-   ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-out:
-#endif // ANT_IOCTL_RESET
-
-   ANT_FUNC_END();
-   return result_status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_disable_radio
-//
-//  Powers off the ANT part and closes the transport to the chip.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failures:
-//          ANT_STATUS_FAILED if failed to get mutex
-//
-//  Psuedocode:
-/*
-LOCK enable_LOCK
-   IF current_state != DISABLED
-      State callback: STATE = DISABLING
-      ant disable
-      State callback: STATE = Current state
-   ENDIF
-   RESULT = SUCCESS
-UNLOCK
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_disable_radio(void)
-{
-   int iLockResult;
-   ANTStatus ret = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting stEnabledStatusLock in %s", __FUNCTION__);
-   iLockResult = pthread_mutex_lock(&stEnabledStatusLock);
-   if(iLockResult) {
-      ANT_ERROR("disable failed to get state lock: %s", strerror(iLockResult));
-      goto out;
-   }
-   ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-
-   if (ant_radio_enabled_status() != RADIO_STATUS_DISABLED) {
-      if (g_fnStateCallback) {
-         g_fnStateCallback(RADIO_STATUS_DISABLING);
-      }
-
-      ant_disable();
-
-      if (g_fnStateCallback) {
-         g_fnStateCallback(ant_radio_enabled_status());
-      }
-   } else {
-      ANT_DEBUG_D("Ignoring redundant disable call.");
-   }
-
-   ret = ANT_STATUS_SUCCESS;
-
-   ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&stEnabledStatusLock);
-   ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-
-out:
-   ANT_FUNC_END();
-   return ret;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_radio_enabled_status
-//
-//  Gets the current chip/transport state; either disabled, disabling,
-//  enabling, enabled, or resetting.  Determines this on the fly by checking
-//  if Rx thread is running and how many of the paths for the ANT chip have
-//  open VFS files.
-//
-//  Parameters:
-//      -
-//
-//  Returns:
-//      The current radio status (ANTRadioEnabledStatus)
-//
-//  Psuedocode:
-/*
-IF Thread Resetting Flag is set
-    RESULT = Resetting
-ELSE
-    COUNT the number of open files
-    IF Thread Run Flag is Not Set
-        IF there are open files OR Rx thread exists
-            RESULT = Disabling
-        ELSE
-            RESULT = Disabled
-        ENDIF
-    ELSE
-        IF All files are open (all paths) AND Rx thread exists
-            RESULT = ENABLED
-        ELSE IF there are open files (Not 0 open files) AND Rx thread exists
-            RESULT = UNKNOWN
-        ELSE (0 open files or Rx thread does not exist [while Thread Run set])
-            RESULT = ENABLING
-        ENDIF
-    ENDIF
-ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTRadioEnabledStatus ant_radio_enabled_status(void)
-{
-   ant_channel_type eChannel;
-   int iOpenFiles = 0;
-   int iOpenThread;
-   ANTRadioEnabledStatus uiRet = RADIO_STATUS_UNKNOWN;
-   ANT_FUNC_START();
-
-   if (stRxThreadInfo.ucChipResetting) {
-      uiRet = RADIO_STATUS_RESETTING;
-      goto out;
-   }
-
-   for (eChannel = 0; eChannel < NUM_ANT_CHANNELS; eChannel++) {
-      if (stRxThreadInfo.astChannels[eChannel].iFd != -1) {
-         iOpenFiles++;
-      }
-   }
-
-   iOpenThread = (stRxThreadInfo.stRxThread) ? 1 : 0;
-
-   if (!stRxThreadInfo.ucRunThread) {
-      if (iOpenFiles || iOpenThread) {
-         uiRet = RADIO_STATUS_DISABLING;
-      } else {
-         uiRet = RADIO_STATUS_DISABLED;
-      }
-   } else {
-      if ((iOpenFiles == NUM_ANT_CHANNELS) && iOpenThread) {
-         uiRet = RADIO_STATUS_ENABLED;
-      } else if (!iOpenFiles && iOpenThread) {
-         uiRet = RADIO_STATUS_UNKNOWN;
-      } else {
-         uiRet = RADIO_STATUS_ENABLING;
-      }
-   }
-
-out:
-   ANT_DEBUG_D("get radio enabled status returned %d", uiRet);
-
-   ANT_FUNC_END();
-   return uiRet;
-}
-
-////////////////////////////////////////////////////////////////////
-//  set_ant_rx_callback
-//
-//  Sets which function to call when an ANT message is received.
-//
-//  Parameters:
-//      rx_callback_func   the ANTNativeANTEventCb function to be used for
-//                         received messages (from all transport paths).
-//
-//  Returns:
-//          ANT_STATUS_SUCCESS
-//
-//  Psuedocode:
-/*
-FOR each transport path
-    Path Rx Callback = rx_callback_func
-ENDFOR
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus set_ant_rx_callback(ANTNativeANTEventCb rx_callback_func)
-{
-   ANTStatus status = ANT_STATUS_SUCCESS;
-   ANT_FUNC_START();
-
-#ifdef ANT_DEVICE_NAME // Single transport path
-   stRxThreadInfo.astChannels[SINGLE_CHANNEL].fnRxCallback = rx_callback_func;
-#else // Separate data/command paths
-   stRxThreadInfo.astChannels[COMMAND_CHANNEL].fnRxCallback = rx_callback_func;
-   stRxThreadInfo.astChannels[DATA_CHANNEL].fnRxCallback = rx_callback_func;
-#endif // Separate data/command paths
-
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  set_ant_state_callback
-//
-//  Sets which function to call when an ANT state change occurs.
-//
-//  Parameters:
-//      state_callback_func   the ANTNativeANTStateCb function to be used
-//                            for received state changes.
-//
-//  Returns:
-//          ANT_STATUS_SUCCESS
-//
-//  Psuedocode:
-/*
-    State Callback = state_callback_func
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus set_ant_state_callback(ANTNativeANTStateCb state_callback_func)
-{
-   ANTStatus status = ANT_STATUS_SUCCESS;
-   ANT_FUNC_START();
-
-   g_fnStateCallback = state_callback_func;
-
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_tx_message_flowcontrol_wait
-//
-//  Sends an ANT message to the chip and waits for a CTS signal
-//
-//  Parameters:
-//      eTxPath          device to transmit message on
-//      eFlowMessagePath device that receives CTS
-//      ucMessageLength  the length of the message
-//      pucMesg          pointer to the message data
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failure:
-//          ANT_STATUS_NOT_ENABLED
-//
-//  Psuedocode:
-/*
-        LOCK flow control
-        IF Lock failed
-            RESULT = FAILED
-        ELSE
-            SET flowMessagePath Flow Control response as FLOW_STOP
-            WRITE txBuffer to txPath (only length of packet part)
-            IF Wrote less then 0 bytes
-                Log error
-                RESULT = FAILED
-            ELSE IF Didn't write 'length of packet' bytes
-                Log error
-                RESULT = FAILED
-            ELSE
-                IF flowMessagePath Flow Control response is not FLOW_GO
-                    WAIT until flowMessagePath Flow Control response is FLOW_GO, UNTIL FLOW_GO Wait Timeout seconds (10) from Now
-                    IF error Waiting
-                        IF error is Timeout
-                            RESULT = HARDWARE ERROR
-                        ELSE
-                            RESULT = FAILED
-                        ENDIF
-                    ELSE
-                        RESULT = SUCCESS
-                    ENDIF
-                ELSE
-                    RESULT = SUCCESS;
-                ENDIF
-            ENDIF
-            UNLOCK flow control
-        ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_tx_message_flowcontrol_wait(ant_channel_type eTxPath, ant_channel_type eFlowMessagePath, ANT_U8 ucMessageLength, ANT_U8 *pucTxMessage)
-{
-   int iMutexResult;
-   int iResult;
-   struct timespec stTimeout;
-   int iCondWaitResult;
-   ANTStatus status = ANT_STATUS_FAILED;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting stFlowControlLock in %s", __FUNCTION__);
-   iMutexResult = pthread_mutex_lock(&stFlowControlLock);
-   if (iMutexResult) {
-      ANT_ERROR("failed to lock flow control mutex during tx: %s", strerror(iMutexResult));
-      goto out;
-   }
-   ANT_DEBUG_V("got stFlowControlLock in %s", __FUNCTION__);
-
-   stRxThreadInfo.astChannels[eFlowMessagePath].ucFlowControlResp = ANT_FLOW_STOP;
-
-#ifdef ANT_FLOW_RESEND
-   // Store Tx message so can resend it from Rx thread
-   stRxThreadInfo.astChannels[eFlowMessagePath].ucResendMessageLength = ucMessageLength;
-   stRxThreadInfo.astChannels[eFlowMessagePath].pucResendMessage = pucTxMessage;
-#endif // ANT_FLOW_RESEND
-
-   iResult = write(stRxThreadInfo.astChannels[eTxPath].iFd, pucTxMessage, ucMessageLength);
-   if (iResult < 0) {
-      ANT_ERROR("failed to write data message to device: %s", strerror(errno));
-   } else if (iResult != ucMessageLength) {
-      ANT_ERROR("bytes written and message size don't match up");
-   } else {
-      stTimeout.tv_sec = time(0) + ANT_FLOW_GO_WAIT_TIMEOUT_SEC;
-      stTimeout.tv_nsec = 0;
-
-      while (stRxThreadInfo.astChannels[eFlowMessagePath].ucFlowControlResp != ANT_FLOW_GO) {
-         iCondWaitResult = pthread_cond_timedwait(&stFlowControlCond, &stFlowControlLock, &stTimeout);
-         if (iCondWaitResult) {
-            ANT_ERROR("failed to wait for flow control response: %s", strerror(iCondWaitResult));
-
-            if (iCondWaitResult == ETIMEDOUT) {
-               status = ANT_STATUS_HARDWARE_ERR;
-
-#ifdef ANT_FLOW_RESEND
-               // Clear Tx message so will stop resending it from Rx thread
-               stRxThreadInfo.astChannels[eFlowMessagePath].ucResendMessageLength = 0;
-               stRxThreadInfo.astChannels[eFlowMessagePath].pucResendMessage = NULL;
-#endif // ANT_FLOW_RESEND
-            }
-            goto wait_error;
-         }
-      }
-
-      status = ANT_STATUS_SUCCESS;
-   }
-
-wait_error:
-   ANT_DEBUG_V("releasing stFlowControlLock in %s", __FUNCTION__);
-   pthread_mutex_unlock(&stFlowControlLock);
-   ANT_DEBUG_V("released stFlowControlLock in %s", __FUNCTION__);
-
-out:
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_tx_message_flowcontrol_none
-//
-//  Sends an ANT message to the chip without waiting for flow control
-//
-//  Parameters:
-//      eTxPath         device to transmit on
-//      ucMessageLength the length of the message
-//      pucMesg         pointer to the message data
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failure:
-//          ANT_STATUS_NOT_ENABLED
-//
-//  Psuedocode:
-/*
-        WRITE txBuffer to Tx Path (only length of packet part)
-        IF Wrote less then 0 bytes
-            Log error
-            RESULT = FAILED
-        ELSE IF Didn't write 'length of packet' bytes
-            Log error
-            RESULT = FAILED
-        ELSE
-            RESULT = SUCCESS
-        ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_tx_message_flowcontrol_none(ant_channel_type eTxPath, ANT_U8 ucMessageLength, ANT_U8 *pucTxMessage)
-{
-   int iResult;
-   ANTStatus status = ANT_STATUS_FAILED;\
-   ANT_FUNC_START();
-
-   iResult = write(stRxThreadInfo.astChannels[eTxPath].iFd, pucTxMessage, ucMessageLength);
-   if (iResult < 0) {
-      ANT_ERROR("failed to write message to device: %s", strerror(errno));
-   }  else if (iResult != ucMessageLength) {
-      ANT_ERROR("bytes written and message size don't match up");
-   } else {
-      status = ANT_STATUS_SUCCESS;
-   }
-
-   ANT_FUNC_END();
-   return status;
-}
-
-////////////////////////////////////////////////////////////////////
-//  ant_tx_message
-//
-//  Frames ANT data and decides which flow control method to use for sending the
-//  ANT message to the chip
-//
-//  Parameters:
-//      ucLen   the length of the message
-//      pucMesg pointer to the message data
-//
-//  Returns:
-//      Success:
-//          ANT_STATUS_SUCCESS
-//      Failure:
-//          ANT_STATUS_NOT_ENABLED
-//
-//  Psuedocode:
-/*
-IF not enabled
-    RESULT = BT NOT INITIALIZED
-ELSE
-    Create txBuffer, MAX HCI Message Size large
-    PUT ucLen in txBuffer AT ANT HCI Size Offset (0)
-    COPY pucMesg to txBuffer AT ANT HCI Header Size (1)     <- ? Not at offset?
-    LOG txBuffer as a serial Tx (only length of packet part)
-    IF is a data message
-        Tx message on Data Path with FLOW_GO/FLOW_STOP flow control (ant_tx_message_flowcontrol_go_stop())
-    ELSE
-        Tx message on Command Path with no flow control (ant_tx_message_flowcontrol_none())
-    ENDIF
-ENDIF
-*/
-////////////////////////////////////////////////////////////////////
-ANTStatus ant_tx_message(ANT_U8 ucLen, ANT_U8 *pucMesg)
-{
-#if defined(MULTIPATH_TX)
-   ANT_BOOL bIsData;
-#endif
-   ant_channel_type eTxChannel;
-   ant_channel_type eFlowChannel;
-   ANTStatus status = ANT_STATUS_FAILED;
-   // TODO ANT_HCI_MAX_MSG_SIZE is transport (driver) dependent.
-   ANT_U8 txBuffer[ANT_HCI_MAX_MSG_SIZE];
-   // TODO Message length can be greater than ANT_U8 can hold.
-   // Not changed as ANT_SERIAL takes length as ANT_U8.
-   ANT_U8 txMessageLength = ucLen + ANT_HCI_HEADER_SIZE;
-   ANT_FUNC_START();
-
-   if (ant_radio_enabled_status() != RADIO_STATUS_ENABLED) {
-      status = ANT_STATUS_FAILED_BT_NOT_INITIALIZED;
-      goto out;
-   }
-
-#if defined(MULTIPATH_TX)
-switch (pucMesg[ANT_MSG_ID_OFFSET]) {
-   case MESG_BROADCAST_DATA_ID:
-   case MESG_ACKNOWLEDGED_DATA_ID:
-   case MESG_BURST_DATA_ID:
-   case MESG_EXT_BROADCAST_DATA_ID:
-   case MESG_EXT_ACKNOWLEDGED_DATA_ID:
-   case MESG_EXT_BURST_DATA_ID:
-   case MESG_ADV_BURST_DATA_ID:
-      bIsData = ANT_TRUE;
-      break;
-   default:
-      bIsData = ANT_FALSE;
-      break;
-   }
-
-   ANT_DEBUG_V("tx message: bIsData=%d", bIsData);
-#endif
-
-#if ANT_HCI_OPCODE_SIZE == 1
-   txBuffer[ANT_HCI_OPCODE_OFFSET] = ANT_HCI_OPCODE_TX;
-#elif ANT_HCI_OPCODE_SIZE > 1
-#error "Specified ANT_HCI_OPCODE_SIZE not currently supported"
-#endif
-
-#if ANT_HCI_CHANNEL_SIZE == 1
-   txBuffer[ANT_HCI_CHANNEL_OFFSET] = bIsData ? ANT_HCI_DATA_CHANNEL : ANT_HCI_COMMAND_CHANNEL;
-#elif ANT_HCI_OPCODE_SIZE > 1
-#error "Specified ANT_HCI_CHANNEL_SIZE not currently supported"
-#endif
-
-#if ANT_HCI_SIZE_SIZE == 1
-   txBuffer[ANT_HCI_SIZE_OFFSET] = ucLen;
-#elif ANT_HCI_SIZE_SIZE == 2
-   ANT_UTILS_StoreLE16(txBuffer + ANT_HCI_SIZE_OFFSET, (ANT_U16)ucLen);
-#else
-#error "Specified ANT_HCI_SIZE_SIZE not currently supported"
-#endif
-
-   memcpy(txBuffer + ANT_HCI_HEADER_SIZE, pucMesg, ucLen);
-
-   ANT_SERIAL(txBuffer, txMessageLength, 'T');
-
-#ifdef ANT_DEVICE_NAME
-   eTxChannel = SINGLE_CHANNEL;
-   eFlowChannel = SINGLE_CHANNEL;
-#else
-   eTxChannel = bIsData ? DATA_CHANNEL : COMMAND_CHANNEL;
-   eFlowChannel = COMMAND_CHANNEL;
-#endif
-
-#if !defined(MULTIPATH_TX) // Single transport path
-   status = ant_tx_message_flowcontrol_wait(eTxChannel, eFlowChannel, txMessageLength, txBuffer);
-#else // Separate data/command paths
-   if (bIsData)
-   {
-      status = ant_tx_message_flowcontrol_wait(eTxChannel, eFlowChannel, txMessageLength, txBuffer);
-   }
-   else
-   {
-      status = ant_tx_message_flowcontrol_none(eTxChannel, txMessageLength, txBuffer);
-   }
-#endif // Separate data/command paths
-
-out:
-   ANT_FUNC_END();
-   return status;
-}
-
-//----------------- TODO Move these somewhere for multi transport path / dedicated channel support:
-
-static void ant_channel_init(ant_channel_info_t *pstChnlInfo, const char *pcCharDevName)
-{
-   ANT_FUNC_START();
-
-   // TODO Don't need to store, only accessed when trying to open:
-   // Is however useful for logs.
-   pstChnlInfo->pcDevicePath = pcCharDevName;
-
-   // This is the only piece of info that needs to be stored per channel
-   pstChnlInfo->iFd = -1;
-
-   // TODO Only 1 of these (not per-channel) is actually ever used:
-   pstChnlInfo->fnRxCallback = NULL;
-   pstChnlInfo->ucFlowControlResp = ANT_FLOW_GO;
-#ifdef ANT_FLOW_RESEND
-   pstChnlInfo->ucResendMessageLength = 0;
-   pstChnlInfo->pucResendMessage = NULL;
-#endif // ANT_FLOW_RESEND
-   // TODO Only used when Flow Control message received, so must only be Command path Rx thread
-   pstChnlInfo->pstFlowControlCond = &stFlowControlCond;
-   pstChnlInfo->pstFlowControlLock = &stFlowControlLock;
-
-   ANT_FUNC_END();
-}
-
-static void ant_disable_channel(ant_channel_info_t *pstChnlInfo)
-{
-   ANT_FUNC_START();
-
-   if (!pstChnlInfo) {
-      ANT_ERROR("null channel info passed to channel disable function");
-      goto out;
-   }
-
-   if (pstChnlInfo->iFd != -1) {
-      if (close(pstChnlInfo->iFd) < 0) {
-         ANT_ERROR("failed to close channel %s(%#x): %s", pstChnlInfo->pcDevicePath, pstChnlInfo->iFd, strerror(errno));
-      }
-
-      pstChnlInfo->iFd = -1; //TODO can this overwrite a still valid fd?
-   } else {
-      ANT_DEBUG_D("%s file is already closed", pstChnlInfo->pcDevicePath);
-   }
-
-out:
-   ANT_FUNC_END();
-}
-
-static int ant_enable_channel(ant_channel_info_t *pstChnlInfo)
-{
-   int iRet = -1;
-   ANT_FUNC_START();
-   if (!pstChnlInfo) {
-      ANT_ERROR("null channel info passed to channel enable function");
-      errno = EINVAL;
-      goto out;
-   }
-   if (pstChnlInfo->iFd == -1) {
-      pstChnlInfo->iFd = open(pstChnlInfo->pcDevicePath, O_RDWR);
-      if (pstChnlInfo->iFd < 0) {
-         ANT_ERROR("failed to open dev %s: %s", pstChnlInfo->pcDevicePath, strerror(errno));
-         goto out;
-      }
-   } else {
-      ANT_DEBUG_D("%s is already enabled", pstChnlInfo->pcDevicePath);
-   }
-   iRet = 0;
-out:
-   ANT_FUNC_END();
-   return iRet;
-}
-
-//----------------------------------------------------------------------- This is antradio_power.h:
-
-int ant_enable(void)
-{
-   int iRet = -1;
-   ant_channel_type eChannel;
-   ANT_FUNC_START();
-
-   // Reset the shutdown signal.
-   uint64_t counter;
-   ssize_t result = read(stRxThreadInfo.iRxShutdownEventFd, &counter, sizeof(counter));
-   // EAGAIN result indicates that the counter was already 0 in non-blocking mode.
-   if(result < 0 && errno != EAGAIN)
-   {
-      ANT_ERROR("Could not clear shutdown signal in enable. Reason: %s", strerror(errno));
-      goto out;
-   }
-
-   stRxThreadInfo.ucRunThread = 1;
-
-   for (eChannel = 0; eChannel < NUM_ANT_CHANNELS; eChannel++) {
-      if (ant_enable_channel(&stRxThreadInfo.astChannels[eChannel]) < 0) {
-         ANT_ERROR("failed to enable channel %s: %s",
-                         stRxThreadInfo.astChannels[eChannel].pcDevicePath,
-                         strerror(errno));
-         goto out;
-      }
-   }
-
-   if (stRxThreadInfo.stRxThread == 0) {
-      if (pthread_create(&stRxThreadInfo.stRxThread, NULL, fnRxThread, &stRxThreadInfo) < 0) {
-         ANT_ERROR("failed to start rx thread: %s", strerror(errno));
-         goto out;
-      }
-   } else {
-      ANT_DEBUG_D("rx thread is already running");
-   }
-
-   if (!stRxThreadInfo.ucRunThread) {
-      ANT_ERROR("rx thread crashed during init");
-      goto out;
-   }
-
-   iRet = 0;
-
-out:
-   if (stRxThreadInfo.stRxThread == 0) {
-      stRxThreadInfo.ucRunThread = 0;
-   }
-   ANT_FUNC_END();
-   return iRet;
-}
-
-int ant_disable(void)
-{
-   int iRet = -1;
-   ant_channel_type eChannel;
-   ANT_FUNC_START();
-
-   stRxThreadInfo.ucRunThread = 0;
-
-   if (stRxThreadInfo.stRxThread != 0) {
-      ANT_DEBUG_I("Sending shutdown signal to rx thread.");
-      if(write(stRxThreadInfo.iRxShutdownEventFd, &EVENT_FD_PLUS_ONE, sizeof(EVENT_FD_PLUS_ONE)) < 0)
-      {
-         ANT_ERROR("failed to signal rx thread with eventfd. Reason: %s", strerror(errno));
-         goto out;
-      }
-      ANT_DEBUG_I("Waiting for rx thread to finish.");
-      if (pthread_join(stRxThreadInfo.stRxThread, NULL) < 0) {
-         ANT_ERROR("failed to join rx thread: %s", strerror(errno));
-         goto out;
-      }
-   } else {
-      ANT_DEBUG_D("rx thread is not running");
-   }
-
-   for (eChannel = 0; eChannel < NUM_ANT_CHANNELS; eChannel++) {
-      ant_disable_channel(&stRxThreadInfo.astChannels[eChannel]);
-   }
-
-   iRet = 0;
-
-out:
-   stRxThreadInfo.stRxThread = 0;
-   ANT_FUNC_END();
-   return iRet;
-}
-
-//---------------------------------------------------------
-
-const char *ant_get_lib_version()
-{
-   return "libantradio.so: "ANT_CHIP_NAME". Version "
-      LIBANT_STACK_MAJOR"."LIBANT_STACK_MINOR"."LIBANT_STACK_INCRE;
-}
diff --git a/src/vfs/ant_rx_chardev.c b/src/vfs/ant_rx_chardev.c
deleted file mode 100644
index c1027d5..0000000
--- a/src/vfs/ant_rx_chardev.c
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************\
-*
-*   FILE NAME:      ant_rx_chardev.c
-*
-*   BRIEF:
-*      This file implements the receive thread function which will loop reading
-*      ANT messages until told to exit.
-*
-*
-\******************************************************************************/
-
-#include <errno.h>
-#include <poll.h>
-#include <pthread.h>
-#include <stdint.h> /* for uint64_t */
-#include <string.h>
-
-#include "ant_types.h"
-#include "antradio_power.h"
-#include "ant_rx_chardev.h"
-#include "ant_hci_defines.h"
-#include "ant_log.h"
-#include "ant_native.h"  // ANT_HCI_MAX_MSG_SIZE, ANT_MSG_ID_OFFSET, ANT_MSG_DATA_OFFSET,
-                         // ant_radio_enabled_status()
-
-extern ANTStatus ant_tx_message_flowcontrol_none(ant_channel_type eTxPath, ANT_U8 ucMessageLength, ANT_U8 *pucTxMessage);
-
-#undef LOG_TAG
-#define LOG_TAG "antradio_rx"
-
-#define ANT_POLL_TIMEOUT         ((int)30000)
-#define KEEPALIVE_TIMEOUT        ((int)5000)
-
-static ANT_U8 aucRxBuffer[NUM_ANT_CHANNELS][ANT_HCI_MAX_MSG_SIZE];
-
-#ifdef ANT_DEVICE_NAME // Single transport path
-	static int iRxBufferLength[NUM_ANT_CHANNELS] = {0};
-#else
-	static int iRxBufferLength[NUM_ANT_CHANNELS] = {0, 0};
-#endif // 
-
-// Defines for use with the poll() call
-#define EVENT_DATA_AVAILABLE (POLLIN|POLLRDNORM)
-#define EVENT_CHIP_SHUTDOWN (POLLHUP)
-#define EVENT_HARD_RESET (POLLERR|POLLPRI|POLLRDHUP)
-
-#define EVENTS_TO_LISTEN_FOR (EVENT_DATA_AVAILABLE|EVENT_CHIP_SHUTDOWN|EVENT_HARD_RESET)
-
-// Plus one is for the eventfd shutdown signal.
-#define NUM_POLL_FDS (NUM_ANT_CHANNELS + 1)
-#define EVENTFD_IDX NUM_ANT_CHANNELS
-
-static ANT_U8 KEEPALIVE_MESG[] = {0x01, 0x00, 0x00};
-static ANT_U8 KEEPALIVE_RESP[] = {0x03, 0x40, 0x00, 0x00, 0x28};
-
-void doReset(ant_rx_thread_info_t *stRxThreadInfo);
-int readChannelMsg(ant_channel_type eChannel, ant_channel_info_t *pstChnlInfo);
-
-/*
- * Function to check that all given flags are set in a particular value.
- * Designed for use with the revents field of pollfds filled out by poll().
- *
- * Parameters:
- *    - value: The value that will be checked to contain all flags.
- *    - flags: Bitwise-or of the flags that value should be checked for.
- *
- * Returns:
- *    - true IFF all the bits that are set in 'flags' are also set in 'value'
- */
-ANT_BOOL areAllFlagsSet(short value, short flags)
-{
-   value &= flags;
-   return (value == flags);
-}
-
-/*
- * This thread is run occasionally as a detached thread in order to send a keepalive message to the
- * chip.
- */
-void *fnKeepAliveThread(void *unused)
-{
-   ANT_DEBUG_V("Sending dummy keepalive message.");
-   ant_tx_message(sizeof(KEEPALIVE_MESG)/sizeof(ANT_U8), KEEPALIVE_MESG);
-   return NULL;
-}
-
-/*
- * This thread waits for ANT messages from a VFS file.
- */
-void *fnRxThread(void *ant_rx_thread_info)
-{
-   int iMutexLockResult;
-   int iPollRet;
-   ant_rx_thread_info_t *stRxThreadInfo;
-   struct pollfd astPollFd[NUM_POLL_FDS];
-   ant_channel_type eChannel;
-   ANT_FUNC_START();
-
-   stRxThreadInfo = (ant_rx_thread_info_t *)ant_rx_thread_info;
-   for (eChannel = 0; eChannel < NUM_ANT_CHANNELS; eChannel++) {
-      astPollFd[eChannel].fd = stRxThreadInfo->astChannels[eChannel].iFd;
-      astPollFd[eChannel].events = EVENTS_TO_LISTEN_FOR;
-   }
-   // Fill out poll request for the shutdown signaller.
-   astPollFd[EVENTFD_IDX].fd = stRxThreadInfo->iRxShutdownEventFd;
-   astPollFd[EVENTFD_IDX].events = POLL_IN;
-
-   // Reset the waiting for response, since we don't want a stale value if we were reset.
-   stRxThreadInfo->bWaitingForKeepaliveResponse = ANT_FALSE;
-
-   /* continue running as long as not terminated */
-   while (stRxThreadInfo->ucRunThread) {
-      /* Wait for data available on any file (transport path), shorter wait if we just timed out. */
-      int timeout = stRxThreadInfo->bWaitingForKeepaliveResponse ? KEEPALIVE_TIMEOUT : ANT_POLL_TIMEOUT;
-      iPollRet = poll(astPollFd, NUM_POLL_FDS, timeout);
-      if (!iPollRet) {
-         if(!stRxThreadInfo->bWaitingForKeepaliveResponse)
-         {
-            stRxThreadInfo->bWaitingForKeepaliveResponse = ANT_TRUE;
-            // Keep alive is done on a separate thread so that rxThread can handle flow control during
-            // the message.
-            pthread_t thread;
-            // Don't care if it failed as the consequence is just a missed keep-alive.
-            pthread_create(&thread, NULL, fnKeepAliveThread, NULL);
-            // Detach the thread so that we don't need to join it later.
-            pthread_detach(thread);
-            ANT_DEBUG_V("poll timed out, checking exit cond");
-         } else
-         {
-            ANT_DEBUG_E("No response to keepalive, attempting recovery.");
-            doReset(stRxThreadInfo);
-            goto out;
-         }
-      } else if (iPollRet < 0) {
-         ANT_ERROR("unhandled error: %s, attempting recovery.", strerror(errno));
-         doReset(stRxThreadInfo);
-         goto out;
-      } else {
-         for (eChannel = 0; eChannel < NUM_ANT_CHANNELS; eChannel++) {
-            if (areAllFlagsSet(astPollFd[eChannel].revents, EVENT_HARD_RESET)) {
-               ANT_ERROR("Hard reset indicated by %s. Attempting recovery.",
-                            stRxThreadInfo->astChannels[eChannel].pcDevicePath);
-               doReset(stRxThreadInfo);
-               goto out;
-            } else if (areAllFlagsSet(astPollFd[eChannel].revents, EVENT_CHIP_SHUTDOWN)) {
-               /* chip reported it was unexpectedly disabled */
-               ANT_DEBUG_D(
-                     "poll hang-up from %s. Attempting recovery.",
-                     stRxThreadInfo->astChannels[eChannel].pcDevicePath);
-
-               doReset(stRxThreadInfo);
-               goto out;
-            } else if (areAllFlagsSet(astPollFd[eChannel].revents, EVENT_DATA_AVAILABLE)) {
-               ANT_DEBUG_D("data on %s. reading it",
-                            stRxThreadInfo->astChannels[eChannel].pcDevicePath);
-
-               // Doesn't matter what data we received, we know the chip is alive.
-               stRxThreadInfo->bWaitingForKeepaliveResponse = ANT_FALSE;
-
-               if (readChannelMsg(eChannel, &stRxThreadInfo->astChannels[eChannel]) < 0) {
-                  ANT_ERROR("Read of data failed. Attempting recovery.");
-                  doReset(stRxThreadInfo);
-                  goto out;
-               }
-            } else if (areAllFlagsSet(astPollFd[eChannel].revents, POLLNVAL)) {
-               ANT_ERROR("poll was called on invalid file descriptor %s. Attempting recovery.",
-                     stRxThreadInfo->astChannels[eChannel].pcDevicePath);
-               doReset(stRxThreadInfo);
-               goto out;
-            } else if (areAllFlagsSet(astPollFd[eChannel].revents, POLLERR)) {
-               ANT_ERROR("Unknown error from %s. Attempting recovery.",
-                     stRxThreadInfo->astChannels[eChannel].pcDevicePath);
-               doReset(stRxThreadInfo);
-               goto out;
-            } else if (astPollFd[eChannel].revents) {
-               ANT_DEBUG_W("unhandled poll result %#x from %s",
-                            astPollFd[eChannel].revents,
-                            stRxThreadInfo->astChannels[eChannel].pcDevicePath);
-            }
-         }
-         // Now check for shutdown signal
-         if(areAllFlagsSet(astPollFd[EVENTFD_IDX].revents, POLLIN))
-         {
-            ANT_DEBUG_I("rx thread caught shutdown signal.");
-            // reset the counter by reading.
-            uint64_t counter;
-            read(stRxThreadInfo->iRxShutdownEventFd, &counter, sizeof(counter));
-            // don't care if read error, going to close the thread anyways.
-            stRxThreadInfo->ucRunThread = 0;
-         } else if (astPollFd[EVENTFD_IDX].revents != 0) {
-            ANT_ERROR("Shutdown event descriptor had unexpected event: %#x. exiting rx thread.",
-                  astPollFd[EVENTFD_IDX].revents);
-            stRxThreadInfo->ucRunThread = 0;
-         }
-      }
-   }
-
-   /* disable ANT radio if not already disabling */
-   // Try to get stEnabledStatusLock.
-   // if you get it then no one is enabling or disabling
-   // if you can't get it assume something made you exit
-   ANT_DEBUG_V("try getting stEnabledStatusLock in %s", __FUNCTION__);
-   iMutexLockResult = pthread_mutex_trylock(stRxThreadInfo->pstEnabledStatusLock);
-   if (!iMutexLockResult) {
-      ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-      ANT_WARN("rx thread has unexpectedly crashed, cleaning up");
-
-      // spoof our handle as closed so we don't try to join ourselves in disable
-      stRxThreadInfo->stRxThread = 0;
-
-      if (g_fnStateCallback) {
-         g_fnStateCallback(RADIO_STATUS_DISABLING);
-      }
-
-      ant_disable();
-
-      if (g_fnStateCallback) {
-         g_fnStateCallback(ant_radio_enabled_status());
-      }
-
-      ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-      pthread_mutex_unlock(stRxThreadInfo->pstEnabledStatusLock);
-      ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-   } else if (iMutexLockResult != EBUSY) {
-      ANT_ERROR("rx thread closing code, trylock on state lock failed: %s",
-            strerror(iMutexLockResult));
-   } else {
-      ANT_DEBUG_V("stEnabledStatusLock busy");
-   }
-
-   out:
-   ANT_FUNC_END();
-#ifdef ANDROID
-   return NULL;
-#endif
-}
-
-void doReset(ant_rx_thread_info_t *stRxThreadInfo)
-{
-   int iMutexLockResult;
-
-   ANT_FUNC_START();
-   /* Chip was reset or other error, only way to recover is to
-    * close and open ANT chardev */
-   stRxThreadInfo->ucChipResetting = 1;
-
-   if (g_fnStateCallback) {
-      g_fnStateCallback(RADIO_STATUS_RESETTING);
-   }
-
-   stRxThreadInfo->ucRunThread = 0;
-
-   ANT_DEBUG_V("getting stEnabledStatusLock in %s", __FUNCTION__);
-   iMutexLockResult = pthread_mutex_lock(stRxThreadInfo->pstEnabledStatusLock);
-   if (iMutexLockResult < 0) {
-      ANT_ERROR("chip was reset, getting state mutex failed: %s",
-            strerror(iMutexLockResult));
-      stRxThreadInfo->stRxThread = 0;
-      stRxThreadInfo->ucChipResetting = 0;
-   } else {
-      ANT_DEBUG_V("got stEnabledStatusLock in %s", __FUNCTION__);
-
-      stRxThreadInfo->stRxThread = 0; /* spoof our handle as closed so we don't
-                                       * try to join ourselves in disable */
-
-      ant_disable();
-
-      int enableResult = ant_enable();
-
-      stRxThreadInfo->ucChipResetting = 0;
-      if (enableResult) { /* failed */
-         if (g_fnStateCallback) {
-            g_fnStateCallback(RADIO_STATUS_DISABLED);
-         }
-      } else { /* success */
-         if (g_fnStateCallback) {
-            g_fnStateCallback(RADIO_STATUS_RESET);
-         }
-      }
-
-      ANT_DEBUG_V("releasing stEnabledStatusLock in %s", __FUNCTION__);
-      pthread_mutex_unlock(stRxThreadInfo->pstEnabledStatusLock);
-      ANT_DEBUG_V("released stEnabledStatusLock in %s", __FUNCTION__);
-   }
-
-   ANT_FUNC_END();
-}
-
-////////////////////////////////////////////////////////////////////
-//  setFlowControl
-//
-//  Sets the flow control "flag" to the value provided and signals the transmit
-//  thread to check the value.
-//
-//  Parameters:
-//      pstChnlInfo   the details of the channel being updated
-//      ucFlowSetting the value to use
-//
-//  Returns:
-//      Success:
-//          0
-//      Failure:
-//          -1
-////////////////////////////////////////////////////////////////////
-int setFlowControl(ant_channel_info_t *pstChnlInfo, ANT_U8 ucFlowSetting)
-{
-   int iRet = -1;
-   int iMutexResult;
-   ANT_FUNC_START();
-
-   ANT_DEBUG_V("getting stFlowControlLock in %s", __FUNCTION__);
-   iMutexResult = pthread_mutex_lock(pstChnlInfo->pstFlowControlLock);
-   if (iMutexResult) {
-      ANT_ERROR("failed to lock flow control mutex during response: %s", strerror(iMutexResult));
-   } else {
-      ANT_DEBUG_V("got stFlowControlLock in %s", __FUNCTION__);
-
-      pstChnlInfo->ucFlowControlResp = ucFlowSetting;
-
-      ANT_DEBUG_V("releasing stFlowControlLock in %s", __FUNCTION__);
-      pthread_mutex_unlock(pstChnlInfo->pstFlowControlLock);
-      ANT_DEBUG_V("released stFlowControlLock in %s", __FUNCTION__);
-
-      pthread_cond_signal(pstChnlInfo->pstFlowControlCond);
-
-      iRet = 0;
-   }
-
-   ANT_FUNC_END();
-   return iRet;
-}
-
-int readChannelMsg(ant_channel_type eChannel, ant_channel_info_t *pstChnlInfo)
-{
-   int iRet = -1;
-   int iRxLenRead;
-   int iCurrentHciPacketOffset;
-   int iHciDataSize;
-   ANT_FUNC_START();
-
-   // Keep trying to read while there is an error, and that error is EAGAIN
-   while (((iRxLenRead = read(pstChnlInfo->iFd, &aucRxBuffer[eChannel][iRxBufferLength[eChannel]], (sizeof(aucRxBuffer[eChannel]) - iRxBufferLength[eChannel]))) < 0)
-                   && errno == EAGAIN)
-      ;
-
-   if (iRxLenRead < 0) {
-      if (errno == ENODEV) {
-         ANT_ERROR("%s not enabled",
-               pstChnlInfo->pcDevicePath);
-
-         goto out;
-      } else if (errno == ENXIO) {
-         ANT_ERROR("%s there is no physical ANT device connected",
-               pstChnlInfo->pcDevicePath);
-
-         goto out;
-      } else {
-         ANT_ERROR("%s: unhandled error: %s",
-               pstChnlInfo->pcDevicePath, strerror(errno));
-
-         goto out;
-      }
-   } else {
-      ANT_SERIAL(aucRxBuffer[eChannel], iRxLenRead, 'R');
-
-      iRxLenRead += iRxBufferLength[eChannel];   // add existing data on
-      
-      // if we didn't get a full packet, then just exit
-      if (iRxLenRead < (aucRxBuffer[eChannel][ANT_HCI_SIZE_OFFSET] + ANT_HCI_HEADER_SIZE + ANT_HCI_FOOTER_SIZE)) {
-         iRxBufferLength[eChannel] = iRxLenRead;
-         iRet = 0;
-         goto out;
-      }
-
-      iRxBufferLength[eChannel] = 0;    // reset buffer length here since we should have a full packet
-      
-#if ANT_HCI_OPCODE_SIZE == 1  // Check the different message types by opcode
-      ANT_U8 opcode = aucRxBuffer[eChannel][ANT_HCI_OPCODE_OFFSET];
-
-      if(ANT_HCI_OPCODE_COMMAND_COMPLETE == opcode) {
-         // Command Complete, so signal a FLOW_GO
-         if(setFlowControl(pstChnlInfo, ANT_FLOW_GO)) {
-            goto out;
-         }
-      } else if(ANT_HCI_OPCODE_FLOW_ON == opcode) {
-         // FLow On, so resend the last Tx
-#ifdef ANT_FLOW_RESEND
-         // Check if there is a message to resend
-         if(pstChnlInfo->ucResendMessageLength > 0) {
-            ant_tx_message_flowcontrol_none(eChannel, pstChnlInfo->ucResendMessageLength, pstChnlInfo->pucResendMessage);
-         } else {
-            ANT_DEBUG_D("Resend requested by chip, but tx request cancelled");
-         }
-#endif // ANT_FLOW_RESEND
-      } else if(ANT_HCI_OPCODE_ANT_EVENT == opcode)
-         // ANT Event, send ANT packet to Rx Callback
-#endif // ANT_HCI_OPCODE_SIZE == 1
-      {
-      // Received an ANT packet
-         iCurrentHciPacketOffset = 0;
-
-         while(iCurrentHciPacketOffset < iRxLenRead) {
-
-            // TODO Allow HCI Packet Size value to be larger than 1 byte
-            // This currently works as no size value is greater than 255, and little endian
-            iHciDataSize = aucRxBuffer[eChannel][iCurrentHciPacketOffset + ANT_HCI_SIZE_OFFSET];
-
-            if ((iHciDataSize + ANT_HCI_HEADER_SIZE + ANT_HCI_FOOTER_SIZE + iCurrentHciPacketOffset) > 
-                  iRxLenRead) {
-               // we don't have a whole packet
-               iRxBufferLength[eChannel] = iRxLenRead - iCurrentHciPacketOffset;
-               memcpy(aucRxBuffer[eChannel], &aucRxBuffer[eChannel][iCurrentHciPacketOffset], iRxBufferLength[eChannel]);
-               // the increment at the end should push us out of the while loop
-            } else
-#ifdef ANT_MESG_FLOW_CONTROL
-            if (aucRxBuffer[eChannel][iCurrentHciPacketOffset + ANT_HCI_DATA_OFFSET + ANT_MSG_ID_OFFSET] == 
-                  ANT_MESG_FLOW_CONTROL) {
-               // This is a flow control packet, not a standard ANT message
-               if(setFlowControl(pstChnlInfo, \
-                     aucRxBuffer[eChannel][iCurrentHciPacketOffset + ANT_HCI_DATA_OFFSET + ANT_MSG_DATA_OFFSET])) {
-                  goto out;
-               }
-            } else
-#endif // ANT_MESG_FLOW_CONTROL
-            {
-               ANT_U8 *msg = aucRxBuffer[eChannel] + iCurrentHciPacketOffset + ANT_HCI_DATA_OFFSET;
-               ANT_BOOL bIsKeepAliveResponse = memcmp(msg, KEEPALIVE_RESP, sizeof(KEEPALIVE_RESP)/sizeof(ANT_U8)) == 0;
-               if (bIsKeepAliveResponse) {
-                  ANT_DEBUG_V("Filtered out keepalive response.");
-               } else if (pstChnlInfo->fnRxCallback != NULL) {
-
-                  // Loop through read data until all HCI packets are written to callback
-                     pstChnlInfo->fnRxCallback(iHciDataSize, \
-                           msg);
-               } else {
-                  ANT_WARN("%s rx callback is null", pstChnlInfo->pcDevicePath);
-               }
-            }
-            
-            iCurrentHciPacketOffset = iCurrentHciPacketOffset + ANT_HCI_HEADER_SIZE + ANT_HCI_FOOTER_SIZE + iHciDataSize;               
-         }         
-      }
-
-      iRet = 0;
-   }
-
-out:
-   ANT_FUNC_END();
-   return iRet;
-}
diff --git a/src/vfs/inc/ant_hci_defines.h b/src/vfs/inc/ant_hci_defines.h
deleted file mode 100644
index b51eb8a..0000000
--- a/src/vfs/inc/ant_hci_defines.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2013 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*******************************************************************************\
-*
-*   FILE NAME:    ant_hci_defines.h
-*
-*   BRIEF:
-*      This file defines ANT specific HCI values used by the ANT chip that are
-*      not specific to the underlying chip. These should not need to be modified,
-*      but should be verified they are correct.
-*
-\*******************************************************************************/
-
-#ifndef __VFS_INDEPENDENT_H
-#define __VFS_INDEPENDENT_H
-
-// ANT HCI Packet Structure
-// -----------------------------------------
-// |         Header       | Data |  Footer  |
-// |----------------------|-----------------|
-// |Optional| Data | Opt. | ...  | Optional |
-// | Opcode | Size | Sync |      | Checksum |
-// Data may include any number of ANT packets, with no sync byte or checksum.
-// A read from the driver may return any number of ANT HCI packets.
-
-#include "ant_driver_defines.h"
-
-#define ANT_HCI_HEADER_SIZE                  ((ANT_HCI_OPCODE_SIZE) + (ANT_HCI_CHANNEL_SIZE) + (ANT_HCI_SIZE_SIZE) + (ANT_HCI_SYNC_SIZE))
-#define ANT_HCI_FOOTER_SIZE                  (ANT_HCI_CHECKSUM_SIZE)
-
-#define ANT_HCI_OPCODE_OFFSET                0
-#define ANT_HCI_CHANNEL_OFFSET               ((ANT_HCI_OPCODE_OFFSET) + (ANT_HCI_OPCODE_SIZE))
-#define ANT_HCI_SIZE_OFFSET                  ((ANT_HCI_CHANNEL_OFFSET) + (ANT_HCI_CHANNEL_SIZE))
-#define ANT_HCI_SYNC_OFFSET                  ((ANT_HCI_SIZE_OFFSET) + (ANT_HCI_SIZE_SIZE))
-#define ANT_HCI_DATA_OFFSET                  (ANT_HCI_HEADER_SIZE)
-
-#define ANT_FLOW_GO_WAIT_TIMEOUT_SEC         10
-
-#endif /* ifndef __VFS_INDEPENDENT_H */
diff --git a/src/vfs/inc/ant_rx_chardev.h b/src/vfs/inc/ant_rx_chardev.h
deleted file mode 100644
index d76184e..0000000
--- a/src/vfs/inc/ant_rx_chardev.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*******************************************************************************\
-*
-*   FILE NAME:      ant_rx_chardev.h
-*
-*   BRIEF:
-*      This file defines the receive thread function, the ant_rx_thread_info_t
-*      type for storing the -configuration- <state> of the receive thread, the
-*      ant_channel_info_t type for storing a channel's (transport path)
-*      configuration, and an enumeration of all ANT channels (transport paths).
-*
-*
-\*******************************************************************************/
-
-#ifndef __ANT_RX_NATIVE_H
-#define __ANT_RX_NATIVE_H
-
-#include "ant_native.h"
-#include "ant_hci_defines.h"
-
-/* same as HCI_MAX_EVENT_SIZE from hci.h, but hci.h is not included for vfs */
-#define ANT_HCI_MAX_MSG_SIZE 260
-
-#define ANT_MSG_SIZE_OFFSET     ((ANT_U8)0)
-#define ANT_MSG_ID_OFFSET       ((ANT_U8)1)
-#define ANT_MSG_DATA_OFFSET     ((ANT_U8)2)
-
-/* This struct defines the info passed to an rx thread */
-typedef struct {
-   /* Device path */
-   const char *pcDevicePath;
-   /* File descriptor to read from */
-   int iFd;
-   /* Callback to call with ANT packet */
-   ANTNativeANTEventCb fnRxCallback;
-   /* Flow control response if channel supports it */
-   ANT_U8 ucFlowControlResp;
-   /* Handle to flow control condition */
-   pthread_cond_t *pstFlowControlCond;
-   /* Handle to flow control mutex */
-   pthread_mutex_t *pstFlowControlLock;
-#ifdef ANT_FLOW_RESEND
-   /* Length of message to resend on request from chip */
-   ANT_U8 ucResendMessageLength;
-   /* The message to resend on request from chip */
-   ANT_U8 *pucResendMessage;
-#endif // ANT_FLOW_RESEND
-} ant_channel_info_t;
-
-typedef enum {
-#ifdef ANT_DEVICE_NAME // Single transport path
-   SINGLE_CHANNEL,
-#else // Separate data/command paths
-   DATA_CHANNEL,
-   COMMAND_CHANNEL,
-#endif // Separate data/command paths
-   NUM_ANT_CHANNELS
-} ant_channel_type;
-
-typedef struct {
-   /* Thread handle */
-   pthread_t stRxThread;
-   /* Exit condition */
-   ANT_U8 ucRunThread;
-   /* Set state as resetting override */
-   ANT_U8 ucChipResetting;
-   /* Handle to state change lock for crash cleanup */
-   pthread_mutex_t *pstEnabledStatusLock;
-   /* ANT channels */
-   ant_channel_info_t astChannels[NUM_ANT_CHANNELS];
-   /* Event file descriptor used to interrupt the poll() loop in the rx thread. */
-   int iRxShutdownEventFd;
-   /* Indicates whether thread is waiting for a keepalive response. */
-   ANT_BOOL bWaitingForKeepaliveResponse;
-} ant_rx_thread_info_t;
-
-extern ANTNativeANTStateCb g_fnStateCallback;  // TODO State callback should be inside ant_rx_thread_info_t.
-
-/* This is the rx thread function. It loops reading ANT packets until told to
- * exit */
-void *fnRxThread(void *ant_rx_thread_info);
-
-#endif /* ifndef __ANT_RX_NATIVE_H */
-
diff --git a/src/vfs/inc/antradio_power.h b/src/vfs/inc/antradio_power.h
deleted file mode 100644
index 1aa0b24..0000000
--- a/src/vfs/inc/antradio_power.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __ANTRADIOPM_H
-#define __ANTRADIOPM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Enable the ANT radio interface.
- *
- * Responsible for power on, and bringing up HCI interface.
- * Will block until the HCI interface is ready to use.
- *
- * Returns 0 on success, -ve on error */
-int ant_enable();
-
-/* Disable the ANT radio interface.
- *
- * Responsbile for pulling down the HCI interface, and powering down the chip.
- * Will block until power down is complete, and it is safe to immediately call 
- * enable().
- *
- * Returns 0 on success, -ve on error */
-int ant_disable();
-
-/* Returns 1 if enabled, 0 if disabled, and -ve on error */
-int ant_is_enabled();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/vfs/prerelease/ant_driver_defines.h b/src/vfs/prerelease/ant_driver_defines.h
deleted file mode 100644
index 3eb5c31..0000000
--- a/src/vfs/prerelease/ant_driver_defines.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*******************************************************************************\
-*
-*   FILE NAME:    ant_driver_defines.h
-*
-*   BRIEF:
-*      This file defines ANT specific HCI values used by the ANT chip for a
-*      sample TTY implementation.
-*
-*
-\*******************************************************************************/
-
-#ifndef __VFS_PRERELEASE_H
-#define __VFS_PRERELEASE_H
-
-// -----------------------------------------
-// |         Header       | Data |  Footer  |
-// |----------------------|-----------------|
-// |Optional| Data | Opt. | ...  | Optional |
-// | Opcode | Size | Sync |      | Checksum |
-
-// Data may include any number of ANT packets, with no sync byte or checksum.
-// A read from the driver may return any number of ANT HCI packets.
-
-
-// ---------------------- REQUIRED
-
-// Which chip is this library being built for:
-#define ANT_CHIP_NAME                        "TTY"
-
-// Set the file name the driver creates for the ANT device:
-//   If chip uses separate command and data paths:
-// #define ANT_COMMANDS_DEVICE_NAME             "/dev/smd5"
-// #define ANT_DATA_DEVICE_NAME                 "/dev/smd6"
-// OR
-//   If chip uses one path:
-#define ANT_DEVICE_NAME                      "/dev/ant"
-
-// Set to the number of bytes of header is for Opcode:
-#define ANT_HCI_OPCODE_SIZE                  0
-
-// Set to the number of bytes of header for channel ID
-#define ANT_HCI_CHANNEL_SIZE                 1
-
-// Set to the number of bytes of header is for Data Size:
-#define ANT_HCI_SIZE_SIZE                    1
-
-// Set to the number of bytes of header is for Sync:
-#define ANT_HCI_SYNC_SIZE                    0
-
-// Set to the number of bytes of footer is for Checksum:
-#define ANT_HCI_CHECKSUM_SIZE                0
-
-// ---------------------- OPTIONAL
-
-// If hard reset is supported, define ANT_IOCTL_RESET
-// #define ANT_IOCTL_RESET                      _IOW('U', 210, int)
-// #define ANT_IOCTL_RESET_PARAMETER            (0)
-
-// If the chip sends flow control messages:
-//  Define the Opcode for a Flow Control message:
-#define ANT_MESG_FLOW_CONTROL                ((ANT_U8)0xC9)
-// AND
-//   define the message content:
-//     That signals Flow Go:
-#define ANT_FLOW_GO                          ((ANT_U8)0x00)
-
-//     That signals Flow Stop:
-#define ANT_FLOW_STOP                        ((ANT_U8)0x80)
-
-// If using a channel ID byte, define the ids.
-#define ANT_HCI_COMMAND_CHANNEL              ((ANT_U8)0x0C)
-#define ANT_HCI_DATA_CHANNEL                 ((ANT_U8)0x0E)
-
-#endif /* ifndef __VFS_PRERELEASE_H */
diff --git a/src/vfs/qualcomm/smd/ant_driver_defines.h b/src/vfs/qualcomm/smd/ant_driver_defines.h
deleted file mode 100644
index 948c524..0000000
--- a/src/vfs/qualcomm/smd/ant_driver_defines.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*******************************************************************************\
-*
-*   FILE NAME:    ant_driver_defines.h
-*
-*   BRIEF:
-*      This file defines ANT specific HCI values used by the ANT chip for a
-*      sample TTY implementation.
-*
-*
-\*******************************************************************************/
-
-#ifndef __VFS_PRERELEASE_H
-#define __VFS_PRERELEASE_H
-
-// -----------------------------------------
-// |         Header       | Data |  Footer  |
-// |----------------------|-----------------|
-// |Optional| Data | Opt. | ...  | Optional |
-// | Opcode | Size | Sync |      | Checksum |
-
-// Data may include any number of ANT packets, with no sync byte or checksum.
-// A read from the driver may return any number of ANT HCI packets.
-
-
-// ---------------------- REQUIRED
-
-// Which chip is this library being built for:
-#define ANT_CHIP_NAME                        "Qualcomm SMD"
-
-// Set the file name the driver creates for the ANT device:
-//   If chip uses separate command and data paths:
-#define ANT_COMMANDS_DEVICE_NAME             "/dev/smd5"
-#define ANT_DATA_DEVICE_NAME                 "/dev/smd6"
-// OR
-//   If chip uses one path:
-// #define ANT_DEVICE_NAME                      "/dev/Z"
-
-// Set to the number of bytes of header is for Opcode:
-#define ANT_HCI_OPCODE_SIZE                  0
-
-// Set to the number of bytes of header for channel ID
-#define ANT_HCI_CHANNEL_SIZE                 0
-
-// Set to the number of bytes of header is for Data Size:
-#define ANT_HCI_SIZE_SIZE                    1
-
-// Set to the number of bytes of header is for Sync:
-#define ANT_HCI_SYNC_SIZE                    0
-
-// Set to the number of bytes of footer is for Checksum:
-#define ANT_HCI_CHECKSUM_SIZE                0
-
-// ---------------------- OPTIONAL
-
-// If hard reset is supported, define ANT_IOCTL_RESET
-// #define ANT_IOCTL_RESET                      _IOW('U', 210, int)
-// #define ANT_IOCTL_RESET_PARAMETER            (0)
-
-// If the chip sends flow control messages:
-//  Define the Opcode for a Flow Control message:
-#define ANT_MESG_FLOW_CONTROL                ((ANT_U8)0xC9)
-// AND
-//   define the message content:
-//     That signals Flow Go:
-#define ANT_FLOW_GO                          ((ANT_U8)0x00)
-
-//     That signals Flow Stop:
-#define ANT_FLOW_STOP                        ((ANT_U8)0x80)
-
-#endif /* ifndef __VFS_PRERELEASE_H */
diff --git a/src/vfs/ste/cg29xx/ant_driver_defines.h b/src/vfs/ste/cg29xx/ant_driver_defines.h
deleted file mode 100644
index b72439f..0000000
--- a/src/vfs/ste/cg29xx/ant_driver_defines.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * ANT Stack
- *
- * Copyright 2011 Dynastream Innovations
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*******************************************************************************\
-*
-*   FILE NAME:    ant_driver_defines.h
-*
-*   BRIEF:
-*      This file defines ANT specific HCI values used by the ANT stack for a
-*      ST-E CG29XX.
-*
-*
-\*******************************************************************************/
-
-#ifndef __VFS_PRERELEASE_H
-#define __VFS_PRERELEASE_H
-
-// ANT HCI Packet Structure
-// -----------------------------------------
-// |         Header       | Data |  Footer  |
-// |----------------------|-----------------|
-// |Optional| Data | Opt. | ...  | Optional |
-// | Opcode | Size | Sync |      | Checksum |
-// Data may include any number of ANT packets, with no sync byte or checksum.
-// A read from the driver may return any number of ANT HCI packets.
-
-
-// ---------------------- REQUIRED
-
-// Which chip is this library being built for:
-#define ANT_CHIP_NAME                        "ST-E CG29XX"
-
-// Set the file name the driver creates for the ANT device:
-//   If chip uses separate command and data paths:
-#define ANT_COMMANDS_DEVICE_NAME             "/dev/cg2900_antradio_cmd"
-#define ANT_DATA_DEVICE_NAME                 "/dev/cg2900_antradio_data"
-// OR
-//   If chip uses one path:
-// #define ANT_DEVICE_NAME                      "/dev/Z"
-
-// Set to the number of bytes of header is for Opcode:
-#define ANT_HCI_OPCODE_SIZE                  0
-// Set to the number of bytes of header for channel ID
-#define ANT_HCI_CHANNEL_SIZE                 0
-// Set to the number of bytes of header is for Data Size:
-#define ANT_HCI_SIZE_SIZE                    1
-
-// Set to the number of bytes of header is for Sync:
-#define ANT_HCI_SYNC_SIZE                    0
-// Set to the number of bytes of footer is for Checksum:
-#define ANT_HCI_CHECKSUM_SIZE                0
-
-
-// ---------------------- OPTIONAL
-
-// If hard reset is supported, define ANT_IOCTL_RESET
-#define ANT_IOCTL_RESET                      _IOW('U', 210, int)
-#define ANT_IOCTL_RESET_PARAMETER            (0)
-
-// If the chip sends flow control messages:
-//  Define the Opcode for a Flow Control message:
-#define ANT_MESG_FLOW_CONTROL                ((ANT_U8)0xC9)
-// AND
-//   define the message content:
-//     That signals Flow Go:
-#define ANT_FLOW_GO                          ((ANT_U8)0x00)
-//     That signals Flow Stop:
-#define ANT_FLOW_STOP                        ((ANT_U8)0x80)
-
-#endif /* ifndef __VFS_PRERELEASE_H */
