// sensor not started
this.state = SensorStates.STARTING;
var thisObject = this;
- native_.call('Sensor_start', { sensorType: thisObject.sensorType }, function(
+ native_.call('SensorStart', { sensorType: thisObject.sensorType }, function(
result
) {
if (native_.isFailure(result)) {
SensorListener.prototype.stop = function() {
if (SensorStates.NOT_STARTED != this.state) {
- var result = native_.callSync('Sensor_stop', { sensorType: this.sensorType });
+ var result = native_.callSync('SensorStop', { sensorType: this.sensorType });
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
this.callbackBatchLatency != batchLatency
) {
//call platform only if there was no listener registered or parameters changed
- var result = native_.callSync('Sensor_setChangeListener', {
+ var result = native_.callSync('SensorSetChangeListener', {
sensorType: this.sensorType,
interval: interval,
batchLatency: batchLatency
if (this.callback) {
//unregister in platform only if there is callback registered
this.callback = undefined;
- var result = native_.callSync('Sensor_unsetChangeListener', {
+ var result = native_.callSync('SensorUnsetChangeListener', {
sensorType: this.sensorType
});
if (native_.isFailure(result)) {
}
}, 0);
} else {
- native_.call('Sensor_getData', { type: thisObj.sensorType }, function(result) {
+ native_.call('SensorGetData', { type: thisObj.sensorType }, function(result) {
if (native_.isFailure(result)) {
if (!T_.isNullOrUndefined(errorCallback)) {
errorCallback(native_.getErrorObject(result));
native_.addListener(SENSOR_CHANGED_LISTENER, _listener);
function getAvailableSensors() {
- var result = native_.callSync('SensorService_getAvailableSensors', {});
+ var result = native_.callSync('SensorServiceGetAvailableSensors', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
};
var result = native_.call(
- 'Sensor_getSensorHardwareInfo',
+ 'SensorGetSensorHardwareInfo',
{ type: this.sensorType },
callback
);
using std::placeholders::_1;
using std::placeholders::_2;
-#define REGISTER_SYNC(c, x) RegisterSyncHandler(c, std::bind(&SensorInstance::x, this, _1, _2));
- REGISTER_SYNC("SensorService_getAvailableSensors", GetAvailableSensors);
- REGISTER_SYNC("Sensor_stop", SensorStop);
- REGISTER_SYNC("Sensor_setChangeListener", SensorSetChangeListener);
- REGISTER_SYNC("Sensor_unsetChangeListener", SensorUnsetChangeListener);
-#undef REGISTER_SYNC
-#define REGISTER_ASYNC(c, x) RegisterSyncHandler(c, std::bind(&SensorInstance::x, this, _1, _2));
- REGISTER_ASYNC("Sensor_start", SensorStart);
- REGISTER_ASYNC("Sensor_getData", SensorGetData);
- REGISTER_ASYNC("Sensor_getSensorHardwareInfo", GetSensorHardwareInfo);
-#undef REGISTER_ASYNC
+#define REGISTER_METHOD(M) \
+ RegisterSyncHandler(#M, std::bind(&SensorInstance::M, this, _1, _2))
+ REGISTER_METHOD(SensorServiceGetAvailableSensors);
+ REGISTER_METHOD(SensorStop);
+ REGISTER_METHOD(SensorSetChangeListener);
+ REGISTER_METHOD(SensorUnsetChangeListener);
+ REGISTER_METHOD(SensorStart);
+ REGISTER_METHOD(SensorGetData);
+ REGISTER_METHOD(SensorGetSensorHardwareInfo);
+#undef REGISTER_METHOD
}
SensorInstance::~SensorInstance() {
ScopeLogger();
}
-void SensorInstance::GetAvailableSensors(const picojson::value& args, picojson::object& out) {
+void SensorInstance::SensorServiceGetAvailableSensors(const picojson::value& args, picojson::object& out) {
ScopeLogger();
service_.GetAvailableSensors(out);
}
service_.GetSensorData(args, out);
}
-void SensorInstance::GetSensorHardwareInfo(const picojson::value& args, picojson::object& out) {
+void SensorInstance::SensorGetSensorHardwareInfo(const picojson::value& args, picojson::object& out) {
ScopeLogger();
service_.GetSensorHardwareInfo(args, out);
virtual ~SensorInstance();
private:
- void GetAvailableSensors(const picojson::value& args, picojson::object& out);
+ void SensorServiceGetAvailableSensors(const picojson::value& args, picojson::object& out);
void SensorStop(const picojson::value& args, picojson::object& out);
void SensorSetChangeListener(const picojson::value& args, picojson::object& out);
void SensorUnsetChangeListener(const picojson::value& args, picojson::object& out);
void SensorStart(const picojson::value& args, picojson::object& out);
void SensorGetData(const picojson::value& args, picojson::object& out);
- void GetSensorHardwareInfo(const picojson::value& args, picojson::object& out);
+ void SensorGetSensorHardwareInfo(const picojson::value& args, picojson::object& out);
SensorService service_;
};
var id = this.nextId;
if (!this.nativeSet) {
this.native.addListener(this.listenerName, this.onListenerCalled.bind(this));
- this.native.callSync('SoundManager_addDeviceStateChangeListener');
+ this.native.callSync('SoundManagerAddDeviceStateChangeListener');
this.nativeSet = true;
}
delete this.listeners[watchId];
if (this.nativeSet && type_.isEmptyObject(this.listeners)) {
- this.native.callSync('SoundManager_removeDeviceStateChangeListener');
+ this.native.callSync('SoundManagerRemoveDeviceStateChangeListener');
this.native.removeListener(this.listenerName);
this.nativeSet = false;
}
function SoundManager() {}
SoundManager.prototype.getSoundMode = function() {
- var result = native_.callSync('SoundManager_getSoundMode');
+ var result = native_.callSync('SoundManagerGetSoundMode');
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
if (args.volume < 0 || args.volume > 1) {
throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR);
}
- var result = native_.callSync('SoundManager_setVolume', args);
+ var result = native_.callSync('SoundManagerSetVolume', args);
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
{ name: 'type', type: types_.ENUM, values: Object.keys(SoundType) }
]);
- var result = native_.callSync('SoundManager_getVolume', args);
+ var result = native_.callSync('SoundManagerGetVolume', args);
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
_soundModeChangeListener = args.callback;
native_.addListener('SoundModeChangeListener', _soundModeChangeListenerCallback);
- var result = native_.callSync('SoundManager_setSoundModeChangeListener', {});
+ var result = native_.callSync('SoundManagerSetSoundModeChangeListener', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
SoundManager.prototype.unsetSoundModeChangeListener = function() {
native_.removeListener('SoundModeChangeListener', _soundModeChangeListenerCallback);
- var result = native_.callSync('SoundManager_unsetSoundModeChangeListener', {});
+ var result = native_.callSync('SoundManagerUnsetSoundModeChangeListener', {});
_soundModeChangeListener = undefined;
_volumeChangeListener = args.callback;
native_.addListener('VolumeChangeListener', _volumeChangeListenerCallback);
- var result = native_.callSync('SoundManager_setVolumeChangeListener', {});
+ var result = native_.callSync('SoundManagerSetVolumeChangeListener', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
SoundManager.prototype.unsetVolumeChangeListener = function() {
native_.removeListener('VolumeChangeListener', _volumeChangeListenerCallback);
- var result = native_.callSync('SoundManager_unsetVolumeChangeListener', {});
+ var result = native_.callSync('SoundManagerUnsetVolumeChangeListener', {});
_volumeChangeListener = undefined;
};
SoundManager.prototype.getConnectedDeviceList = function() {
- var result = native_.callSync('SoundManager_getConnectedDeviceList', {});
+ var result = native_.callSync('SoundManagerGetConnectedDeviceList', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
};
SoundManager.prototype.getActivatedDeviceList = function() {
- var result = native_.callSync('SoundManager_getActivatedDeviceList', {});
+ var result = native_.callSync('SoundManagerGetActivatedDeviceList', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
using std::placeholders::_1;
using std::placeholders::_2;
-#define REGISTER_SYNC(c, x) RegisterSyncHandler(c, std::bind(&SoundInstance::x, this, _1, _2));
- REGISTER_SYNC("SoundManager_setVolume", SoundManagerSetVolume);
- REGISTER_SYNC("SoundManager_unsetSoundModeChangeListener",
- SoundManagerUnsetSoundModeChangeListener);
- REGISTER_SYNC("SoundManager_getVolume", SoundManagerGetVolume);
- REGISTER_SYNC("SoundManager_unsetVolumeChangeListener", SoundManagerUnsetVolumeChangeListener);
- REGISTER_SYNC("SoundManager_setSoundModeChangeListener", SoundManagerSetSoundModeChangeListener);
- REGISTER_SYNC("SoundManager_setVolumeChangeListener", SoundManagerSetVolumeChangeListener);
- REGISTER_SYNC("SoundManager_getSoundMode", SoundManagerGetSoundMode);
- REGISTER_SYNC("SoundManager_getConnectedDeviceList", SoundManagerGetConnectedDeviceList);
- REGISTER_SYNC("SoundManager_getActivatedDeviceList", SoundManagerGetActivatedDeviceList);
- REGISTER_SYNC("SoundManager_addDeviceStateChangeListener",
- SoundManagerAddDeviceStateChangeListener);
- REGISTER_SYNC("SoundManager_removeDeviceStateChangeListener",
- SoundManagerRemoveDeviceStateChangeListener);
-#undef REGISTER_SYNC
+
+#define REGISTER_METHOD(M) \
+ RegisterSyncHandler(#M, std::bind(&SoundInstance::M, this, _1, _2))
+ REGISTER_METHOD(SoundManagerSetVolume);
+ REGISTER_METHOD(SoundManagerUnsetSoundModeChangeListener);
+ REGISTER_METHOD(SoundManagerGetVolume);
+ REGISTER_METHOD(SoundManagerUnsetVolumeChangeListener);
+ REGISTER_METHOD(SoundManagerSetSoundModeChangeListener);
+ REGISTER_METHOD(SoundManagerSetVolumeChangeListener);
+ REGISTER_METHOD(SoundManagerGetSoundMode);
+ REGISTER_METHOD(SoundManagerGetConnectedDeviceList);
+ REGISTER_METHOD(SoundManagerGetActivatedDeviceList);
+ REGISTER_METHOD(SoundManagerAddDeviceStateChangeListener);
+ REGISTER_METHOD(SoundManagerRemoveDeviceStateChangeListener);
+#undef REGISTER_METHOD
}
SoundInstance::~SoundInstance() {
function SystemInfoCameraFlash(data) {
var getBrightness = function() {
- var result = native_.callSync('SystemInfo_getBrightness', {});
+ var result = native_.callSync('SystemInfoGetBrightness', {});
if (native_.isSuccess(result)) {
return Converter_.toLong(native_.getResultObject(result)) / this.levels;
}
};
var getLevels = function() {
- var result = native_.callSync('SystemInfo_getMaxBrightness', {});
+ var result = native_.callSync('SystemInfoGetMaxBrightness', {});
if (native_.isSuccess(result)) {
return Converter_.toLong(native_.getResultObject(result));
}
);
args.brightness = args.brightness * this.levels;
- var result = native_.callSync('SystemInfo_setBrightness', args);
+ var result = native_.callSync('SystemInfoSetBrightness', args);
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
'from next release. Use getCapability() instead.'
);
- var result = native_.callSync('SystemInfo_getCapabilities', {});
+ var result = native_.callSync('SystemInfoGetCapabilities', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
}
]);
- var result = native_.callSync('SystemInfo_getCapability', { key: args.key });
+ var result = native_.callSync('SystemInfoGetCapability', { key: args.key });
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
};
SystemInfo.prototype.getPropertyValue = function() {
- getPropertyFunction('SystemInfo_getPropertyValue', _createProperty).apply(
+ getPropertyFunction('SystemInfoGetPropertyValue', _createProperty).apply(
this,
arguments
);
};
SystemInfo.prototype.getPropertyValueArray = function() {
- getPropertyFunction('SystemInfo_getPropertyValueArray', _createPropertyArray).apply(
+ getPropertyFunction('SystemInfoGetPropertyValueArray', _createPropertyArray).apply(
this,
arguments
);
var fail = false;
if (T_.isEmptyObject(callbacksMap)) {
//registration in C++ layer
- result = native_.callSync('SystemInfo_addPropertyValueChangeListener', {
+ result = native_.callSync('SystemInfoAddPropertyValueChangeListener', {
property: Converter_.toString(property)
});
fail = native_.isFailure(result);
delete callbacksMap[Number(watchId)];
if (T_.isEmptyObject(callbacksMap)) {
//unregistration in C++ layer
- result = native_.callSync('SystemInfo_removePropertyValueChangeListener', {
+ result = native_.callSync('SystemInfoRemovePropertyValueChangeListener', {
property: Converter_.toString(property)
});
if (native_.isFailure(result)) {
};
SystemInfo.prototype.getTotalMemory = function() {
- var result = native_.callSync('SystemInfo_getTotalMemory', {});
+ var result = native_.callSync('SystemInfoGetTotalMemory', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
};
SystemInfo.prototype.getAvailableMemory = function() {
- var result = native_.callSync('SystemInfo_getAvailableMemory', {});
+ var result = native_.callSync('SystemInfoGetAvailableMemory', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
}
]);
- var result = native_.callSync('SystemInfo_getCount', { property: args.property });
+ var result = native_.callSync('SystemInfoGetCount', { property: args.property });
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
using std::placeholders::_1;
using std::placeholders::_2;
-#define REGISTER_SYNC(c, x) RegisterSyncHandler(c, std::bind(&SysteminfoInstance::x, this, _1, _2));
- REGISTER_SYNC("SystemInfo_getCapabilities", GetCapabilities);
- REGISTER_SYNC("SystemInfo_getCapability", GetCapability);
- REGISTER_SYNC("SystemInfo_addPropertyValueChangeListener", AddPropertyValueChangeListener);
- REGISTER_SYNC("SystemInfo_removePropertyValueChangeListener", RemovePropertyValueChangeListener);
- REGISTER_SYNC("SystemInfo_getTotalMemory", GetTotalMemory);
- REGISTER_SYNC("SystemInfo_getAvailableMemory", GetAvailableMemory);
- REGISTER_SYNC("SystemInfo_getCount", GetCount);
- REGISTER_SYNC("SystemInfo_setBrightness", SetBrightness);
- REGISTER_SYNC("SystemInfo_getBrightness", GetBrightness);
- REGISTER_SYNC("SystemInfo_getMaxBrightness", GetMaxBrightness);
-
-#undef REGISTER_SYNC
-#define REGISTER_ASYNC(c, x) \
- RegisterSyncHandler(c, std::bind(&SysteminfoInstance::x, this, _1, _2));
- REGISTER_ASYNC("SystemInfo_getPropertyValue", GetPropertyValue);
- REGISTER_ASYNC("SystemInfo_getPropertyValueArray", GetPropertyValueArray);
-#undef REGISTER_ASYNC
+#define REGISTER_METHOD(M) \
+ RegisterSyncHandler(#M, std::bind(&SysteminfoInstance::M, this, _1, _2))
+ REGISTER_METHOD(SystemInfoGetCapabilities);
+ REGISTER_METHOD(SystemInfoGetCapability);
+ REGISTER_METHOD(SystemInfoAddPropertyValueChangeListener);
+ REGISTER_METHOD(SystemInfoRemovePropertyValueChangeListener);
+ REGISTER_METHOD(SystemInfoGetTotalMemory);
+ REGISTER_METHOD(SystemInfoGetAvailableMemory);
+ REGISTER_METHOD(SystemInfoGetCount);
+ REGISTER_METHOD(SystemInfoSetBrightness);
+ REGISTER_METHOD(SystemInfoGetBrightness);
+ REGISTER_METHOD(SystemInfoGetMaxBrightness);
+ REGISTER_METHOD(SystemInfoGetPropertyValue);
+ REGISTER_METHOD(SystemInfoGetPropertyValueArray);
+#undef REGISTER_METHOD
}
SysteminfoInstance::~SysteminfoInstance() {
ScopeLogger();
}
-void SysteminfoInstance::GetCapabilities(const picojson::value& args, picojson::object& out) {
+void SysteminfoInstance::SystemInfoGetCapabilities(const picojson::value& args, picojson::object& out) {
ScopeLogger();
LoggerW(
"DEPRECATION WARNING: getCapabilities() is deprecated and will be removed from next release. "
manager_.GetCapabilities(args, &out);
}
-void SysteminfoInstance::GetCapability(const picojson::value& args, picojson::object& out) {
+void SysteminfoInstance::SystemInfoGetCapability(const picojson::value& args, picojson::object& out) {
ScopeLogger();
manager_.GetCapability(args, &out);
}
-void SysteminfoInstance::GetPropertyValue(const picojson::value& args, picojson::object& out) {
+void SysteminfoInstance::SystemInfoGetPropertyValue(const picojson::value& args, picojson::object& out) {
ScopeLogger();
manager_.GetPropertyValue(args, &out);
}
-void SysteminfoInstance::GetPropertyValueArray(const picojson::value& args, picojson::object& out) {
+void SysteminfoInstance::SystemInfoGetPropertyValueArray(const picojson::value& args, picojson::object& out) {
ScopeLogger();
manager_.GetPropertyValueArray(args, &out);
}
-void SysteminfoInstance::AddPropertyValueChangeListener(const picojson::value& args,
+void SysteminfoInstance::SystemInfoAddPropertyValueChangeListener(const picojson::value& args,
picojson::object& out) {
ScopeLogger();
manager_.AddPropertyValueChangeListener(args, &out);
}
-void SysteminfoInstance::RemovePropertyValueChangeListener(const picojson::value& args,
+void SysteminfoInstance::SystemInfoRemovePropertyValueChangeListener(const picojson::value& args,
picojson::object& out) {
ScopeLogger();
manager_.RemovePropertyValueChangeListener(args, &out);
}
-void SysteminfoInstance::GetTotalMemory(const picojson::value& args, picojson::object& out) {
+void SysteminfoInstance::SystemInfoGetTotalMemory(const picojson::value& args, picojson::object& out) {
ScopeLogger();
manager_.GetTotalMemory(args, &out);
}
-void SysteminfoInstance::GetAvailableMemory(const picojson::value& args, picojson::object& out) {
+void SysteminfoInstance::SystemInfoGetAvailableMemory(const picojson::value& args, picojson::object& out) {
ScopeLogger();
manager_.GetAvailableMemory(args, &out);
}
-void SysteminfoInstance::GetCount(const picojson::value& args, picojson::object& out) {
+void SysteminfoInstance::SystemInfoGetCount(const picojson::value& args, picojson::object& out) {
ScopeLogger();
manager_.GetCount(args, &out);
}
-void SysteminfoInstance::SetBrightness(const picojson::value& args, picojson::object& out) {
+void SysteminfoInstance::SystemInfoSetBrightness(const picojson::value& args, picojson::object& out) {
ScopeLogger();
CHECK_PRIVILEGE_ACCESS(kPrivilegeLED, &out);
ReportSuccess(out);
}
-void SysteminfoInstance::GetBrightness(const picojson::value& args, picojson::object& out) {
+void SysteminfoInstance::SystemInfoGetBrightness(const picojson::value& args, picojson::object& out) {
ScopeLogger();
CHECK_PRIVILEGE_ACCESS(kPrivilegeLED, &out);
ReportSuccess(picojson::value(std::to_string(brightness)), out);
}
-void SysteminfoInstance::GetMaxBrightness(const picojson::value& args, picojson::object& out) {
+void SysteminfoInstance::SystemInfoGetMaxBrightness(const picojson::value& args, picojson::object& out) {
ScopeLogger();
CHECK_PRIVILEGE_ACCESS(kPrivilegeLED, &out);
virtual ~SysteminfoInstance();
private:
- void GetCapabilities(const picojson::value& args, picojson::object& out);
- void GetCapability(const picojson::value& args, picojson::object& out);
- void GetPropertyValue(const picojson::value& args, picojson::object& out);
- void GetPropertyValueArray(const picojson::value& args, picojson::object& out);
- void AddPropertyValueChangeListener(const picojson::value& args, picojson::object& out);
- void RemovePropertyValueChangeListener(const picojson::value& args, picojson::object& out);
- void GetMaxBrightness(const picojson::value& args, picojson::object& out);
- void GetBrightness(const picojson::value& args, picojson::object& out);
- void SetBrightness(const picojson::value& args, picojson::object& out);
- void GetTotalMemory(const picojson::value& args, picojson::object& out);
- void GetAvailableMemory(const picojson::value& args, picojson::object& out);
- void GetCount(const picojson::value& args, picojson::object& out);
+ void SystemInfoGetCapabilities(const picojson::value& args, picojson::object& out);
+ void SystemInfoGetCapability(const picojson::value& args, picojson::object& out);
+ void SystemInfoGetPropertyValue(const picojson::value& args, picojson::object& out);
+ void SystemInfoGetPropertyValueArray(const picojson::value& args, picojson::object& out);
+ void SystemInfoAddPropertyValueChangeListener(const picojson::value& args, picojson::object& out);
+ void SystemInfoRemovePropertyValueChangeListener(const picojson::value& args, picojson::object& out);
+ void SystemInfoGetMaxBrightness(const picojson::value& args, picojson::object& out);
+ void SystemInfoGetBrightness(const picojson::value& args, picojson::object& out);
+ void SystemInfoSetBrightness(const picojson::value& args, picojson::object& out);
+ void SystemInfoGetTotalMemory(const picojson::value& args, picojson::object& out);
+ void SystemInfoGetAvailableMemory(const picojson::value& args, picojson::object& out);
+ void SystemInfoGetCount(const picojson::value& args, picojson::object& out);
SysteminfoManager manager_;
};
type: args.type
};
- var result = native_.call('SystemSettingManager_getProperty', callArgs, callback);
+ var result = native_.call('SystemSettingManagerGetProperty', callArgs, callback);
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
value: args.value
};
- var result = native_.call('SystemSettingManager_setProperty', callArgs, callback);
+ var result = native_.call('SystemSettingManagerSetProperty', callArgs, callback);
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
using std::placeholders::_1;
using std::placeholders::_2;
-#define REGISTER(c, x) RegisterSyncHandler(c, std::bind(&SystemSettingInstance::x, this, _1, _2));
-
- REGISTER("SystemSettingManager_getProperty", getProperty);
- REGISTER("SystemSettingManager_setProperty", setProperty);
-
-#undef REGISTER
+#define REGISTER_METHOD(M) \
+ RegisterSyncHandler(#M, std::bind(&SystemSettingInstance::M, this, _1, _2))
+ REGISTER_METHOD(SystemSettingManagerGetProperty);
+ REGISTER_METHOD(SystemSettingManagerSetProperty);
+#undef REGISTER_METHOD
}
SystemSettingInstance::~SystemSettingInstance() {
ScopeLogger();
}
-void SystemSettingInstance::getProperty(const picojson::value& args, picojson::object& out) {
+void SystemSettingInstance::SystemSettingManagerGetProperty(const picojson::value& args, picojson::object& out) {
ScopeLogger();
const double callback_id = args.get("callbackId").get<double>();
}
}
-void SystemSettingInstance::setProperty(const picojson::value& args, picojson::object& out) {
+void SystemSettingInstance::SystemSettingManagerSetProperty(const picojson::value& args, picojson::object& out) {
ScopeLogger();
CHECK_PRIVILEGE_ACCESS(kPrivilegeSetting, &out);
virtual ~SystemSettingInstance();
private:
- void getProperty(const picojson::value& args, picojson::object& out);
+ void SystemSettingManagerGetProperty(const picojson::value& args, picojson::object& out);
common::PlatformResult getPlatformPropertyValue(const std::string& valueType,
picojson::value* out);
- void setProperty(const picojson::value& args, picojson::object& out);
+ void SystemSettingManagerSetProperty(const picojson::value& args, picojson::object& out);
common::PlatformResult setPlatformPropertyValue(const std::string& settingType,
const std::string& settingValue);
};
timezone: converter_.toString(tzName),
timestamp: converter_.toString(timestamp)
};
- var result = native_.callSync('TZDate_getTimezoneOffset', callArgs);
+ var result = native_.callSync('TZDateGetTimezoneOffset', callArgs);
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
tizen.TZDate.prototype.toLocaleDateString = function() {
utils_.log('Entered TZDate.toLocaleDateString');
- var result = native_.callSync('TZDate_toLocaleDateString', {
+ var result = native_.callSync('TZDateToLocaleDateString', {
timezone: String(this._timezoneName),
timestamp: String(this._utcTimestamp)
});
tizen.TZDate.prototype.toLocaleTimeString = function() {
utils_.log('Entered TZDate.toLocaleTimeString');
- var result = native_.callSync('TZDate_toLocaleTimeString', {
+ var result = native_.callSync('TZDateToLocaleTimeString', {
timezone: String(this._timezoneName),
timestamp: String(this._utcTimestamp)
});
tizen.TZDate.prototype.toLocaleString = function() {
utils_.log('Entered TZDate.toLocaleString');
- var result = native_.callSync('TZDate_toLocaleString', {
+ var result = native_.callSync('TZDateToLocaleString', {
timezone: String(this._timezoneName),
timestamp: String(this._utcTimestamp)
});
tizen.TZDate.prototype.toDateString = function() {
utils_.log('Entered TZDate.toDateString');
- var result = native_.callSync('TZDate_toDateString', {
+ var result = native_.callSync('TZDateToDateString', {
timezone: String(this._timezoneName),
timestamp: String(this._utcTimestamp)
});
tizen.TZDate.prototype.toTimeString = function() {
utils_.log('Entered TZDate.toTimeString');
- var result = native_.callSync('TZDate_toTimeString', {
+ var result = native_.callSync('TZDateToTimeString', {
timezone: String(this._timezoneName),
timestamp: String(this._utcTimestamp)
});
tizen.TZDate.prototype.toString = function() {
utils_.log('Entered TZDate.toString');
- var result = native_.callSync('TZDate_toString', {
+ var result = native_.callSync('TZDateToString', {
timezone: String(this._timezoneName),
timestamp: String(this._utcTimestamp)
});
'removed from next release.'
);
- var result = native_.callSync('TZDate_getTimezoneAbbreviation', {
+ var result = native_.callSync('TZDateGetTimezoneAbbreviation', {
timezone: String(this._timezoneName),
timestamp: String(this._utcTimestamp)
});
tizen.TZDate.prototype.isDST = function() {
utils_.log('Entered TZDate.isDST');
- var result = native_.callSync('TZDate_isDST', {
+ var result = native_.callSync('TZDateIsDST', {
timezone: String(this._timezoneName),
timestamp: String(this._utcTimestamp)
});
tizen.TZDate.prototype.getPreviousDSTTransition = function() {
utils_.log('Entered TZDate.getPreviousDSTTransition');
- var result = native_.callSync('TZDate_getPreviousDSTTransition', {
+ var result = native_.callSync('TZDateGetPreviousDSTTransition', {
timezone: String(this._timezoneName),
timestamp: String(this._utcTimestamp)
});
tizen.TZDate.prototype.getNextDSTTransition = function() {
utils_.log('Entered TZDate.getNextDSTTransition');
- var result = native_.callSync('TZDate_getNextDSTTransition', {
+ var result = native_.callSync('TZDateGetNextDSTTransition', {
timezone: String(this._timezoneName),
timestamp: String(this._utcTimestamp)
});
exports.getLocalTimezone = function() {
utils_.log('Entered TimeUtil.getLocalTimezone');
- var result = native_.callSync('TZDate_getLocalTimezone', {});
+ var result = native_.callSync('TZDateGetLocalTimezone', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
exports.getAvailableTimezones = function() {
utils_.log('Entered TimeUtil.getAvailableTimezones');
if (_availableTimezones.length === 0) {
- var result = native_.callSync('TimeUtil_getAvailableTimezones', {});
+ var result = native_.callSync('TimeUtilGetAvailableTimezones', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
args.shortformat = false;
}
- var result = native_.callSync('TimeUtil_getDateFormat', {
+ var result = native_.callSync('TimeUtilGetDateFormat', {
shortformat: args.shortformat
});
if (native_.isFailure(result)) {
exports.getTimeFormat = function() {
utils_.log('Entered TimeUtil.getTimeFormat');
- var result = native_.callSync('TimeUtil_getTimeFormat', {});
+ var result = native_.callSync('TimeUtilGetTimeFormat', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
type: validator_.Types.FUNCTION
}
]);
- var result = native_.callSync('TimeUtil_setDateTimeChangeListener', {});
+ var result = native_.callSync('TimeUtilSetDateTimeChangeListener', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
exports.unsetDateTimeChangeListener = function() {
utils_.log('Entered TimeUtil.unsetDateTimeChangeListener');
- var result = native_.callSync('TimeUtil_unsetDateTimeChangeListener', {});
+ var result = native_.callSync('TimeUtilUnsetDateTimeChangeListener', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
type: validator_.Types.FUNCTION
}
]);
- var result = native_.callSync('TimeUtil_setTimezoneChangeListener', {});
+ var result = native_.callSync('TimeUtilSetTimezoneChangeListener', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
exports.unsetTimezoneChangeListener = function() {
utils_.log('Entered TimeUtil.unsetTimezoneChangeListener');
native_.removeListener('TimezoneChangeListener');
- var result = native_.callSync('TimeUtil_unsetTimezoneChangeListener', {});
+ var result = native_.callSync('TimeUtilUnsetTimezoneChangeListener', {});
_timeUtilTimezoneChangeListener = undefined;
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
using namespace common;
TimeInstance::TimeInstance() : manager_(this) {
+ ScopeLogger();
+
using std::placeholders::_1;
using std::placeholders::_2;
- ScopeLogger();
-
-#define REGISTER_SYNC(c, x) RegisterSyncHandler(c, std::bind(&TimeInstance::x, this, _1, _2));
-#define REGISTER_ASYNC(c, x) RegisterSyncHandler(c, std::bind(&TimeInstance::x, this, _1, _2));
-
- REGISTER_SYNC("TimeUtil_getAvailableTimezones", TimeUtil_getAvailableTimezones);
- REGISTER_SYNC("TimeUtil_getDateFormat", TimeUtil_getDateFormat);
- REGISTER_SYNC("TimeUtil_getTimeFormat", TimeUtil_getTimeFormat);
- REGISTER_SYNC("TimeUtil_setDateTimeChangeListener", TimeUtil_setDateTimeChangeListener);
- REGISTER_SYNC("TimeUtil_unsetDateTimeChangeListener", TimeUtil_unsetDateTimeChangeListener);
- REGISTER_SYNC("TimeUtil_setTimezoneChangeListener", TimeUtil_setTimezoneChangeListener);
- REGISTER_SYNC("TimeUtil_unsetTimezoneChangeListener", TimeUtil_unsetTimezoneChangeListener);
- REGISTER_SYNC("TZDate_getLocalTimezone", TZDate_getLocalTimezone);
- REGISTER_SYNC("TZDate_getTimezoneOffset", TZDate_GetTimezoneOffset);
- REGISTER_SYNC("TZDate_toLocaleDateString", TZDate_toLocaleDateString);
- REGISTER_SYNC("TZDate_toLocaleTimeString", TZDate_toLocaleTimeString);
- REGISTER_SYNC("TZDate_toLocaleString", TZDate_toLocaleString);
- REGISTER_SYNC("TZDate_toDateString", TZDate_toDateString);
- REGISTER_SYNC("TZDate_toTimeString", TZDate_toTimeString);
- REGISTER_SYNC("TZDate_toString", TZDate_toString);
- REGISTER_SYNC("TZDate_getTimezoneAbbreviation", TZDate_getTimezoneAbbreviation);
- REGISTER_SYNC("TZDate_isDST", TZDate_isDST);
- REGISTER_SYNC("TZDate_getPreviousDSTTransition", TZDate_getPreviousDSTTransition);
- REGISTER_SYNC("TZDate_getNextDSTTransition", TZDate_getNextDSTTransition);
-
-#undef REGISTER_SYNC
-#undef REGISTER_ASYNC
+#define REGISTER_METHOD(M) \
+ RegisterSyncHandler(#M, std::bind(&TimeInstance::M, this, _1, _2))
+ REGISTER_METHOD(TimeUtilGetAvailableTimezones);
+ REGISTER_METHOD(TimeUtilGetDateFormat);
+ REGISTER_METHOD(TimeUtilGetTimeFormat);
+ REGISTER_METHOD(TimeUtilSetDateTimeChangeListener);
+ REGISTER_METHOD(TimeUtilUnsetDateTimeChangeListener);
+ REGISTER_METHOD(TimeUtilSetTimezoneChangeListener);
+ REGISTER_METHOD(TimeUtilUnsetTimezoneChangeListener);
+ REGISTER_METHOD(TZDateGetLocalTimezone);
+ REGISTER_METHOD(TZDateGetTimezoneOffset);
+ REGISTER_METHOD(TZDateToLocaleDateString);
+ REGISTER_METHOD(TZDateToLocaleTimeString);
+ REGISTER_METHOD(TZDateToLocaleString);
+ REGISTER_METHOD(TZDateToDateString);
+ REGISTER_METHOD(TZDateToTimeString);
+ REGISTER_METHOD(TZDateToString);
+ REGISTER_METHOD(TZDateGetTimezoneAbbreviation);
+ REGISTER_METHOD(TZDateIsDST);
+ REGISTER_METHOD(TZDateGetPreviousDSTTransition);
+ REGISTER_METHOD(TZDateGetNextDSTTransition);
+#undef REGISTER_METHOD
}
TimeInstance::~TimeInstance() {
ScopeLogger();
}
-void TimeInstance::TimeUtil_getAvailableTimezones(const picojson::value& /*args*/,
+void TimeInstance::TimeUtilGetAvailableTimezones(const picojson::value& /*args*/,
picojson::object& out) {
ScopeLogger();
picojson::value result = picojson::value(picojson::object());
ReportSuccess(result, out);
}
-void TimeInstance::TimeUtil_getDateFormat(const picojson::value& args, picojson::object& out) {
+void TimeInstance::TimeUtilGetDateFormat(const picojson::value& args, picojson::object& out) {
ScopeLogger();
if (!args.contains("shortformat")) {
LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed."),
ReportSuccess(result, out);
}
-void TimeInstance::TimeUtil_getTimeFormat(const picojson::value& /* args */,
+void TimeInstance::TimeUtilGetTimeFormat(const picojson::value& /* args */,
picojson::object& out) {
ScopeLogger();
std::string format;
ReportSuccess(result, out);
}
-void TimeInstance::TimeUtil_setDateTimeChangeListener(const picojson::value& /*args*/,
+void TimeInstance::TimeUtilSetDateTimeChangeListener(const picojson::value& /*args*/,
picojson::object& out) {
ScopeLogger();
PlatformResult res = manager_.RegisterVconfCallback(kTimeChange);
ReportSuccess(out);
}
-void TimeInstance::TimeUtil_unsetDateTimeChangeListener(const picojson::value& /*args*/,
+void TimeInstance::TimeUtilUnsetDateTimeChangeListener(const picojson::value& /*args*/,
picojson::object& out) {
ScopeLogger();
PlatformResult res = manager_.UnregisterVconfCallback(kTimeChange);
ReportSuccess(out);
}
-void TimeInstance::TimeUtil_setTimezoneChangeListener(const picojson::value& /*args*/,
+void TimeInstance::TimeUtilSetTimezoneChangeListener(const picojson::value& /*args*/,
picojson::object& out) {
ScopeLogger();
PlatformResult res = manager_.RegisterVconfCallback(kTimezoneChange);
ReportSuccess(out);
}
-void TimeInstance::TimeUtil_unsetTimezoneChangeListener(const picojson::value& /*args*/,
+void TimeInstance::TimeUtilUnsetTimezoneChangeListener(const picojson::value& /*args*/,
picojson::object& out) {
ScopeLogger();
PlatformResult res = manager_.UnregisterVconfCallback(kTimezoneChange);
ReportSuccess(out);
}
-void TimeInstance::TZDate_getLocalTimezone(const picojson::value& /*args*/, picojson::object& out) {
+void TimeInstance::TZDateGetLocalTimezone(const picojson::value& /*args*/, picojson::object& out) {
ScopeLogger();
std::string local_timezone = TimeManager::GetDefaultTimezone();
ReportSuccess(result, out);
}
-void TimeInstance::TZDate_GetTimezoneOffset(const picojson::value& args, picojson::object& out) {
+void TimeInstance::TZDateGetTimezoneOffset(const picojson::value& args, picojson::object& out) {
ScopeLogger();
if (!args.contains("timezone") || !args.contains("timestamp")) {
LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed."),
ReportSuccess(result, *out);
}
-void TimeInstance::TZDate_toLocaleDateString(const picojson::value& args, picojson::object& out) {
+void TimeInstance::TZDateToLocaleDateString(const picojson::value& args, picojson::object& out) {
ScopeLogger();
ToStringTemplate(args, true, TimeUtilTools::DateTimeFormatType::kDateFormat, &out);
}
-void TimeInstance::TZDate_toLocaleTimeString(const picojson::value& args, picojson::object& out) {
+void TimeInstance::TZDateToLocaleTimeString(const picojson::value& args, picojson::object& out) {
ScopeLogger();
ToStringTemplate(args, true, TimeUtilTools::DateTimeFormatType::kTimeFormat, &out);
}
-void TimeInstance::TZDate_toLocaleString(const picojson::value& args, picojson::object& out) {
+void TimeInstance::TZDateToLocaleString(const picojson::value& args, picojson::object& out) {
ScopeLogger();
ToStringTemplate(args, true, TimeUtilTools::DateTimeFormatType::kDateTimeFormat, &out);
}
-void TimeInstance::TZDate_toDateString(const picojson::value& args, picojson::object& out) {
+void TimeInstance::TZDateToDateString(const picojson::value& args, picojson::object& out) {
ScopeLogger();
ToStringTemplate(args, false, TimeUtilTools::DateTimeFormatType::kDateFormat, &out);
}
-void TimeInstance::TZDate_toTimeString(const picojson::value& args, picojson::object& out) {
+void TimeInstance::TZDateToTimeString(const picojson::value& args, picojson::object& out) {
ScopeLogger();
ToStringTemplate(args, false, TimeUtilTools::DateTimeFormatType::kTimeFormat, &out);
}
-void TimeInstance::TZDate_toString(const picojson::value& args, picojson::object& out) {
+void TimeInstance::TZDateToString(const picojson::value& args, picojson::object& out) {
ScopeLogger();
ToStringTemplate(args, false, TimeUtilTools::DateTimeFormatType::kDateTimeFormat, &out);
}
-void TimeInstance::TZDate_getTimezoneAbbreviation(const picojson::value& args,
+void TimeInstance::TZDateGetTimezoneAbbreviation(const picojson::value& args,
picojson::object& out) {
ScopeLogger();
LoggerW(
ReportSuccess(result, out);
}
-void TimeInstance::TZDate_isDST(const picojson::value& args, picojson::object& out) {
+void TimeInstance::TZDateIsDST(const picojson::value& args, picojson::object& out) {
ScopeLogger();
if (!args.contains("timezone") || !args.contains("timestamp")) {
LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed."),
ReportSuccess(result, out);
}
-void TimeInstance::TZDate_getPreviousDSTTransition(const picojson::value& args,
+void TimeInstance::TZDateGetPreviousDSTTransition(const picojson::value& args,
picojson::object& out) {
ScopeLogger();
if (!args.contains("timezone") || !args.contains("timestamp")) {
ReportSuccess(result, out);
}
-void TimeInstance::TZDate_getNextDSTTransition(const picojson::value& args, picojson::object& out) {
+void TimeInstance::TZDateGetNextDSTTransition(const picojson::value& args, picojson::object& out) {
ScopeLogger();
if (!args.contains("timezone") || !args.contains("timestamp")) {
LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed."),
virtual ~TimeInstance();
private:
- void TimeUtil_getAvailableTimezones(const picojson::value& args, picojson::object& out);
- void TimeUtil_getDateFormat(const picojson::value& args, picojson::object& out);
- void TimeUtil_getTimeFormat(const picojson::value& args, picojson::object& out);
- void TimeUtil_setDateTimeChangeListener(const picojson::value& args, picojson::object& out);
- void TimeUtil_unsetDateTimeChangeListener(const picojson::value& args, picojson::object& out);
- void TimeUtil_setTimezoneChangeListener(const picojson::value& args, picojson::object& out);
- void TimeUtil_unsetTimezoneChangeListener(const picojson::value& args, picojson::object& out);
- void TZDate_getLocalTimezone(const picojson::value& args, picojson::object& out);
- void TZDate_GetTimezoneOffset(const picojson::value& args, picojson::object& out);
+ void TimeUtilGetAvailableTimezones(const picojson::value& args, picojson::object& out);
+ void TimeUtilGetDateFormat(const picojson::value& args, picojson::object& out);
+ void TimeUtilGetTimeFormat(const picojson::value& args, picojson::object& out);
+ void TimeUtilSetDateTimeChangeListener(const picojson::value& args, picojson::object& out);
+ void TimeUtilUnsetDateTimeChangeListener(const picojson::value& args, picojson::object& out);
+ void TimeUtilSetTimezoneChangeListener(const picojson::value& args, picojson::object& out);
+ void TimeUtilUnsetTimezoneChangeListener(const picojson::value& args, picojson::object& out);
+ void TZDateGetLocalTimezone(const picojson::value& args, picojson::object& out);
+ void TZDateGetTimezoneOffset(const picojson::value& args, picojson::object& out);
void ToStringTemplate(const picojson::value& args, bool use_locale_fmt,
TimeUtilTools::DateTimeFormatType type, picojson::object* out);
- void TZDate_toLocaleDateString(const picojson::value& args, picojson::object& out);
- void TZDate_toLocaleTimeString(const picojson::value& args, picojson::object& out);
- void TZDate_toLocaleString(const picojson::value& args, picojson::object& out);
- void TZDate_toDateString(const picojson::value& args, picojson::object& out);
- void TZDate_toTimeString(const picojson::value& args, picojson::object& out);
- void TZDate_toString(const picojson::value& args, picojson::object& out);
- void TZDate_getTimezoneAbbreviation(const picojson::value& args, picojson::object& out);
- void TZDate_isDST(const picojson::value& args, picojson::object& out);
- void TZDate_getPreviousDSTTransition(const picojson::value& args, picojson::object& out);
- void TZDate_getNextDSTTransition(const picojson::value& args, picojson::object& out);
+ void TZDateToLocaleDateString(const picojson::value& args, picojson::object& out);
+ void TZDateToLocaleTimeString(const picojson::value& args, picojson::object& out);
+ void TZDateToLocaleString(const picojson::value& args, picojson::object& out);
+ void TZDateToDateString(const picojson::value& args, picojson::object& out);
+ void TZDateToTimeString(const picojson::value& args, picojson::object& out);
+ void TZDateToString(const picojson::value& args, picojson::object& out);
+ void TZDateGetTimezoneAbbreviation(const picojson::value& args, picojson::object& out);
+ void TZDateIsDST(const picojson::value& args, picojson::object& out);
+ void TZDateGetPreviousDSTTransition(const picojson::value& args, picojson::object& out);
+ void TZDateGetNextDSTTransition(const picojson::value& args, picojson::object& out);
TimeManager manager_;
};
};
Utils.prototype.getPkgApiVersion = function() {
- var result = native_.callSync('Utils_getPkgApiVersion');
+ var result = native_.callSync('UtilsGetPkgApiVersion');
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
throw new WebAPIException(WebAPIException.SECURITY_ERR);
}
- var result = native_.callSync('Utils_checkPrivilegeAccess', {
+ var result = native_.callSync('UtilsCheckPrivilegeAccess', {
privilege: _toString(privilege)
});
current_privilege,
previous_privilege
) {
- var result = native_.callSync('Utils_checkBackwardCompabilityPrivilegeAccess', {
+ var result = native_.callSync('UtilsCheckBackwardCompabilityPrivilegeAccess', {
current_privilege: _toString(current_privilege),
previous_privilege: _toString(previous_privilege)
});
};
Utils.prototype.checkProfile = function() {
- var result = native_.callSync('Utils_checkProfile', {});
+ var result = native_.callSync('UtilsCheckProfile', {});
return native_.getResultObject(result);
};
// of requested val. We're converting the val to signed long and then pass it
// to C++ to get the value in required range.
return native_.getResultObject(
- native_.callSync('Utils_toLongLong', {
+ native_.callSync('UtilsToLongLong', {
n: _toLong(val)
})
);
// of requested val. We're converting the val to signed long and then pass it
// to C++ to get the value in required range.
return native_.getResultObject(
- native_.callSync('Utils_toUnsignedLongLong', {
+ native_.callSync('UtilsToUnsignedLongLong', {
n: _toLong(val)
})
);
namespace utils {
UtilsInstance::UtilsInstance() {
+ ScopeLogger();
using std::placeholders::_1;
using std::placeholders::_2;
- ScopeLogger();
-#define REGISTER_SYNC(c, x) RegisterSyncHandler(c, std::bind(&UtilsInstance::x, this, _1, _2));
-#define REGISTER_ASYNC(c, x) RegisterSyncHandler(c, std::bind(&UtilsInstance::x, this, _1, _2));
-
- REGISTER_SYNC("Utils_getPkgApiVersion", GetPkgApiVersion);
- REGISTER_SYNC("Utils_checkPrivilegeAccess", CheckPrivilegeAccess);
- REGISTER_SYNC("Utils_checkBackwardCompabilityPrivilegeAccess",
- CheckBackwardCompabilityPrivilegeAccess);
- REGISTER_SYNC("Utils_toLongLong", ToLongLong);
- REGISTER_SYNC("Utils_toUnsignedLongLong", ToUnsignedLongLong);
- REGISTER_SYNC("Utils_checkProfile", CheckProfile);
-
-#undef REGISTER_SYNC
-#undef REGISTER_ASYNC
+#define REGISTER_METHOD(M) \
+ RegisterSyncHandler(#M, std::bind(&UtilsInstance::M, this, _1, _2))
+ REGISTER_METHOD(UtilsGetPkgApiVersion);
+ REGISTER_METHOD(UtilsCheckPrivilegeAccess);
+ REGISTER_METHOD(UtilsCheckBackwardCompabilityPrivilegeAccess);
+ REGISTER_METHOD(UtilsToLongLong);
+ REGISTER_METHOD(UtilsToUnsignedLongLong);
+ REGISTER_METHOD(UtilsCheckProfile);
+#undef REGISTER_METHOD
}
-void UtilsInstance::GetPkgApiVersion(const picojson::value& args, picojson::object& out) {
+void UtilsInstance::UtilsGetPkgApiVersion(const picojson::value& args, picojson::object& out) {
ScopeLogger();
std::string api_version;
ReportSuccess(picojson::value(api_version), out);
}
-void UtilsInstance::CheckPrivilegeAccess(const picojson::value& args, picojson::object& out) {
+void UtilsInstance::UtilsCheckPrivilegeAccess(const picojson::value& args, picojson::object& out) {
ScopeLogger();
const auto& privilege = args.get("privilege").to_str();
CHECK_PRIVILEGE_ACCESS(privilege, &out);
ReportSuccess(out);
}
-void UtilsInstance::CheckBackwardCompabilityPrivilegeAccess(const picojson::value& args,
+void UtilsInstance::UtilsCheckBackwardCompabilityPrivilegeAccess(const picojson::value& args,
picojson::object& out) {
ScopeLogger();
const auto& current_priv = args.get("current_privilege").to_str();
} // namespace
-void UtilsInstance::ToLongLong(const picojson::value& args, picojson::object& out) {
+void UtilsInstance::UtilsToLongLong(const picojson::value& args, picojson::object& out) {
ScopeLogger();
const auto& n = args.get("n");
ReportSuccess(picojson::value(static_cast<double>(output)), out);
}
-void UtilsInstance::ToUnsignedLongLong(const picojson::value& args, picojson::object& out) {
+void UtilsInstance::UtilsToUnsignedLongLong(const picojson::value& args, picojson::object& out) {
ScopeLogger();
const auto& n = args.get("n");
ReportSuccess(picojson::value(static_cast<double>(output)), out);
}
-void UtilsInstance::CheckProfile(const picojson::value& args, picojson::object& out) {
+void UtilsInstance::UtilsCheckProfile(const picojson::value& args, picojson::object& out) {
ScopeLogger();
std::string profile = "common";
}
private:
- void GetPkgApiVersion(const picojson::value& args, picojson::object& out);
- void CheckPrivilegeAccess(const picojson::value& args, picojson::object& out);
- void CheckBackwardCompabilityPrivilegeAccess(const picojson::value& args, picojson::object& out);
+ void UtilsGetPkgApiVersion(const picojson::value& args, picojson::object& out);
+ void UtilsCheckPrivilegeAccess(const picojson::value& args, picojson::object& out);
+ void UtilsCheckBackwardCompabilityPrivilegeAccess(const picojson::value& args, picojson::object& out);
- void ToLongLong(const picojson::value& args, picojson::object& out);
- void ToUnsignedLongLong(const picojson::value& args, picojson::object& out);
- void CheckProfile(const picojson::value& args, picojson::object& out);
+ void UtilsToLongLong(const picojson::value& args, picojson::object& out);
+ void UtilsToUnsignedLongLong(const picojson::value& args, picojson::object& out);
+ void UtilsCheckProfile(const picojson::value& args, picojson::object& out);
};
} // namespace utils
} // namespace extension
function VoiceControlClientManager() {}
VoiceControlClientManager.prototype.getVoiceControlClient = function() {
- var result = native_.callSync('VoiceControlClientManager_getVoiceControlClient', {});
+ var result = native_.callSync('VoiceControlClientManagerGetVoiceControlClient', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
function VoiceControlClient() {}
VoiceControlClient.prototype.getCurrentLanguage = function() {
- var result = native_.callSync('VoiceControlClient_getCurrentLanguage', {});
+ var result = native_.callSync('VoiceControlClientGetCurrentLanguage', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
type: args.type
};
- var result = native_.callSync('VoiceControlClient_setCommandList', data);
+ var result = native_.callSync('VoiceControlClientSetCommandList', data);
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
args.type = VoiceControlCommandType.FOREGROUND;
}
- var result = native_.callSync('VoiceControlClient_unsetCommandList', {
+ var result = native_.callSync('VoiceControlClientUnsetCommandList', {
type: args.type
});
return VcResultListener.addListener(
args.listener,
- 'VoiceControlClient_addResultListener'
+ 'VoiceControlClientAddResultListener'
);
};
var args = validator_.validateArgs(arguments, [{ name: 'id', type: types_.LONG }]);
- VcResultListener.removeListener(args.id, 'VoiceControlClient_removeResultListener');
+ VcResultListener.removeListener(args.id, 'VoiceControlClientRemoveResultListener');
};
VoiceControlClient.prototype.addLanguageChangeListener = function(listener) {
return VcLangListener.addListener(
args.listener,
- 'VoiceControlClient_addLanguageChangeListener'
+ 'VoiceControlClientAddLanguageChangeListener'
);
};
VcLangListener.removeListener(
args.id,
- 'VoiceControlClient_removeLanguageChangeListener'
+ 'VoiceControlClientRemoveLanguageChangeListener'
);
};
VoiceControlClient.prototype.release = function() {
- var result = native_.callSync('VoiceControlClient_release', {});
+ var result = native_.callSync('VoiceControlClientRelease', {});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
VoiceControlInstance::VoiceControlInstance() : voice_control_client() {
ScopeLogger();
using namespace std::placeholders;
-#define REGISTER_SYNC(c, x) \
- RegisterSyncHandler(c, std::bind(&VoiceControlInstance::x, this, _1, _2));
- REGISTER_SYNC("VoiceControlClient_getCurrentLanguage", GetCurrentLanguage);
- REGISTER_SYNC("VoiceControlClient_setCommandList", SetCommandList);
- REGISTER_SYNC("VoiceControlClient_unsetCommandList", UnsetCommandList);
- REGISTER_SYNC("VoiceControlClient_addResultListener", AddResultListener);
- REGISTER_SYNC("VoiceControlClient_removeResultListener", RemoveResultListener);
- REGISTER_SYNC("VoiceControlClient_addLanguageChangeListener", AddLanguageChangeListener);
- REGISTER_SYNC("VoiceControlClient_removeLanguageChangeListener", RemoveLanguageChangeListener);
- REGISTER_SYNC("VoiceControlClient_release", Release);
- REGISTER_SYNC("VoiceControlClientManager_getVoiceControlClient", GetVoiceControlClient);
-#undef REGISTER_SYNC
+
+#define REGISTER_METHOD(M) \
+ RegisterSyncHandler(#M, std::bind(&VoiceControlInstance::M, this, _1, _2))
+ REGISTER_METHOD(VoiceControlClientGetCurrentLanguage);
+ REGISTER_METHOD(VoiceControlClientSetCommandList);
+ REGISTER_METHOD(VoiceControlClientUnsetCommandList);
+ REGISTER_METHOD(VoiceControlClientAddResultListener);
+ REGISTER_METHOD(VoiceControlClientRemoveResultListener);
+ REGISTER_METHOD(VoiceControlClientAddLanguageChangeListener);
+ REGISTER_METHOD(VoiceControlClientRemoveLanguageChangeListener);
+ REGISTER_METHOD(VoiceControlClientRelease);
+ REGISTER_METHOD(VoiceControlClientManagerGetVoiceControlClient);
+#undef REGISTER_METHOD
}
VoiceControlInstance::~VoiceControlInstance() {
return; \
}
-void VoiceControlInstance::GetVoiceControlClient(const picojson::value& args,
+void VoiceControlInstance::VoiceControlClientManagerGetVoiceControlClient(const picojson::value& args,
picojson::object& out) {
ScopeLogger();
ReportSuccess(out);
}
-void VoiceControlInstance::Release(const picojson::value& args, picojson::object& out) {
+void VoiceControlInstance::VoiceControlClientRelease(const picojson::value& args, picojson::object& out) {
ScopeLogger();
int ret = VC_ERROR_NONE;
ReportSuccess(out);
}
-void VoiceControlInstance::GetCurrentLanguage(const picojson::value& args, picojson::object& out) {
+void VoiceControlInstance::VoiceControlClientGetCurrentLanguage(const picojson::value& args, picojson::object& out) {
ScopeLogger();
std::string language;
}
}
-void VoiceControlInstance::SetCommandList(const picojson::value& args, picojson::object& out) {
+void VoiceControlInstance::VoiceControlClientSetCommandList(const picojson::value& args, picojson::object& out) {
ScopeLogger();
CHECK_PRIVILEGE_ACCESS(kPrivilegeVoiceControl, &out);
}
}
-void VoiceControlInstance::UnsetCommandList(const picojson::value& args, picojson::object& out) {
+void VoiceControlInstance::VoiceControlClientUnsetCommandList(const picojson::value& args, picojson::object& out) {
ScopeLogger();
CHECK_PRIVILEGE_ACCESS(kPrivilegeVoiceControl, &out);
}
}
-void VoiceControlInstance::AddResultListener(const picojson::value& args, picojson::object& out) {
+void VoiceControlInstance::VoiceControlClientAddResultListener(const picojson::value& args, picojson::object& out) {
ScopeLogger();
common::PlatformResult result = voice_control_client.AddResultListener();
}
}
-void VoiceControlInstance::RemoveResultListener(const picojson::value& args,
+void VoiceControlInstance::VoiceControlClientRemoveResultListener(const picojson::value& args,
picojson::object& out) {
ScopeLogger();
}
}
-void VoiceControlInstance::AddLanguageChangeListener(const picojson::value& args,
+void VoiceControlInstance::VoiceControlClientAddLanguageChangeListener(const picojson::value& args,
picojson::object& out) {
ScopeLogger();
}
}
-void VoiceControlInstance::RemoveLanguageChangeListener(const picojson::value& args,
+void VoiceControlInstance::VoiceControlClientRemoveLanguageChangeListener(const picojson::value& args,
picojson::object& out) {
ScopeLogger();
virtual ~VoiceControlInstance();
private:
- void GetVoiceControlClient(const picojson::value& args, picojson::object& out);
- void Release(const picojson::value& args, picojson::object& out);
-
- void GetCurrentLanguage(const picojson::value& args, picojson::object& out);
- void SetCommandList(const picojson::value& args, picojson::object& out);
- void UnsetCommandList(const picojson::value& args, picojson::object& out);
- void AddResultListener(const picojson::value& args, picojson::object& out);
- void RemoveResultListener(const picojson::value& args, picojson::object& out);
- void AddLanguageChangeListener(const picojson::value& args, picojson::object& out);
- void RemoveLanguageChangeListener(const picojson::value& args, picojson::object& out);
+ void VoiceControlClientManagerGetVoiceControlClient(const picojson::value& args, picojson::object& out);
+ void VoiceControlClientRelease(const picojson::value& args, picojson::object& out);
+
+ void VoiceControlClientGetCurrentLanguage(const picojson::value& args, picojson::object& out);
+ void VoiceControlClientSetCommandList(const picojson::value& args, picojson::object& out);
+ void VoiceControlClientUnsetCommandList(const picojson::value& args, picojson::object& out);
+ void VoiceControlClientAddResultListener(const picojson::value& args, picojson::object& out);
+ void VoiceControlClientRemoveResultListener(const picojson::value& args, picojson::object& out);
+ void VoiceControlClientAddLanguageChangeListener(const picojson::value& args, picojson::object& out);
+ void VoiceControlClientRemoveLanguageChangeListener(const picojson::value& args, picojson::object& out);
static void VcLanguageChangedCb(const char* previous, const char* current, void* user_data);
static void VcResultCb(vc_result_event_e event, vc_cmd_list_h cmd_list, const char* result,
callArgs.instanceId = this.id;
callArgs.seconds = args.seconds;
- var ret = native.callSync('WidgetInstance_changeUpdatePeriod', callArgs);
+ var ret = native.callSync('WidgetInstanceChangeUpdatePeriod', callArgs);
if (native.isFailure(ret)) {
throw native.getErrorObject(ret);
callArgs.data = args.data;
callArgs.updateIfPaused = args.updateIfPaused;
- var ret = native.callSync('WidgetInstance_sendContent', callArgs);
+ var ret = native.callSync('WidgetInstanceSendContent', callArgs);
if (native.isFailure(ret)) {
throw native.getErrorObject(ret);
}
};
- var result = native.call('WidgetInstance_getContent', callArgs, callback);
+ var result = native.call('WidgetInstanceGetContent', callArgs, callback);
if (native.isFailure(result)) {
throw native.getErrorObject(result);
}
callArgs.locale = args.locale;
}
- var ret = native.callSync('Widget_getName', callArgs);
+ var ret = native.callSync('WidgetGetName', callArgs);
if (native.isFailure(ret)) {
throw native.getErrorObject(ret);
var callArgs = {};
callArgs.widgetId = this.id;
- var result = native.call('Widget_getInstances', callArgs, callback);
+ var result = native.call('WidgetGetInstances', callArgs, callback);
if (native.isFailure(result)) {
throw native.getErrorObject(result);
}
callArgs.widgetId = this.id;
callArgs.sizeType = args.sizeType;
- var ret = native.callSync('Widget_getVariant', callArgs);
+ var ret = native.callSync('WidgetGetVariant', callArgs);
if (native.isFailure(ret)) {
throw native.getErrorObject(ret);
var callArgs = {};
callArgs.widgetId = this.id;
- var result = native.call('Widget_getVariants', callArgs, callback);
+ var result = native.call('WidgetGetVariants', callArgs, callback);
if (native.isFailure(result)) {
throw native.getErrorObject(result);
}
]);
if (widgetToListenerManagerMapping[this.id].numberOfListeners == 0) {
- var result = native.callSync('Widget_addStateChangeListener', {
+ var result = native.callSync('WidgetAddStateChangeListener', {
widgetId: this.id
});
if (native.isFailure(result)) {
widgetToListenerManagerMapping[this.id].removeListener(args.watchId);
if (widgetToListenerManagerMapping[this.id].numberOfListeners == 0) {
- var result = native.callSync('Widget_removeStateChangeListener', {
+ var result = native.callSync('WidgetRemoveStateChangeListener', {
widgetId: this.id
});
if (native.isFailure(result)) {
var callArgs = {};
callArgs.widgetId = args.widgetId;
- var ret = native.callSync('WidgetServiceManager_getWidget', callArgs);
+ var ret = native.callSync('WidgetServiceManagerGetWidget', callArgs);
if (native.isFailure(ret)) {
throw native.getErrorObject(ret);
callArgs.packageId = args.packageId;
}
- var result = native.call('WidgetServiceManager_getWidgets', callArgs, callback);
+ var result = native.call('WidgetServiceManagerGetWidgets', callArgs, callback);
if (native.isFailure(result)) {
throw native.getErrorObject(result);
}
var callArgs = {};
callArgs.id = args.id;
- var ret = native.callSync('WidgetServiceManager_getPrimaryWidgetId', callArgs);
+ var ret = native.callSync('WidgetServiceManagerGetPrimaryWidgetId', callArgs);
if (native.isFailure(ret)) {
throw native.getErrorObject(ret);
var callArgs = {};
callArgs.sizeType = args.sizeType;
- var ret = native.callSync('WidgetServiceManager_getSize', callArgs);
+ var ret = native.callSync('WidgetServiceManagerGetSize', callArgs);
if (native.isFailure(ret)) {
throw native.getErrorObject(ret);
using std::placeholders::_1;
using std::placeholders::_2;
-#define REGISTER_SYNC(c, x) RegisterSyncHandler(c, std::bind(&WidgetServiceInstance::x, this, _1));
-
- REGISTER_SYNC("WidgetServiceManager_getWidget", GetWidget);
- REGISTER_SYNC("WidgetServiceManager_getPrimaryWidgetId", GetPrimaryWidgetId);
- REGISTER_SYNC("WidgetServiceManager_getSize", GetSize);
- REGISTER_SYNC("Widget_getName", GetName);
- REGISTER_SYNC("Widget_getVariant", GetVariant);
- REGISTER_SYNC("Widget_addStateChangeListener", AddStateChangeListener);
- REGISTER_SYNC("Widget_removeStateChangeListener", RemoveStateChangeListener);
- REGISTER_SYNC("WidgetInstance_changeUpdatePeriod", ChangeUpdatePeriod);
- REGISTER_SYNC("WidgetInstance_sendContent", SendContent);
-
-#undef REGISTER_SYNC
-
-#define REGISTER_ASYNC(c, x) RegisterHandler(c, std::bind(&WidgetServiceInstance::x, this, _1, _2));
-
- REGISTER_ASYNC("WidgetServiceManager_getWidgets", GetWidgets);
- REGISTER_ASYNC("Widget_getInstances", GetInstances);
- REGISTER_ASYNC("Widget_getVariants", GetVariants);
- REGISTER_ASYNC("WidgetInstance_getContent", GetContent);
-#undef REGISTER_ASYNC
+#define REGISTER_METHOD(M) \
+ RegisterSyncHandler(#M, std::bind(&WidgetServiceInstance::M, this, _1))
+ REGISTER_METHOD(WidgetServiceManagerGetWidget);
+ REGISTER_METHOD(WidgetServiceManagerGetPrimaryWidgetId);
+ REGISTER_METHOD(WidgetServiceManagerGetSize);
+ REGISTER_METHOD(WidgetGetName);
+ REGISTER_METHOD(WidgetGetVariant);
+ REGISTER_METHOD(WidgetAddStateChangeListener);
+ REGISTER_METHOD(WidgetRemoveStateChangeListener);
+ REGISTER_METHOD(WidgetInstanceChangeUpdatePeriod);
+ REGISTER_METHOD(WidgetInstanceSendContent);
+#undef REGISTER_METHOD
+
+#define REGISTER_METHOD(M) \
+ RegisterHandler(#M, std::bind(&WidgetServiceInstance::M, this, _1, _2))
+ REGISTER_METHOD(WidgetServiceManagerGetWidgets);
+ REGISTER_METHOD(WidgetGetInstances);
+ REGISTER_METHOD(WidgetGetVariants);
+ REGISTER_METHOD(WidgetInstanceGetContent);
+#undef REGISTER_METHOD
}
WidgetServiceInstance::~WidgetServiceInstance() {
listener_map_.clear();
}
-TizenResult WidgetServiceInstance::GetWidget(const picojson::object& args) {
+TizenResult WidgetServiceInstance::WidgetServiceManagerGetWidget(const picojson::object& args) {
ScopeLogger();
CHECK_PRIVILEGE(kPrivilegeWidgetService);
return TizenSuccess(value);
}
-TizenResult WidgetServiceInstance::GetWidgets(const picojson::object& args,
+TizenResult WidgetServiceInstance::WidgetServiceManagerGetWidgets(const picojson::object& args,
const common::AsyncToken& token) {
ScopeLogger();
return TizenSuccess();
}
-TizenResult WidgetServiceInstance::GetPrimaryWidgetId(const picojson::object& args) {
+TizenResult WidgetServiceInstance::WidgetServiceManagerGetPrimaryWidgetId(const picojson::object& args) {
ScopeLogger();
CHECK_PRIVILEGE(kPrivilegeWidgetService);
return TizenSuccess(picojson::value(widget_id));
}
-TizenResult WidgetServiceInstance::GetSize(const picojson::object& args) {
+TizenResult WidgetServiceInstance::WidgetServiceManagerGetSize(const picojson::object& args) {
ScopeLogger();
CHECK_EXIST(args, kSizeType, out)
return TizenSuccess(value);
}
-TizenResult WidgetServiceInstance::GetName(picojson::object const& args) {
+TizenResult WidgetServiceInstance::WidgetGetName(picojson::object const& args) {
ScopeLogger();
CHECK_PRIVILEGE(kPrivilegeWidgetService);
return TizenSuccess(picojson::value(name));
}
-TizenResult WidgetServiceInstance::GetInstances(picojson::object const& args,
+TizenResult WidgetServiceInstance::WidgetGetInstances(picojson::object const& args,
const common::AsyncToken& token) {
ScopeLogger();
return TizenSuccess();
}
-TizenResult WidgetServiceInstance::GetVariant(picojson::object const& args) {
+TizenResult WidgetServiceInstance::WidgetGetVariant(picojson::object const& args) {
ScopeLogger();
CHECK_EXIST(args, kWidgetId, out)
return TizenSuccess(value);
}
-TizenResult WidgetServiceInstance::GetVariants(picojson::object const& args,
+TizenResult WidgetServiceInstance::WidgetGetVariants(picojson::object const& args,
const common::AsyncToken& token) {
ScopeLogger();
LoggerW("widget id was not found.");
}
-TizenResult WidgetServiceInstance::AddStateChangeListener(picojson::object const& args) {
+TizenResult WidgetServiceInstance::WidgetAddStateChangeListener(picojson::object const& args) {
ScopeLogger();
CHECK_PRIVILEGE(kPrivilegeWidgetService);
return TizenSuccess();
}
-TizenResult WidgetServiceInstance::RemoveStateChangeListener(picojson::object const& args) {
+TizenResult WidgetServiceInstance::WidgetRemoveStateChangeListener(picojson::object const& args) {
ScopeLogger();
CHECK_EXIST(args, kWidgetId, out)
return TizenSuccess();
}
-TizenResult WidgetServiceInstance::ChangeUpdatePeriod(picojson::object const& args) {
+TizenResult WidgetServiceInstance::WidgetInstanceChangeUpdatePeriod(picojson::object const& args) {
ScopeLogger();
CHECK_EXIST(args, kWidgetId, out)
return TizenSuccess();
}
-TizenResult WidgetServiceInstance::SendContent(picojson::object const& args) {
+TizenResult WidgetServiceInstance::WidgetInstanceSendContent(picojson::object const& args) {
ScopeLogger();
CHECK_EXIST(args, kWidgetId, out)
return TizenSuccess();
}
-TizenResult WidgetServiceInstance::GetContent(picojson::object const& args,
+TizenResult WidgetServiceInstance::WidgetInstanceGetContent(picojson::object const& args,
const common::AsyncToken& token) {
ScopeLogger();
private:
// WidgetManager
- common::TizenResult GetWidget(picojson::object const& args);
- common::TizenResult GetWidgets(picojson::object const& args, const common::AsyncToken& token);
- common::TizenResult GetPrimaryWidgetId(picojson::object const& args);
- common::TizenResult GetSize(picojson::object const& args);
+ common::TizenResult WidgetServiceManagerGetWidget(picojson::object const& args);
+ common::TizenResult WidgetServiceManagerGetWidgets(picojson::object const& args, const common::AsyncToken& token);
+ common::TizenResult WidgetServiceManagerGetPrimaryWidgetId(picojson::object const& args);
+ common::TizenResult WidgetServiceManagerGetSize(picojson::object const& args);
// Widget
- common::TizenResult GetName(picojson::object const& args);
- common::TizenResult GetInstances(picojson::object const& args, const common::AsyncToken& token);
- common::TizenResult GetVariant(picojson::object const& args);
- common::TizenResult GetVariants(picojson::object const& args, const common::AsyncToken& token);
- common::TizenResult AddStateChangeListener(picojson::object const& args);
- common::TizenResult RemoveStateChangeListener(picojson::object const& args);
+ common::TizenResult WidgetGetName(picojson::object const& args);
+ common::TizenResult WidgetGetInstances(picojson::object const& args, const common::AsyncToken& token);
+ common::TizenResult WidgetGetVariant(picojson::object const& args);
+ common::TizenResult WidgetGetVariants(picojson::object const& args, const common::AsyncToken& token);
+ common::TizenResult WidgetAddStateChangeListener(picojson::object const& args);
+ common::TizenResult WidgetRemoveStateChangeListener(picojson::object const& args);
// WidgetInstance
- common::TizenResult ChangeUpdatePeriod(picojson::object const& args);
- common::TizenResult SendContent(picojson::object const& args);
- common::TizenResult GetContent(picojson::object const& args, const common::AsyncToken& token);
+ common::TizenResult WidgetInstanceChangeUpdatePeriod(picojson::object const& args);
+ common::TizenResult WidgetInstanceSendContent(picojson::object const& args);
+ common::TizenResult WidgetInstanceGetContent(picojson::object const& args, const common::AsyncToken& token);
static std::mutex listener_mutex_;
std::map<std::string, int> listener_map_;