<commit_before>/*******************************************************************************
** libttwatch.h
**
** main header file for the ttwatch library
*******************************************************************************/
  
#ifndef __LIBTTWATCH_H__
#define __LIBTTWATCH_H__

#include <stdint.h>
#include <libusb.h>

#ifdef __cplusplus
extern "C" {
#endif

#define LIBTTWATCH_VERSION  (0x000105)  /* version 0.1.5 */

#define TOMTOM_VENDOR_ID                (0x1390)
#define TOMTOM_MULTISPORT_PRODUCT_ID    (0x7474)
#define TOMTOM_SPARK_MUSIC_PRODUCT_ID   (0x7475)
#define TOMTOM_SPARK_CARDIO_PRODUCT_ID  (0x7477)

#define IS_SPARK(id)                            \
    (((id) == TOMTOM_SPARK_MUSIC_PRODUCT_ID) || \
     ((id) == TOMTOM_SPARK_CARDIO_PRODUCT_ID))  \


/*****************************************************************************/
typedef struct
{
    libusb_device_handle *device;
    int         attach_kernel_driver;

    uint32_t    product_id;
    uint32_t    firmware_version;
    uint32_t    ble_version;
    const char  serial_number[64];

    uint16_t    usb_product_id;

    uint32_t    current_file;

    char       *preferences_file;
    size_t      preferences_file_length;
    uint8_t    *manifest_file;
    size_t      manifest_file_length;

    int         preferences_changed;
    int         manifest_changed;
} TTWATCH;

/*****************************************************************************/
typedef struct
{
    TTWATCH *watch;
    uint32_t file_id;
} TTWATCH_FILE;

/*****************************************************************************/
typedef enum
{
    TTWATCH_NoError,
    TTWATCH_UnableToSendPacket,
    TTWATCH_UnableToReceivePacket,
    TTWATCH_InvalidResponse,
    TTWATCH_IncorrectResponseLength,
    TTWATCH_OutOfSyncResponse,
    TTWATCH_UnexpectedResponse,
    TTWATCH_NoMatchingWatch,
    TTWATCH_NotAWatch,
    TTWATCH_UnableToOpenDevice,
    TTWATCH_FileOpen,
    TTWATCH_FileNotOpen,
    TTWATCH_NoMoreFiles,
    TTWATCH_VerifyError,
    TTWATCH_ParseError,
    TTWATCH_NoData,
    TTWATCH_InvalidParameter,
} TTWATCH_ERROR;

/*****************************************************************************/
typedef enum
{    
    TTWATCH_Running = 0,    
    TTWATCH_Cycling = 1,    
    TTWATCH_Swimming = 2,    
    TTWATCH_Treadmill = 7,    
    TTWATCH_Freestyle = 8,    
    TTWATCH_Gym = 9,    
    TTWATCH_Hiking = 10,           // Adventurer
    TTWATCH_IndoorCycling = 11,    // Adventurer
    TTWATCH_TrailRunning =14,      // Adventurer    
    TTWATCH_Skiing = 15,           // Adventurer
    TTWATCH_Snowboarding =16       // Adventurer
} TTWATCH_ACTIVITY;

/*****************************************************************************/
typedef struct __attribute__((packed))
{
    uint16_t file_type;
    uint16_t entry_count;
    struct __attribute__((packed))
    {
        uint16_t index;
        uint32_t value;
    } entries[1];
} TTWATCH_MANIFEST_FILE;

/*****************************************************************************/
typedef struct __attribute__((packed))
{
    char     name[16];
    uint32_t _unk1[5];
    uint8_t  _unk2;
    uint8_t  _unk3;
    uint32_t checkpoints;
    uint32_t time;
    uint32_t distance;
    uint8_t  distances[1];
} TTWATCH_RACE_FILE;
<commit_msg>Pedantic formatting and bump libttwatch library version number<commit_after>/*******************************************************************************
** libttwatch.h
**
** main header file for the ttwatch library
*******************************************************************************/
  
#ifndef __LIBTTWATCH_H__
#define __LIBTTWATCH_H__

#include <stdint.h>
#include <libusb.h>

#ifdef __cplusplus
extern "C" {
#endif

#define LIBTTWATCH_VERSION  (0x000106)  /* version 0.1.6 */

#define TOMTOM_VENDOR_ID                (0x1390)
#define TOMTOM_MULTISPORT_PRODUCT_ID    (0x7474)
#define TOMTOM_SPARK_MUSIC_PRODUCT_ID   (0x7475)
#define TOMTOM_SPARK_CARDIO_PRODUCT_ID  (0x7477)

#define IS_SPARK(id)                            \
    (((id) == TOMTOM_SPARK_MUSIC_PRODUCT_ID) || \
     ((id) == TOMTOM_SPARK_CARDIO_PRODUCT_ID))  \


/*****************************************************************************/
typedef struct
{
    libusb_device_handle *device;
    int         attach_kernel_driver;

    uint32_t    product_id;
    uint32_t    firmware_version;
    uint32_t    ble_version;
    const char  serial_number[64];

    uint16_t    usb_product_id;

    uint32_t    current_file;

    char       *preferences_file;
    size_t      preferences_file_length;
    uint8_t    *manifest_file;
    size_t      manifest_file_length;

    int         preferences_changed;
    int         manifest_changed;
} TTWATCH;

/*****************************************************************************/
typedef struct
{
    TTWATCH *watch;
    uint32_t file_id;
} TTWATCH_FILE;

/*****************************************************************************/
typedef enum
{
    TTWATCH_NoError,
    TTWATCH_UnableToSendPacket,
    TTWATCH_UnableToReceivePacket,
    TTWATCH_InvalidResponse,
    TTWATCH_IncorrectResponseLength,
    TTWATCH_OutOfSyncResponse,
    TTWATCH_UnexpectedResponse,
    TTWATCH_NoMatchingWatch,
    TTWATCH_NotAWatch,
    TTWATCH_UnableToOpenDevice,
    TTWATCH_FileOpen,
    TTWATCH_FileNotOpen,
    TTWATCH_NoMoreFiles,
    TTWATCH_VerifyError,
    TTWATCH_ParseError,
    TTWATCH_NoData,
    TTWATCH_InvalidParameter,
} TTWATCH_ERROR;

/*****************************************************************************/
typedef enum
{    
    TTWATCH_Running = 0,    
    TTWATCH_Cycling = 1,    
    TTWATCH_Swimming = 2,    
    TTWATCH_Treadmill = 7,    
    TTWATCH_Freestyle = 8,    
    TTWATCH_Gym = 9,    
    TTWATCH_Hiking = 10,           // Adventurer
    TTWATCH_IndoorCycling = 11,    // Adventurer
    TTWATCH_TrailRunning = 14,     // Adventurer
    TTWATCH_Skiing = 15,           // Adventurer
    TTWATCH_Snowboarding = 16      // Adventurer
} TTWATCH_ACTIVITY;

/*****************************************************************************/
typedef struct __attribute__((packed))
{
    uint16_t file_type;
    uint16_t entry_count;
    struct __attribute__((packed))
    {
        uint16_t index;
        uint32_t value;
    } entries[1];
} TTWATCH_MANIFEST_FILE;

/*****************************************************************************/
typedef struct __attribute__((packed))
{
    char     name[16];
    uint32_t _unk1[5];
    uint8_t  _unk2;
    uint8_t  _unk3;
    uint32_t checkpoints;
    uint32_t time;
    uint32_t distance;
    uint8_t  distances[1];
} TTWATCH_RACE_FILE;

{'fraction_non_alphanumeric': 0.24845655774732722, 'fraction_numerical': 0.02650203282638157, 'mean_word_length': 3.690677966101695, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6773728', 'n_tokens_mistral': 2342, 'n_tokens_neox': 2079, 'n_words': 345}