GSM-Gnokii

 view release on metacpan or  search on metacpan

Gnokii.xs  view on Meta::CPAN

    XS_RETURNi (err);
    /* SetAlarm */

void
GetCalendarNotes (self, start, end)
    HvObject		*self;
    int			start;
    int			end;

  PPCODE:
    gn_calnote_list	calendarnoteslist;
    gn_calnote		calendarnote;
    int			i, err;
    AV			*cnl = newAV ();

    if (opt_v) warn ("GetCalenderNotes (%d, %d)\n", start, end);

    if (start < 0) {
	set_errors ("calendarnote location should be in positive");
	XSRETURN_UNDEF;
	}

    if (end < 0 || (start && end == 0))
	end = INT_MAX;

    for (i = start; i <= end; i++) {
	clear_data ();
	calendarnote.location = i;
	data->calnote      = &calendarnote;
	data->calnote_list = &calendarnoteslist;
	err = gn_sm_functions (GN_OP_GetCalendarNote, data, state);

	if (err == GN_ERR_INVALIDLOCATION)
	    break;

	if (err == GN_ERR_EMPTYLOCATION) {
	    av_push (cnl, &PL_sv_undef);
	    continue;
	    }

	if (err == GN_ERR_NONE) {
	    HV	*note = newHV ();

	    hv_puti (note, "location", i);

	    hv_puts (note, "type",       gn_calnote_type2str       (calendarnote.type));
	    hv_puts (note, "recurrence", gn_calnote_recurrence2str (calendarnote.recurrence));

	    if (calendarnote.phone_number[0])
		hv_puts (note, "number",    calendarnote.phone_number);
	    if (calendarnote.mlocation[0])
		hv_puts (note, "mlocation", calendarnote.mlocation);

	    hv_puts (note, "text", calendarnote.text);
	    if (calendarnote.alarm.timestamp.year)
		GSMDATE_TO_TM ("alarm", calendarnote.alarm.timestamp, note);
	    calendarnote.time.second = 0;
	    calendarnote.time.minute = 0;
	    calendarnote.time.hour   = 0;
	    GSMDATE_TO_TM ("date", calendarnote.time, note);
	    av_addr (cnl, note);
	    }
	else
	    set_errori (err);
	}
    XS_RETURNr (cnl);
    /* GetCalendarNotes */

void
WriteCalendarNote (self, calhash)

lib/GSM/Gnokii.pm  view on Meta::CPAN

  alarm            => "07:25",
  state            => "off",

=head2 SetAlarm (hour, minute)

Set and enable alarm. Hour should be between 0 and 23, Minute between
0 and 59.

=head2 GetCalendarNotes (start, end)

Returns a reference to a list of calendar note hashes, like:

  location         => 1,
  date             => "2011-11-11 11:11:11",
  type             => "Meeting",
  text             => "Be there or be fired",
  mlocation        => "Board room",
  alarm            => "2010-10-10 10:10:10",
  recurrence       => "Weekly",
  number           => "+31612345678",

=head2 WriteCalendarNote ({ ... })

Set a calendar note,  attributes marked with a * are required

  date             => time + 86400,   # * Date and time of note
  text             => "Call John!",   # * Note text
  type             => "call",         #   Note type, defaults to MEMO
  number           => "+31612345678", #   Required for type CALL
  mlocation        => "Board room",   #   Adviced for type MEET
  alarm            => time + 86400,   #   Alarm time
  recurrence       => "Weekly",       #   Recurrence, defaults to NEVER

Valid note types are C<REMINDER>, C<CALL>, C<MEETING>, C<BIRTHDAY>,



( run in 0.723 second using v1.01-cache-2.11-cpan-5dc5da66d9d )