LATEST VERSION 1.2 (11.11.2014) - NOW WITH GOOGLE CONTACTS!
Current FLASH team research concerns on developing new robot competencies and examining the possibility of establishing and maintaining relationships with humans during long-term interaction. The human need for information will stimulate contacts with personal robot, and the variable nature of information will assure non-schematic interactions. Therefore social robots must be enriched with functions allowing him to inform people about their everyday activities.
UGCalendar is a module (UObject) for Urbi to handle google calendar and google contacts service. Using the module your robot will be able to access your Google calendar(s) with all events and list of user's google contact. With the module you can use our official "FLASH Connect" project or create your own project in the developers console
. It is extremely easy to extend the module by adding new fields and more detailed information about events. Basing on this module, you can develop other Google APIs.
You can find more information here:
The module utilizes cURL library with SSL-based communication (OpenSSL). cURL is free and open software for transferring data with URL syntax. UGCalendar was compiled with all the shared libraries (all included in ugcalendar1x.zip package). Copy them to the uobjects folder or set path in system environment variable (PATH).
How to run
- You need a Google Account for testing purposes. If you already have a test account, then you're all set.
- Get familiar with Google Calendar and Google Contacts. If you haven't used them, then try out the user interface before using the module.
- (ONLY IF YOU WANT USE YOUR OWN GOOGLE PROJECT) Get familiar with Google Developers Console. If you haven't already registered your application with the Google Developers Console, then set up a project and application in the Developers Console. The system guides you through the process of choosing or creating a project and registering a new application, and it automatically activates the API for you. If you've already registered your application with the Developers Console, then follow this procedure instead:
- Go to the Google Developers Console.
- Select a project.
- In the sidebar on the left, select APIs & auth. In the list of APIs, make sure the status is ON for the Google Calendar API and Google Contacts API.
- In the sidebar on the left, select Credentials. Then, click Create new Client ID and choose APPLICATION TYPE: Installed application, INSTALLED APPLICATION TYPE: Other.
- Get CLIENT ID and CLIENT SECRET keys.
- (INSTEAD OF 3) Remember, that you can also use our Google project. You can ask us for CLIENT ID and CLIENT SECRET strings.
Next 7 screenshots shows how to start using UGCalendar module in URBI-based robot control system:
UGCalendar.Login("CLIENT ID","CLIENT SECRET") - perform login procedure,
"CLIENT ID" - client id key received from the Developers Console,
"CLIENT SECRET" - client secret key received from the Developers Console,
UGCalendar.RefreshAccess(); - refresh once received access at least every hour; failure to do that means that you need to repeat the login procedure,
UGCalendar.errorMessage; - error message received from Google service,
UGCalendar.errorCode; - error code received from Google service,
UGCalendar.errorReason; - list of error reasons received from Google service,
for debugging only:
For your convenience access has been provided to the tokens received from Google service. Access token is valid for 1h. You can use tokens instead of login procedure.
UGCalendar.GetAccessToken(); - get received access token,
UGCalendar.SetAccessToken("access_token"); - set previously received access token.
UGCalendar.GetCalendars() - get a list of calendar info (see slots below),
UGCalendar.calendarID - identifiers of the calendars,
UGCalendar.calendarSummary - titles of the calendars,
UGCalendar.calendarDescription - descriptions of the calendars,
UGCalendar.calendarLocation - geographic locations of the calendars as free-form text,
UGCalendar.calendarTimeZone - the time zones of the calendars.
UGCalendar.GetEvents("calendar_ID","from date","to date") - get a list of events (see slots below),
"calendar_ID" - calendar identifier,
"from date" - optional start time in "YYYY-MM-YY HH:MM:SS" or "YYYY-MM-YY" format
"to date" - optional end time in "YYYY-MM-YY HH:MM:SS" or "YYYY-MM-YY" format
UGCalendar.eventID - identifiers of the events,
UGCalendar.eventSummary - titles of the events,
UGCalendar.eventDescription - descriptions of the events,
UGCalendar.eventLocation - geographic locations of the events as free-form text,
UGCalendar.eventStartTime - the (inclusive) start time of the events,
UGCalendar.eventEndTime - the (exclusive) end time of the events.
UGCalendar.SetEvent("calendar_ID","summary","location","start time","end time", email, popup, sms) - set one event in the given calendar,
"calendar_ID" - identifiers of the calendar,
"summary" - title of the event,
"location" - location of the event
"start time" - start time of the event in "YYYY-MM-YY HH:MM:SS" or "YYYY-MM-YY" format
"end time" - end time of the event in "YYYY-MM-YY HH:MM:SS" or "YYYY-MM-YY" format
email - number of minutes before the start of the event when the reminder should be sent via email (-1 - no email reminder),
popup - number of minutes before the start of the event when the reminder should be sent via popup UI (-1 - no popup reminder),
sms - number of minutes before the start of the event when the reminder should be sent via sms (-1 - no sms reminder).
Contact group functions
UGCalendar.GetContactGroups() - get a list of contact group info (see slots below),
UGCalendar.contactGroupID - group identifiers,
UGCalendar.contactGroupTitle - titles of the contact group.
UGCalendar.GetContacts(group_ID) - get a list of contact group info (see slots below),
UGCalendar.contactID - identifiers of the contacts,
UGCalendar.contactTitle - titles of the contacts,
UGCalendar.contactEmail - emails of the contacts,
UGCalendar.contactPhone - phones of the contacts.
var calendar = UGCalendar.new();
// get a listt of all calendars
// display calendar title
//get events from calendar
//get pending events
// display events data
// set event
calendar.SetEvent("primary","Meeting","Wroclaw","2014-08-22 08:00:00","2014-08-22 10:00:00",15,-1,-1);
set all-day event
// get contacts
calendar.GetContacts(calendar.contactGroupID); // "My Contacts" default system group
// display contact data