Re: [PATCH v2 11/20] cyclingspeed: Add stub to use SC Control Point

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 5, 2012 at 6:54 AM, Andrzej Kaczmarek
<andrzej.kaczmarek@xxxxxxxxx> wrote:
> This patch implements common functions to use SC Control Point.
> Individual procedures will be implemented in subsequent patches.
> ---
>  profiles/cyclingspeed/cyclingspeed.c | 145 +++++++++++++++++++++++++++++++++--
>  1 file changed, 140 insertions(+), 5 deletions(-)
>
> diff --git a/profiles/cyclingspeed/cyclingspeed.c b/profiles/cyclingspeed/cyclingspeed.c
> index 5a65507..ffef6ae 100644
> --- a/profiles/cyclingspeed/cyclingspeed.c
> +++ b/profiles/cyclingspeed/cyclingspeed.c
> @@ -41,6 +41,11 @@
>  #include "log.h"
>  #include "cyclingspeed.h"
>
> +/* min length for ATT indication or notification: opcode (1b) + handle (2b) */
> +#define ATT_HDR_LEN 3
> +
> +#define ATT_TIMEOUT 30
> +
>  #define CYCLINGSPEED_INTERFACE         "org.bluez.CyclingSpeed"
>  #define CYCLINGSPEED_MANAGER_INTERFACE "org.bluez.CyclingSpeedManager"
>  #define CYCLINGSPEED_WATCHER_INTERFACE "org.bluez.CyclingSpeedWatcher"
> @@ -52,6 +57,25 @@
>  #define WHEEL_REV_PRESENT      0x01
>  #define CRANK_REV_PRESENT      0x02
>
> +#define SET_CUMULATIVE_VALUE           0x01
> +#define START_SENSOR_CALIBRATION       0x02
> +#define UPDATE_SENSOR_LOC              0x03
> +#define REQUEST_SUPPORTED_SENSOR_LOC   0x04
> +#define RESPONSE_CODE                  0x10
> +
> +#define RSP_SUCCESS            0x01
> +#define RSP_NOT_SUPPORTED      0x02
> +#define RSP_INVALID_PARAM      0x03
> +#define RSP_FAILED             0x04
> +
> +struct csc;
> +
> +struct controlpoint_req {
> +       struct csc              *csc;
> +       uint8_t                 opcode;
> +       guint                   timeout;
> +};
> +
>  struct csc_adapter {
>         struct btd_adapter      *adapter;
>         GSList                  *devices;       /* list of registered devices */
> @@ -66,6 +90,8 @@ struct csc {
>         guint                   attioid;
>         /* attio id for measurement characteristics value notifications */
>         guint                   attio_measurement_id;
> +       /* attio id for SC Control Point characteristics value indications */
> +       guint                   attio_controlpoint_id;
>
>         struct att_range        *svc_range;
>
> @@ -75,6 +101,8 @@ struct csc {
>         uint16_t                feature;
>         gboolean                has_location;
>         uint8_t                 location;
> +
> +       struct controlpoint_req *pending_req;
>  };
>
>  struct watcher {
> @@ -216,6 +244,7 @@ static void destroy_csc(gpointer user_data)
>
>         if (csc->attrib != NULL) {
>                 g_attrib_unregister(csc->attrib, csc->attio_measurement_id);
> +               g_attrib_unregister(csc->attrib, csc->attio_controlpoint_id);
>                 g_attrib_unref(csc->attrib);
>         }
>
> @@ -235,6 +264,35 @@ static void char_write_cb(guint8 status, const guint8 *pdu, guint16 len,
>         g_free(msg);
>  }
>
> +static gboolean controlpoint_timeout(gpointer user_data)
> +{
> +       struct controlpoint_req *req = user_data;
> +
> +       req->csc->pending_req = NULL;
> +       g_free(req);
> +
> +       return FALSE;
> +}
> +
> +__attribute__((unused)) /* TODO: remove once controlpoint ops are implemented */

This is a weird way to split the patches... but I don't care that much
for a bootstrap

Lucas De Marchi
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux