iCalendar parser¶
The iCalendar parser library can be used to parse a data stream in iCalendar format, which is a data format for representing and exchanging calendaring and scheduling information. The library parses the calendaring information and returns parsed calendar events.
The library first detects the beginning of the calendar object by locating the delimiter BEGIN:VCALENDAR
.
It then parses the following calendar content fragment by fragment.
For each calendar component that is parsed, the library sends a parsed event (ical_parser_evt
) to the application.
Supported features¶
The library supports iCalendar version 2.0 as defined in RFC5545.
The iCalendar parser library supports parsing the following calendar components:
VEVENT
It supports parsing the following calendar properties:
DESCRIPTION
DTEND
DTSTART
LOCATION
SUMMARY
API documentation¶
include/net/icalendar_parser.h
subsys/net/lib/icalendar_parser/src/
-
group
icalendar_parser
Typedefs
-
typedef int (*
icalendar_parser_callback_t
)(const struct ical_parser_evt *event)¶ iCalendar parser asynchronous event handler.
Through this callback, the application receives events, such as parsed component with errors code.
- Return
Zero to continue the parsing, non-zero otherwise.
- Parameters
[in] event
: The iCalendar event.
Enums
-
enum
ical_parser_evt_id
¶ iCalendar parser event IDs.
Values:
-
enumerator
ICAL_EVT_VEVENT
¶ Event Component parsed
-
enumerator
ICAL_EVT_VTODO
¶ Todo Component parsed
-
enumerator
ICAL_EVT_VJOURNAL
¶ Journal Component parsed
-
enumerator
ICAL_EVT_VTIMEZONE
¶ Timezone Component parsed
-
enumerator
ICAL_EVT_VFREEBUSY
¶ FreeBusy Component parsed
-
enumerator
-
enum
ical_parser_error_id
¶ iCalendar parser error IDs.
Values:
-
enumerator
ICAL_ERROR_NONE
¶ No error
-
enumerator
ICAL_ERROR_SUMMARY
¶ SUMMARY property error
-
enumerator
ICAL_ERROR_LOCATION
¶ LOCATION property error
-
enumerator
ICAL_ERROR_DESCRIPTION
¶ DESCRIPTION property error
-
enumerator
ICAL_ERROR_DTSTART
¶ DTSTART property error
-
enumerator
ICAL_ERROR_DTEND
¶ DTEND property error
-
enumerator
ICAL_ERROR_COM_NOT_SUPPORTED
¶ Component not supported error
-
enumerator
Functions
-
int
ical_parser_init
(struct icalendar_parser *ical, icalendar_parser_callback_t callback)¶ Initialize iCalendar parser.
- Return
0 If successful, or an error code on failure.
- Parameters
[inout] ical
: iCalendar parser instance.[in] callback
: Callback for sending calendar parsing event.
-
size_t
ical_parser_parse
(struct icalendar_parser *ical, const char *data, size_t len)¶ Parse the iCalendar data stream. Return the parsed bytes.
- Parameters
[inout] ical
: iCalendar parser instance.[in] data
: Input data to be parsed.[in] len
: Length of input data stream.
- Return Value
size_t
: Parsed bytes.
-
struct
ical_component
¶ - #include <icalendar_parser.h>
iCalendar component.
Public Members
-
char
summary
[CONFIG_ICAL_PARSER_SUMMARY_SIZE
+ 1]¶ SUMMARY property
-
char
location
[CONFIG_ICAL_PARSER_LOCATION_SIZE
+ 1]¶ LOCATION property buffer.
-
char
description
[CONFIG_ICAL_PARSER_DESCRIPTION_SIZE
+ 1]¶ DESCRIPTION property buffer.
-
char
dtstart
[CONFIG_ICAL_PARSER_DTSTART_SIZE
+ 1]¶ DTSTART property.
-
char
dtend
[CONFIG_ICAL_PARSER_DTEND_SIZE
+ 1]¶ DTEND property buffer.
-
char
-
struct
ical_parser_evt
¶ - #include <icalendar_parser.h>
iCalendar parser event.
Public Members
-
enum ical_parser_evt_id
id
¶ Event ID.
-
enum ical_parser_error_id
error
¶ Error cause.
-
struct ical_component
ical_com
¶ Calendar component data.
-
enum ical_parser_evt_id
-
struct
icalendar_parser
¶ - #include <icalendar_parser.h>
iCalendar parser instance.
Public Members
-
char
buf
[CONFIG_ICAL_PARSER_BUFFER_SIZE
+ 1]¶ Internal Buffer for parsing incoming data stream
-
size_t
offset
¶ Offset of unparsed data in buf.
-
bool
icalobject_begin
¶ begin of iCalendar object delimiter pair
-
icalendar_parser_callback_t
callback
¶ Event handler.
-
char
-
typedef int (*