Gammu internals
1.38.0
|
#include <gammu-config.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <gammu-keys.h>
#include <gammu-debug.h>
#include "../misc/coding/coding.h"
#include "../debug.h"
#include "gsmmisc.h"
#include "../../helper/string.h"
Go to the source code of this file.
Data Structures | |
struct | keys_table_position |
Functions | |
GSM_Error | MakeKeySequence (char *text, GSM_KeyCode *KeyCode, size_t *Length) |
GSM_Error | GSM_ReadFile (const char *FileName, GSM_File *File) |
static void | GSM_JADFindLine (GSM_File *File, const char *Name, char *Value) |
GSM_Error | GSM_JADFindData (GSM_File *File, char *Vendor, char *Name, char *JAR, char *Version, int *Size) |
void | GSM_IdentifyFileFormat (GSM_File *File) |
GSM_Error | VC_StoreLine (char *Buffer, const size_t buff_len, size_t *Pos, const char *format,...) |
GSM_Error | VC_Store (char *Buffer, const size_t buff_len, size_t *Pos, const char *format,...) |
GSM_Error | VC_StoreDateTime (char *Buffer, const size_t buff_len, size_t *Pos, const GSM_DateTime *Date, const char *Start) |
GSM_Error | VC_StoreDate (char *Buffer, const size_t buff_len, size_t *Pos, const GSM_DateTime *Date, const char *Start) |
gboolean | ReadVCALDateTime (const char *Buffer, GSM_DateTime *dt) |
gboolean | ReadVCALInt (char *Buffer, const char *Start, int *Value) |
gboolean | ReadVCALDate (char *Buffer, const char *Start, GSM_DateTime *Date, gboolean *is_date_only) |
GSM_Error | VC_StoreText (char *Buffer, const size_t buff_len, size_t *Pos, const unsigned char *Text, const char *Start, const gboolean UTF8) |
GSM_Error | VC_StoreBase64 (char *Buffer, const size_t buff_len, size_t *Pos, const unsigned char *data, const size_t length) |
unsigned char * | VCALGetTextPart (unsigned char *Buff, int *pos) |
gboolean | ReadVCALText (char *Buffer, const char *Start, unsigned char *Value, const gboolean UTF8, GSM_EntryLocation *location) |
void | GSM_ClearBatteryCharge (GSM_BatteryCharge *bat) |
Variables | |
static struct keys_table_position | Keys [] |
void GSM_ClearBatteryCharge | ( | GSM_BatteryCharge * | bat | ) |
Resets all members of GSM_BatteryCharge structure.
Definition at line 784 of file gsmmisc.c.
References GSM_BatteryCharge::BatteryCapacity, GSM_BatteryCharge::BatteryPercent, GSM_BatteryCharge::BatteryTemperature, GSM_BatteryCharge::BatteryType, GSM_BatteryCharge::BatteryVoltage, GSM_BatteryCharge::ChargeCurrent, GSM_BatteryCharge::ChargeState, GSM_BatteryCharge::ChargeVoltage, GSM_BatteryCharge::PhoneCurrent, and GSM_BatteryCharge::PhoneTemperature.
|
static |
Definition at line 117 of file gsmmisc.c.
References GSM_File::Buffer, ERR_NONE, FALSE, MyGetLine(), and GSM_File::Used.
Referenced by GSM_JADFindData().
gboolean ReadVCALDate | ( | char * | Buffer, |
const char * | Start, | ||
GSM_DateTime * | Date, | ||
gboolean * | is_date_only | ||
) |
Definition at line 335 of file gsmmisc.c.
References dbgprintf, DecodeUnicodeString(), FALSE, OSDate(), ReadVCALDateTime(), ReadVCALText(), and TRUE.
Referenced by GSM_DecodeVCALENDAR_VTODO().
gboolean ReadVCALDateTime | ( | const char * | Buffer, |
GSM_DateTime * | dt | ||
) |
Definition at line 254 of file gsmmisc.c.
References CheckDate(), CheckTime(), GSM_DateTime::Day, dbgprintf, FALSE, Fill_GSM_DateTime(), Fill_Time_T(), GSM_DateTime::Hour, GSM_DateTime::Minute, GSM_DateTime::Month, GSM_DateTime::Second, GSM_DateTime::Timezone, TRUE, and GSM_DateTime::Year.
Referenced by GSM_DecodeVCAL_RRULE(), GSM_DecodeVCARD(), and ReadVCALDate().
gboolean ReadVCALInt | ( | char * | Buffer, |
const char * | Start, | ||
int * | Value | ||
) |
gboolean ReadVCALText | ( | char * | Buffer, |
const char * | Start, | ||
unsigned char * | Value, | ||
const gboolean | UTF8, | ||
GSM_EntryLocation * | location | ||
) |
We separate matching text (Start) to tokens and then try to find all tokens in Buffer. We also accept tokens like PREF, CHARSET or ENCODING.
Also it parses TYPE=* tokens, matching it to text types passed in Start parameter. For example Start "TEL;FAX;VOICE" matches "TEL;TYPE=FAX,VOICE" or "TEL;FAX;TYPE=VOICE" or "TEL;TYPE=FAX;TYPE=VOICE" and of course "TEL;FAX;VOICE".
When all tokens are matched we found matching line.
Definition at line 468 of file gsmmisc.c.
References dbgprintf, DecodeISO88591(), DecodeISO88591QuotedPrintable(), DecodeUnicodeConsole(), DecodeUTF7(), DecodeUTF8(), DecodeUTF8QuotedPrintable(), FALSE, PBK_Location_Home, PBK_Location_Unknown, PBK_Location_Work, TRUE, and UnicodeLength().
Referenced by GSM_DecodeVCALENDAR_VTODO(), GSM_DecodeVCARD(), GSM_DecodeVNOTE(), and ReadVCALDate().
GSM_Error VC_Store | ( | char * | Buffer, |
const size_t | buff_len, | ||
size_t * | Pos, | ||
const char * | format, | ||
... | |||
) |
Prints a string to a buffer with error checking.
Definition at line 208 of file gsmmisc.c.
References ERR_MOREMEMORY, and ERR_NONE.
Referenced by GSM_EncodeVCAL_RRULE(), GSM_EncodeVCARD(), VC_StoreDate(), and VC_StoreDateTime().
GSM_Error VC_StoreBase64 | ( | char * | Buffer, |
const size_t | buff_len, | ||
size_t * | Pos, | ||
const unsigned char * | data, | ||
const size_t | length | ||
) |
Store base64 encoded string to buffer.
Definition at line 392 of file gsmmisc.c.
References EncodeBASE64(), ERR_MOREMEMORY, ERR_NONE, MIN, and VC_StoreLine().
Referenced by GSM_EncodeVCARD().
GSM_Error VC_StoreDate | ( | char * | Buffer, |
const size_t | buff_len, | ||
size_t * | Pos, | ||
const GSM_DateTime * | Date, | ||
const char * | Start | ||
) |
Definition at line 240 of file gsmmisc.c.
References GSM_DateTime::Day, ERR_NONE, GSM_DateTime::Month, VC_Store(), VC_StoreLine(), and GSM_DateTime::Year.
Referenced by GSM_EncodeVCAL_RRULE(), GSM_EncodeVCALENDAR(), and GSM_EncodeVCARD().
GSM_Error VC_StoreDateTime | ( | char * | Buffer, |
const size_t | buff_len, | ||
size_t * | Pos, | ||
const GSM_DateTime * | Date, | ||
const char * | Start | ||
) |
Definition at line 224 of file gsmmisc.c.
References GSM_DateTime::Day, ERR_NONE, GSM_DateTime::Hour, GSM_DateTime::Minute, GSM_DateTime::Month, GSM_DateTime::Second, GSM_DateTime::Timezone, VC_Store(), VC_StoreLine(), and GSM_DateTime::Year.
Referenced by GSM_EncodeVCALENDAR(), GSM_EncodeVCARD(), and GSM_EncodeVTODO().
GSM_Error VC_StoreLine | ( | char * | Buffer, |
const size_t | buff_len, | ||
size_t * | Pos, | ||
const char * | format, | ||
... | |||
) |
Prints a line (terminated with CRLF) to a buffer with error checking.
Definition at line 187 of file gsmmisc.c.
References ERR_MOREMEMORY, ERR_NONE, and PRINTF_STYLE.
Referenced by GSM_EncodeVCAL_RRULE(), GSM_EncodeVCALENDAR(), GSM_EncodeVCARD(), GSM_EncodeVNTFile(), GSM_EncodeVTODO(), VC_StoreBase64(), VC_StoreDate(), VC_StoreDateTime(), and VC_StoreText().
GSM_Error VC_StoreText | ( | char * | Buffer, |
const size_t | buff_len, | ||
size_t * | Length, | ||
const unsigned char * | Text, | ||
const char * | Start, | ||
const gboolean | UTF8 | ||
) |
Stores text in vCalendar/vCard formatted buffer.
[out] | Buffer | Buffer where output will be stored. |
[in] | buff_len | Size of Buffer. |
[in,out] | Length | Current position in output buffer (will be updated). |
[in] | Text | Value to be stored. |
[in] | Start | Name of field which is being stored. |
[in] | UTF8 | Whether text should be stored in UTF-8 without prefix. |
Definition at line 360 of file gsmmisc.c.
References EncodeUTF8QuotedPrintable(), ERR_MOREMEMORY, ERR_NONE, UnicodeLength(), and VC_StoreLine().
Referenced by GSM_EncodeVCALENDAR(), GSM_EncodeVCARD(), GSM_EncodeVNTFile(), and GSM_EncodeVTODO().
unsigned char* VCALGetTextPart | ( | unsigned char * | Buff, |
int * | pos | ||
) |
Definition at line 436 of file gsmmisc.c.
References CopyUnicodeString().
Referenced by GSM_DecodeVCARD().
|
static |