summaryrefslogtreecommitdiffstats
path: root/stack/rfcomm/port_api.c
diff options
context:
space:
mode:
authorJune R. Tate-Gans <jtgans@google.com>2014-12-02 12:48:03 -0800
committerAndre Eisenbach <eisenbach@google.com>2015-03-16 16:51:40 -0700
commit1e8cb5671e16c1de2a430365ea65fac6affc69f5 (patch)
treefc85d6a6dfe2909fb483a45ad9ff3173eb12cc2c /stack/rfcomm/port_api.c
parent54966dcf830fb54b6b8221583470e3e78768d4c5 (diff)
downloadandroid_system_bt-1e8cb5671e16c1de2a430365ea65fac6affc69f5.tar.gz
android_system_bt-1e8cb5671e16c1de2a430365ea65fac6affc69f5.tar.bz2
android_system_bt-1e8cb5671e16c1de2a430365ea65fac6affc69f5.zip
Adding some logging for the close states for RFCOMM connections.
Diffstat (limited to 'stack/rfcomm/port_api.c')
-rw-r--r--stack/rfcomm/port_api.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/stack/rfcomm/port_api.c b/stack/rfcomm/port_api.c
index c37549728..abc5b89c0 100644
--- a/stack/rfcomm/port_api.c
+++ b/stack/rfcomm/port_api.c
@@ -44,6 +44,36 @@
#define error(fmt, ...) ALOGE ("## ERROR : %s: " fmt "##",__FUNCTION__, ## __VA_ARGS__)
#define asrt(s) if(!(s)) ALOGE ("## %s assert %s failed at line:%d ##",__FUNCTION__, #s, __LINE__)
+/* Mapping from PORT_* result codes to human readable strings. */
+static const char *result_code_strings[] = {
+ "Success",
+ "Unknown error",
+ "Already opened",
+ "Command pending",
+ "App not registered",
+ "No memory",
+ "No resources",
+ "Bad BD address",
+ "Bad handle",
+ "Not opened",
+ "Line error",
+ "Start failed",
+ "Parameter negotiation failed",
+ "Port negotiation failed",
+ "Sec failed",
+ "Peer connection failed",
+ "Peer failed",
+ "Peer timeout",
+ "Closed",
+ "TX full",
+ "Local closed",
+ "Local timeout",
+ "TX queue disabled",
+ "Page timeout",
+ "Invalid SCN",
+ "Unknown result code"
+};
+
/*******************************************************************************
**
** Function RFCOMM_CreateConnection
@@ -1846,3 +1876,20 @@ UINT8 PORT_SetTraceLevel (UINT8 new_level)
return (rfc_cb.trace_level);
}
+/*******************************************************************************
+**
+** Function PORT_GetResultString
+**
+** Description This function returns the human-readable string for a given
+** result code.
+**
+** Returns a pointer to the human-readable string for the given result.
+**
+*******************************************************************************/
+const char *PORT_GetResultString (const uint8_t result_code) {
+ if (result_code > PORT_ERR_MAX) {
+ return result_code_strings[PORT_ERR_MAX];
+ }
+
+ return result_code_strings[result_code];
+}