From 2cb725314c2de96f15b3e3b2cb1137c5968272da Mon Sep 17 00:00:00 2001 From: Iwan Timmer Date: Mon, 29 Apr 2019 19:09:31 +0200 Subject: [PATCH] Add connection status update handler --- src/connection.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/connection.c b/src/connection.c index 8ea5afa..e1b89db 100644 --- a/src/connection.c +++ b/src/connection.c @@ -44,6 +44,17 @@ static void rumble(unsigned short controllerNumber, unsigned short lowFreqMotor, rumble_handler(controllerNumber, lowFreqMotor, highFreqMotor); } +static void connection_status_update(int status) { + switch (status) { + case CONN_STATUS_OKAY: + printf("Connection is okay\n"); + break; + case CONN_STATUS_POOR: + printf("Connection is poor\n"); + break; + } +} + CONNECTION_LISTENER_CALLBACKS connection_callbacks = { .stageStarting = NULL, .stageComplete = NULL, @@ -52,4 +63,5 @@ CONNECTION_LISTENER_CALLBACKS connection_callbacks = { .connectionTerminated = connection_terminated, .logMessage = connection_log_message, .rumble = rumble, + .connectionStatusUpdate = connection_status_update };