Device

## Device Device — Data structure holding information about the iPod (model, mount point, ...) |

## Synopsis

                Itdb_Device;
    Itdb_Device* itdb_device_new                (void);
    void        itdb_device_free                (Itdb_Device *device);
    void        itdb_device_set_mountpoint      (Itdb_Device *device,
                                                 const gchar *mp);
    gboolean    itdb_device_read_sysinfo        (Itdb_Device *device);
    gchar*      itdb_device_get_sysinfo         (Itdb_Device *device,
                                                 const gchar *field);
    enum        Itdb_IpodModel;
                Itdb_ArtworkFormat;

## Description

## Details

### Itdb_Device

    typedef struct {
        gchar *mountpoint;    /* mountpoint of the iPod */
        gint   musicdirs;     /* number of /iPod_Control/Music/F.. dirs */
        guint  byte_order;    /* G_LITTLE_ENDIAN "regular" endianness
    			   * G_BIG_ENDIAN "reversed" endianness (e.g. mobile
    			   * phone iTunesDBs)
    			   */
        GHashTable *sysinfo;  /* hash with value/key pairs of all entries
    			   * in Device/SysInfo */
        gboolean sysinfo_changed; /* Has the sysinfo hash been changed by
    				 the user (itdb_set_sysinfo) */
    } Itdb_Device;

### itdb_device_new ()

    Itdb_Device* itdb_device_new                (void);

Creates a new Itdb_Device structure

Returns : | a newly allocated Itdb_Device which must be freed with `itdb_device_free()` when no longer needed

### itdb_device_free ()

    void        itdb_device_free                (Itdb_Device *device);

Frees memory used by `device`

`device` : | an Itdb_Device

### itdb_device_set_mountpoint ()

    void        itdb_device_set_mountpoint      (Itdb_Device *device,
                                                 const gchar *mp);

Sets the mountpoint of `device` to `mp` and update the cached device information (in particular, re-read the SysInfo file)

`device` : | an Itdb_Device
`mp` : | the new mount point

### itdb_device_read_sysinfo ()

    gboolean    itdb_device_read_sysinfo        (Itdb_Device *device);

Reads the SysInfo file and stores information in device->sysinfo for later use.

`device` : | an Itdb_Device
Returns : | TRUE if file could be read, FALSE otherwise

### itdb_device_get_sysinfo ()

    gchar*      itdb_device_get_sysinfo         (Itdb_Device *device,
                                                 const gchar *field);

Retrieve specified field from the SysInfo file.

`device` : | an Itdb_Device
`field` : | field to retrive information from
Returns : | the information associated with `field`, or NULL if `field` couldn't be found. `g_free()` after use

### enum Itdb_IpodModel

    typedef enum {
        ITDB_IPOD_MODEL_INVALID,
        ITDB_IPOD_MODEL_UNKNOWN,
        ITDB_IPOD_MODEL_COLOR,
        ITDB_IPOD_MODEL_COLOR_U2,
        ITDB_IPOD_MODEL_REGULAR,
        ITDB_IPOD_MODEL_REGULAR_U2,
        ITDB_IPOD_MODEL_MINI,
        ITDB_IPOD_MODEL_MINI_BLUE,
        ITDB_IPOD_MODEL_MINI_PINK,
        ITDB_IPOD_MODEL_MINI_GREEN,
        ITDB_IPOD_MODEL_MINI_GOLD,
        ITDB_IPOD_MODEL_SHUFFLE,
        ITDB_IPOD_MODEL_NANO_WHITE,
        ITDB_IPOD_MODEL_NANO_BLACK,
        ITDB_IPOD_MODEL_VIDEO_WHITE,
        ITDB_IPOD_MODEL_VIDEO_BLACK,
        ITDB_IPOD_MODEL_MOBILE_1,
        ITDB_IPOD_MODEL_VIDEO_U2,
        ITDB_IPOD_MODEL_NANO_SILVER,
        ITDB_IPOD_MODEL_NANO_BLUE,
        ITDB_IPOD_MODEL_NANO_GREEN,
        ITDB_IPOD_MODEL_NANO_PINK
    } Itdb_IpodModel;

### Itdb_ArtworkFormat

    typedef struct {
    	ItdbThumbType type;
    	gint16 width;
    	gint16 height;
    	gint16 correlation_id;
    } Itdb_ArtworkFormat;