libdfu: Add DfuVersion enumerated values

This commit is contained in:
Richard Hughes 2016-06-08 14:57:30 +01:00
parent 11dc9ace51
commit 10d4c84fbd
2 changed files with 41 additions and 0 deletions

View File

@ -155,3 +155,25 @@ dfu_cipher_kind_to_string (DfuCipherKind cipher_kind)
return "xtea";
return NULL;
}
/**
* dfu_version_to_string:
* @version: a #DfuVersion, e.g. %DFU_VERSION_DFU_1_1
*
* Converts an enumerated value to a string.
*
* Return value: a string
*
* Since: 0.7.2
**/
const gchar *
dfu_version_to_string (DfuVersion version)
{
if (version == DFU_VERSION_DFU_1_0)
return "1.0";
if (version == DFU_VERSION_DFU_1_1)
return "1.1";
if (version == DFU_VERSION_DFUSE)
return "DfuSe";
return NULL;
}

View File

@ -155,6 +155,24 @@ typedef enum {
DFU_CIPHER_KIND_LAST
} DfuCipherKind;
/**
* DfuVersion:
* @DFU_VERSION_UNKNOWN: Format unknown
* @DFU_VERSION_DFU_1_0: DFU 1.0
* @DFU_VERSION_DFU_1_1: DFU 1.1
* @DFU_VERSION_DFUSE: DfuSe
*
* The known versions of the DFU standard in BCD format.
**/
typedef enum {
DFU_VERSION_UNKNOWN = 0,
DFU_VERSION_DFU_1_0 = 0x0100,
DFU_VERSION_DFU_1_1 = 0x0110,
DFU_VERSION_DFUSE = 0x011a,
/*< private >*/
DFU_VERSION_LAST
} DfuVersion;
#define DFU_METADATA_KEY_LICENSE "License"
#define DFU_METADATA_KEY_COPYRIGHT "Copyright"
#define DFU_METADATA_KEY_CIPHER_KIND "CipherKind"
@ -163,6 +181,7 @@ const gchar *dfu_state_to_string (DfuState state);
const gchar *dfu_status_to_string (DfuStatus status);
const gchar *dfu_mode_to_string (DfuMode mode);
const gchar *dfu_cipher_kind_to_string (DfuCipherKind cipher_kind);
const gchar *dfu_version_to_string (DfuVersion version);
G_END_DECLS