/**
* Save the current config to the persistent store.
*/
public static int save() {
PersistentObject pobj = PersistentStore.getPersistentObject(SyncClient.CONFIG_KEY);
ConfigData contents = new ConfigData();
// This field can be used to check which version of the sw
// saved the data. If not present, it is assumed it's an
// old version and the saved config is discarded.
contents.setValue("VERSION", VERSION);
contents.setValue("SYNC_URL", syncUrl);
contents.setValue("USERNAME", userName);
contents.setValue("PASSWORD", password);
contents.setValue("SYNC_CARD", syncContact);
contents.setValue("CARD_URI", contactSourceUri);
contents.setValue("SYNC_CAL", syncCalendar);
contents.setValue("CAL_URI", calendarSourceUri);
contents.setValue("SYNC_MAIL", syncMail) ;
contents.setValue("MAIL_URI", mailSourceUri) ;
contents.setValue("MAIL_ADDR", mailAddress) ;
contents.setValue("POLL_ENABLE", enablePolling) ;
contents.setValue("POLL_TIME", pollInterval) ;
contents.setValue("SMS_ENABLE", enableSmsSync) ;
contents.setValue("GW_APN", gatewayApn) ;
contents.setValue("GW_IP", gatewayIp) ;
contents.setValue("GW_PORT", gatewayPort) ;
contents.setValue("PUSH_PORT", listeningPort) ;
contents.setValue("log_LEVEL", logLevel) ;
synchronized (pobj) {
pobj.setContents(contents);
pobj.commit();
}
return 0;
}