platform/core/api/user-awareness.git
5 years ago[Fix] Send user_cb for every user accepted/tizen_5.5_unified accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5 tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191206.013117 accepted/tizen/5.5/unified/wearable/hotfix/20201027.121639 submit/tizen_5.5/20191205.122148 submit/tizen_5.5_wearable_hotfix/20201026.184302
Lokesh [Thu, 5 Dec 2019 09:36:15 +0000 (15:06 +0530)]
[Fix] Send user_cb for every user

And send user_cb with null user, in case AND_OR conditions have env sensors only

Change-Id: Iad6f15d38589a13a0bdef8499a8ffc182c15fc18
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoCheck sensors of monitor when setting AND/OR condition
Lokesh [Thu, 5 Dec 2019 09:17:51 +0000 (14:47 +0530)]
Check sensors of monitor when setting AND/OR condition

Instead of global avialable sensors.

Change-Id: Ief7c3ee87a5f3adbea790d6d7e1e966e1499002c
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoReset detected bitmask when STOP command received
saerome.kim [Tue, 3 Dec 2019 08:34:06 +0000 (17:34 +0900)]
Reset detected bitmask when STOP command received

- Problem: PRESENCE is not detected after start -> stop -> start
  PRESENCE detection.
- Cause: When receiving the stop PRESENCE detection command,
  the previously detected sensor bitmask is not initialized.
- Solution: When the STOP PRESENCE command is received, initialize the detectedi
  bitmask.

Change-Id: I91ef081509b308174b868f6935067da3d2ce5468
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoFix crash of ua-test app. accepted/tizen/5.5/unified/20191203.011154 accepted/tizen/5.5/unified/20191203.011206 accepted/tizen/5.5/unified/20191203.011213 accepted/tizen/5.5/unified/20191203.011219 submit/tizen_5.5/20191122.014238 submit/tizen_5.5/20191126.004230 submit/tizen_5.5/20191129.060250 submit/tizen_5.5/20191129.113305
saerome.kim [Wed, 20 Nov 2019 11:18:00 +0000 (20:18 +0900)]
Fix crash of ua-test app.

- Problem: The crash happened when reusing one after destroying the device.
- Cause: Use the device handle of the device list directly without cloning.
- Solution: Clone the device handle before manipulation.

Change-Id: I8a207229eb6aa4b60ec98556c792fd20db070b32
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoSupport multiple timestamp for each service accepted/tizen/5.5/unified/20191120.034608 submit/tizen/20191119.081157
Lokesh [Mon, 18 Nov 2019 14:04:54 +0000 (19:34 +0530)]
Support multiple timestamp for each service

Change-Id: I20647e7ec81318ab91887dc72b452f00fcb42cb0
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoPass the error in ua_user_foreach_added() accepted/tizen/5.5/unified/20191118.084850 submit/tizen_5.5/20191115.102057
Lokesh [Fri, 15 Nov 2019 08:39:15 +0000 (14:09 +0530)]
Pass the error in ua_user_foreach_added()

Change-Id: Ia9b8a7371dd49c235ebe878e443c2e497363d32c
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoChange a parameter in ua_device_get_last_presence()
saerome.kim [Fri, 15 Nov 2019 07:48:03 +0000 (16:48 +0900)]
Change a parameter in ua_device_get_last_presence()

- Problem: The meaning of timestamp does not express the recent detection time.
- Cause: The timestamp in the API that was not originally intended
- Solution: Change the timestamp to last_seen.

Change-Id: Ie729f1b0c8e19cebaec44230f650ad770529c929
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoStart detection only on sensor available in monitor
Abhay agarwal [Mon, 11 Nov 2019 06:12:20 +0000 (11:42 +0530)]
Start detection only on sensor available in monitor

Change-Id: Ia6f9f081c0d15d740e57115ff83bf42edee8fe10
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
5 years agoDetection stopped event updated with detection cycle mid/end
Lokesh [Wed, 6 Nov 2019 10:22:05 +0000 (15:52 +0530)]
Detection stopped event updated with detection cycle mid/end

Clean user_state only when it is end of detection cycle.

Change-Id: Icaffcfc7263094c1b7d9c85b771f8d6a8368beea
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoAdd invalid parameter check in ua_user_foreach_added()
Nishant Chaprana [Fri, 15 Nov 2019 06:06:33 +0000 (11:36 +0530)]
Add invalid parameter check in ua_user_foreach_added()

When foreach_cb parameter is NULL, API should return invalid parameter error.

Change-Id: I1196b7f3a7134f5f40ab8e10f22c37379346ea7d
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
5 years agoFix the problem that sensor_status_changed_cb is not called
saerome.kim [Wed, 13 Nov 2019 05:24:50 +0000 (14:24 +0900)]
Fix the problem that sensor_status_changed_cb is not called

- problem: when only PRESENCE detectoin enabled, sensor_status_change_cb is not called
- cause: Check the internal flag that must be set before the sensor_status_change_cb is called.
         The the internal flag is set only if ABSENCE detection invoked.
- Solution: remove the internal flag.

Change-Id: Ide40b46073cde5c1fff78b247ff937c5c3982821
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoAdd ua_user_update API
saerome.kim [Mon, 11 Nov 2019 10:32:43 +0000 (19:32 +0900)]
Add ua_user_update API

- Problem: Users want to change their name.
- Cause: it is not supported to change the user name once user information
  added to ua-manager DB.
- Solution: Make the user can change his name even user-information added.

Change-Id: Iab298a8f1f18e5ed17cd5dc6ca4bb016404cefef
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoApply secure option
saerome.kim [Fri, 8 Nov 2019 10:16:40 +0000 (19:16 +0900)]
Apply secure option

- Problem: There is no FORTIFY option.
- Cause: Unlike the SSP that catches the stack BOF, a protection technique is
  needed to catch the BOF that occurs in a general memory buffer.
- Solution: apply FORTIFY and stack-canar options.

Change-Id: Ifd845013948abd9384d36d3b576b4af00cdb8814
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoFixed the issue that the device and user can not be detected
saerome.kim [Fri, 8 Nov 2019 06:12:41 +0000 (15:12 +0900)]
Fixed the issue that the device and user can not be detected

- Problem: If the timestamp is 0, the sensor and a user can not be detected.
- Cause: If the timestamp is 0, PRESENCE/ABSENCE detection result does not appear.
- Solution: remove timestamp-value checker.

Change-Id: Ic2734b91058abb0562fe01f6a1b05eb29a9b8498
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoSet-default-values-for-payload
Lokesh [Tue, 5 Nov 2019 08:59:16 +0000 (14:29 +0530)]
Set-default-values-for-payload

Change-Id: Id334cc0ce21ca708f5a8eccdb556009255549dac
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoFix the problem that timestamp is not included in user_presence_detected_cb
saerome.kim [Wed, 6 Nov 2019 03:54:25 +0000 (12:54 +0900)]
Fix the problem that timestamp is not included in user_presence_detected_cb

- Problem: Even if the user device is detected, the timestamp value is 0.
- Cause: The timestamp value is not applied to the detected device.
- Solution: Apply timestamp value to detected device info.

Change-Id: Ieeada0d9a714dfdbfe74b6599bba77e1107ef90c
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoFix the issue that always notifies that ABSENCE has been detected
saerome.kim [Mon, 4 Nov 2019 23:47:21 +0000 (08:47 +0900)]
Fix the issue that always notifies that ABSENCE has been detected

- Problem: If ABSENCE is detected immediately after starting and stopping
  PRESENCE.
- Cause: If user_state is 0, then it is considered as an ABSENCE.
- Solution: Modified checking user_state condition if user_state is 0
  then it is not an ABSENCE.

Change-Id: I815ff4b36498d34f23a02a60da0d64c2fb3f5791
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoChange error type
saerome.kim [Mon, 4 Nov 2019 06:40:18 +0000 (15:40 +0900)]
Change error type

- Problem: A strange error code is returned when TC is executed.
- Cause: The error code does not express the exact meaning
- Solution: Change the error code with the proper one.

Change-Id: I6845ac43950cf907633b9d9b9a34a907fb9d29f1
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoFix a crash issue
saerome.kim [Thu, 31 Oct 2019 06:06:01 +0000 (15:06 +0900)]
Fix a crash issue

- Problem: crash happens when executing UTC.
- Cause: A memory allocation of the device is freed when
  ua_device_destry() called, but linked list is not removed.
- Solution: Remove the link in the list when ua_device_destroy() called.

Change-Id: I3005386a57f9ebaf1843676a4f0ffe6b2d2497c7
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoRemove useless handle checker
saerome.kim [Thu, 31 Oct 2019 06:06:01 +0000 (15:06 +0900)]
Remove useless handle checker

- Problem: can't clone any device.
- Cause: There is useleess handle comparison at ua_device_clone.
- Solution: Remove them.

Change-Id: I3e936e596108718d9126851c5c48ec25b500796f
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoModify to create a device-list at a client application starts.
saerome.kim [Wed, 30 Oct 2019 03:14:44 +0000 (12:14 +0900)]
Modify to create a device-list at a client application starts.

- Problem: If the device list is not updated, the device information cannot
  be updated.
- Cause: ua-manager and device list in client applications are not the same.
- Solution: Synchronizes the device list with ua-manager when running a client app.

Change-Id: I0e2d6adcb827d4e381c505c525bdbc92d3c186a7
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoModify the test app to support service functionality accepted/tizen/5.5/unified/20191104.111255 submit/tizen_5.5/20191101.035514
saerome.kim [Mon, 28 Oct 2019 12:11:31 +0000 (21:11 +0900)]
Modify the test app to support service functionality

- Problem: Can't remove/add devices or users to a service
- Cause: The request goes to the service module includes a useless data that
  the current instance does not have is ignored.
- Solution: Make userless data ignore and modified a ua-test app to explain
  how to manipulate the service functionality.

Change-Id: I913a5f7f2722bc473bdd50605c79630860fc2285
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoModify UA CAPI
saerome.kim [Mon, 28 Oct 2019 12:03:05 +0000 (21:03 +0900)]
Modify UA CAPI

1. Add new APIs
ua_user_clone()
ua_user_get_by_account()
ua_user_foreach_added_devices()

2. Change name
ua_service_added_service_cb() -> ua_service_added_cb()

3. Deprecated
ua_device_foreach_added_by_user()

Change-Id: Idf8e92eec507b35ac8126da7ca969bebc4555ac8
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoFix the problem that status_changed_cb is not reported
saerome.kim [Fri, 25 Oct 2019 03:38:59 +0000 (12:38 +0900)]
Fix the problem that status_changed_cb is not reported

- Problem: Without ABSENCE detection, status_changed_cb never be
  notified.
- Cause: Make decision whether ABSNECE detection is started or not.
- Solution: When at least one more detection started, make
  status_changed_cb be called continously.

Change-Id: Ic98982884b51b887619bb14259ae1d662be76d26
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoAdd power lock/unlock functionality
saerome.kim [Fri, 25 Oct 2019 00:08:06 +0000 (09:08 +0900)]
Add power lock/unlock functionality

Change-Id: Ie22d72368421d5f55136b3d384c244f8c1ab4303
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoFix a build error for 64-bit machine
saerome.kim [Thu, 24 Oct 2019 22:40:50 +0000 (07:40 +0900)]
Fix a build error for 64-bit machine

- Problem: build error during test-hub
- Cause: The reason for the error is that the compiler suspects we might be
  trying to round-trip a pointer through int and back. This was common
  practice before the advent of 64-bit machines and it is not safe or reasonable.
- Solution: replace 'int' type-casting with 'intptr_t'.

Change-Id: I0fe0f8c4e8ebf6af45eb714f8284b7bc9371d1f8
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoProvide only NULL user callback if no connectivity sensor in AND/OR condition
Abhay agarwal [Wed, 23 Oct 2019 13:15:01 +0000 (18:45 +0530)]
Provide only NULL user callback if no connectivity sensor in AND/OR condition

- Problem: In case connectivity sensor is detected but not included in AND/OR
we are providing user callback for detected user
- Solution: Only provide user callback with NULL user and block other callbacks

Change-Id: I08150f2821e326d43bf0745ee4bfa4369e5af942
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
5 years agoFix svace issue
saerome.kim [Tue, 22 Oct 2019 08:11:31 +0000 (17:11 +0900)]
Fix svace issue

413217, 413218, 413219: signed to big unsigned issue.

Change-Id: If1d7b3906f666a625407cbcd5c26e3c23095ca8e
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoModify uat-test that detection cases can be distinguish more cleary
saerome.kim [Tue, 22 Oct 2019 07:30:58 +0000 (16:30 +0900)]
Modify uat-test that detection cases can be distinguish more cleary

Change-Id: Iddd83f882579b6eaac368749426ecb0932988c5f
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoFix the problem that the SF and UAF use different data format
saerome.kim [Mon, 21 Oct 2019 12:00:23 +0000 (21:00 +0900)]
Fix the problem that the SF and UAF use different data format

- Problem: The data format of timestamp is not different from the sensor
  framework.
- Cause: The UAF uses 32 bit timestamp but the sensor framework uses 64
  bit timestamp.
- Solution: Change timestamps in UAF with 64-bit unsigned long long.

Change-Id: I174627c17a17e5f59c2f9c04ed78f81b12ff0ebe
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoAdd functionality to report instant sensor status change
saerome.kim [Mon, 21 Oct 2019 11:55:53 +0000 (20:55 +0900)]
Add functionality to report instant sensor status change

- Problem: in ABSENCE case, even the motion sensor detects ABSENCE
ua-manager reports this ABSENCE state after the detection window complete.
- Cause: If ABSENCE case, the ABSENCE can be jurged only when the
detction window complete.
- Solution: Whenever the sensor status is changed, plugin reports status
changed event immediately so that the user can recognize ABSENCE event
takes place during uncompleted ABSENCE detection window.

Change-Id: I49254770cbab1c55aac7b9b893c5eec8d54139cf
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoAdd new API to set low power mode accepted/tizen_5.5_unified_mobile_hotfix tizen_5.5_mobile_hotfix accepted/tizen/5.5/unified/20191031.031318 accepted/tizen/5.5/unified/mobile/hotfix/20201027.065752 accepted/tizen/unified/20191018.052938 submit/tizen/20191018.005538 submit/tizen_5.5/20191031.000002 submit/tizen_5.5_mobile_hotfix/20201026.185102 tizen_5.5.m2_release
saerome.kim [Thu, 17 Oct 2019 09:26:52 +0000 (18:26 +0900)]
Add new API to set low power mode

- Problem: it is needed that new API that can set low power mode
- Cause: without adding new API, build break occurs.
- Solution: add new API to set low power mode.

Change-Id: I2e9269003238973f29424a017c0b9f56c18b4b6d
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoModify APIs to set low power mode selectively
Abhay agarwal [Thu, 17 Oct 2019 04:18:50 +0000 (09:48 +0530)]
Modify APIs to set low power mode selectively

Change-Id: I249d3b3bba1294a21967a10c8247f9c294674957
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
5 years agoClean up codes for suspend/resume test accepted/tizen/unified/20191017.035459 submit/tizen/20191017.002636
saerome.kim [Tue, 15 Oct 2019 11:02:12 +0000 (20:02 +0900)]
Clean up codes for suspend/resume test

- Problem: suspend/resume seem not to work correctly.
- Cause: sequence for calling power API is not working.
- Solution: fix the sequence for callign power API and test scenario.

Change-Id: I80977b9d51137cfe29684a514bbfbe3b37de21fd
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoFixed svace issue.
Abhay agarwal [Mon, 14 Oct 2019 07:12:07 +0000 (12:42 +0530)]
Fixed svace issue.

386398: Dynamic memory referenced by 'name' was allocated by calling function
        'ua_service_get_name' at uat-service.c:85 and lost at uat-service.c:97.

Change-Id: I06a43c1699632465e05dfe04b104044631f4b1fc
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
5 years agoProvide user callback to applications as soon as possible
Abhay agarwal [Mon, 14 Oct 2019 07:12:07 +0000 (12:42 +0530)]
Provide user callback to applications as soon as possible

Provide user callback earlier instead of waiting for detection window to complete.
Callback is provided as soon as the AND/OR condition for a particular user is met.
This will result in missing of device/sensor information in callback provided for
the device/sensor detected after sending callback.

Change-Id: I7a5a1912a66ec932ef261f74f354d4717994decf
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
5 years agoModify test app to handle error from set and/or condition accepted/tizen/unified/20191014.005013 submit/tizen/20191011.095843
Abhay Agarwal [Fri, 11 Oct 2019 08:11:35 +0000 (17:11 +0900)]
Modify test app to handle error from set and/or condition

Change-Id: I36b41ba265fc3db20412c496c2c151549be16caf
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoAdd API to get service detection thresholds
Abhay Agarwal [Fri, 11 Oct 2019 06:26:42 +0000 (15:26 +0900)]
Add API to get service detection thresholds

Change-Id: Ib34bbba2555157823d8e098faae08c5f9d4e69df
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoProvide API to update service
Abhay Agarwal [Fri, 11 Oct 2019 04:48:29 +0000 (13:48 +0900)]
Provide API to update service

Change-Id: I85080d43b496762a1563b359ed3667e1a51b66f2
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoUpdate sensor handle list for user callback accepted/tizen/unified/20191011.101528 submit/tizen/20191011.062256
Abhay Agarwal [Fri, 11 Oct 2019 02:29:50 +0000 (11:29 +0900)]
Update sensor handle list for user callback

Provide handle of sensors which are also present in AND/OR condition
This patch also fix AND/OR condition when only one condition is applied

Change-Id: I8ca7299c5eaffffb4f07d230626c1a5cdd1df50c
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoProvide user presence callback in case no user information present accepted/tizen/unified/20191011.080021 submit/tizen/20191011.014757
Abhay Agarwal [Thu, 10 Oct 2019 07:51:06 +0000 (16:51 +0900)]
Provide user presence callback in case no user information present

AND/OR condition being used to provide user presence callback can get satisfied
without user information also with the presence of environmental sensors.
This patch also modifies to provide user callback at the end of detection window
to provide application with more detection data.

Change-Id: I3236762071303e565d689b66dc1261cb98c27bc3
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoFix coverity issues. accepted/tizen/unified/20191008.101526 submit/tizen/20191008.043811
saerome.kim [Tue, 8 Oct 2019 01:47:20 +0000 (10:47 +0900)]
Fix coverity issues.

1087649: leaked_storage: Variable sensor_info going out of scope leaks
         the storage it points to.
1087675: leaked_storage: Variable sensor_info going out of scope leaks
         the storage it points to.

Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoAdd NULL check before g_strlcpy operation in ua_user_remove_device() accepted/tizen/unified/20191008.101535 submit/tizen/20191008.005850
Nishant Chaprana [Mon, 7 Oct 2019 12:35:44 +0000 (18:05 +0530)]
Add NULL check before g_strlcpy operation in ua_user_remove_device()

The ua_user_remove_device() returns INVALID_PARAMETER error
when both device_id and mac are NULL.
However when device_id is only NULL and mac is not NULL
then Glib warning will be generated.

Change-Id: I26a21db9659866d3e1a2e6ded9722e9897e958d9
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
5 years agoRemove redundant g_strlcpy operation in ua_device_set_mac_address()
Nishant Chaprana [Mon, 7 Oct 2019 12:28:23 +0000 (17:58 +0530)]
Remove redundant g_strlcpy operation in ua_device_set_mac_address()

Change-Id: I08371368c022492f9e922486efa768441a2083c4
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
5 years agoFix GLib-CRITICAL using NULL check before g_strlcpy()
Nishant Chaprana [Mon, 7 Oct 2019 11:43:44 +0000 (17:13 +0530)]
Fix GLib-CRITICAL using NULL check before g_strlcpy()

This patch removes below glib's critical warning:-
    GLib-CRITICAL **: g_strlcpy: assertion 'src != NULL' failed

Below is the backtrace when glib warning is generated:-
    (gdb) bt full
    #0  0xb6176f14 in g_log () from /usr/lib/libglib-2.0.so.0
    No symbol table info available.
    #1  0xb61774f8 in g_return_if_fail_warning () from /usr/lib/libglib-2.0.so.0
    No symbol table info available.
    #2  0xb6191320 in g_strlcpy () from /usr/lib/libglib-2.0.so.0
    No symbol table info available.
    #3  0xb610ec90 in ua_user_add_device (
     user_handle=user_handle@entry=0xb0c8ec50,
     device_handle=device_handle@entry=0xb0e00a90,
     callback=0x4064a1 <_ua_user_device_added_cb>,
     user_data=user_data@entry=0x0)
     at /usr/src/debug/capi-network-ua-0.11.2/src/user-awareness-users.c:835
     __func__ = "ua_user_add_device"
     ret = <optimized out>
     handle = 0x0
     temp_handle = 0x0
     device = 0xb0e00a90
     user = <optimized out>
     uam_device = {operating_system = UAM_OS_TYPE_TIZEN,
       type = UAM_TECH_TYPE_WIFI, mac = "ab:cd:ef:gh:ij:kl",
       ipv4_addr = '\000' <repeats 49 times>,
       device_id = '\000' <repeats 49 times>, payload = {
     service_id = 0 '\000', device_icon = 0 '\000', purpose = 0 '\000',
     duid = '\000' <repeats 17 times>,
     bt_mac = '\000' <repeats 17 times>}, discriminant = 1,
       last_seen = 0}

Change-Id: I25b7f26b18c6ff8bfff3522c653d66128f1eafd7
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
5 years agoAdd null-check to prevent crash.
saerome.kim [Mon, 7 Oct 2019 08:33:26 +0000 (17:33 +0900)]
Add null-check to prevent crash.

Change-Id: Ibaf4f40cf8a07c2cb974573378b320149d9a869f
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoProvide device added errors to applications through callback
Abhay Agarwal [Mon, 7 Oct 2019 04:17:08 +0000 (13:17 +0900)]
Provide device added errors to applications through callback

This commit provides the errors received from ua-manager in adding a device.
This also provide modifications to always reset the callback states.

Change-Id: I65b5a0be9807576027435918cbf769ef9b74403e
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoUpdate description of user callbacks to the doxygen comments accepted/tizen/unified/20191007.234842 submit/tizen/20191007.022831
Abhay Agarwal [Mon, 7 Oct 2019 01:43:38 +0000 (10:43 +0900)]
Update description of user callbacks to the doxygen comments

Change-Id: I986d13362ec310957df7faa82832aa292b0c9df5
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoProvide sensor info in user absence detected callback
Abhay Agarwal [Fri, 4 Oct 2019 11:20:04 +0000 (20:20 +0900)]
Provide sensor info in user absence detected callback

Change-Id: I5c7164a7dd9f8e71f7b5a6654f736ef71acd0a59
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoProvide sensor information in user detection callback
Abhay Agarwal [Fri, 4 Oct 2019 10:39:01 +0000 (19:39 +0900)]
Provide sensor information in user detection callback

Change-Id: I79c1256f8bd1ea21f8421d3964b573d6eba45cef
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoAdd API to get service specific device discriminant
Abhay Agarwal [Fri, 4 Oct 2019 07:05:12 +0000 (16:05 +0900)]
Add API to get service specific device discriminant

Change-Id: I4651c96e27ac8fae5f98ceae4e198becc444260a
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoservice specific device discriminant
Abhay Agarwal [Mon, 30 Sep 2019 10:34:39 +0000 (19:34 +0900)]
service specific device discriminant

Change-Id: Idff3ea4d729aa408c51152dee5bfd49c4bf3bf98
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoFixed coverity issues accepted/tizen/unified/20191004.003621 submit/tizen/20191002.073539
saerome.kim [Wed, 2 Oct 2019 06:07:58 +0000 (15:07 +0900)]
Fixed coverity issues

1087645 leaked_storage: Variable sensor_info going out of scope leaks the
        storage it points to
1087646 var_deref_model: Passing null pointer sensor_info to
        __send_sensor_presence_event, which dereferences it.
1087649 leaked_storage: Variable sensor_info going out of scope leaks the
        storage it points to

Change-Id: I7c5a080c876c2f43ac3b6ab4fde008bba97894fd
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoFree the unused memory for sensor info struct submit/tizen/20191001.125608
Abhay Agarwal [Tue, 1 Oct 2019 11:31:26 +0000 (20:31 +0900)]
Free the unused memory for sensor info struct

This commit fix the issue of memory corruption because of unused memory
by ua_sensor_info_s struct and free the memory.

Change-Id: I9f8b0bfea9e51f9993b81c79f1e706452a56b40c
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoAdd API set to get sensor information from sensor handle
Abhay Agarwal [Tue, 1 Oct 2019 10:09:47 +0000 (19:09 +0900)]
Add API set to get sensor information from sensor handle

This commit add an API set which can be used by the application to get the detected
sensor information of the sensor using sensor handle.

Change-Id: I10dec7bd427ab5d616bb6860f68e4d318d1234fe
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agouse sensor handle to send sensor information to application
Abhay Agarwal [Tue, 1 Oct 2019 09:19:22 +0000 (18:19 +0900)]
use sensor handle to send sensor information to application

This commit provides the sensor information to application using a sensor handle
instead of providing directly using sensor struct, so that sensor struct need not
to be disclosed to the application.

Change-Id: Iab7ff5c6898404412f0fbb3d2d3586f2306d3237
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoProvide sensor info in absence callback
Abhay Agarwal [Tue, 1 Oct 2019 05:38:52 +0000 (14:38 +0900)]
Provide sensor info in absence callback

Change-Id: I82a70cbe2312d035f3167fe8f789f92b0eae1148
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoModify callback signature for sensor_presence_cb
Abhay Agarwal [Tue, 1 Oct 2019 04:17:26 +0000 (13:17 +0900)]
Modify callback signature for sensor_presence_cb

This patch modify callback sensor_presence_cb to not provide sensor information
using user data and add a seprate field for this parameter.

Change-Id: Ia0c6159225be99595516f9dc10ecf58f2e16fa16
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoProvide detected sensor information in ALL Mode accepted/tizen/unified/20191002.013420 submit/tizen/20191001.112138
Abhay Agarwal [Tue, 1 Oct 2019 02:04:21 +0000 (11:04 +0900)]
Provide detected sensor information in ALL Mode

Change-Id: Ia5247115d8ecf22faff6cc48f826775ec77c55c5
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoSend only device handle instead of list during sensor callback
Abhay Agarwal [Mon, 30 Sep 2019 11:11:07 +0000 (20:11 +0900)]
Send only device handle instead of list during sensor callback

Change-Id: I81cb02c458ffe49da531bb70d336ff3e041e0dfe
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoProvide device information in sensor callback
Abhay Agarwal [Mon, 30 Sep 2019 03:56:41 +0000 (12:56 +0900)]
Provide device information in sensor callback

Change-Id: I16046cb0154bf143fb59c6f420b77db663136bad
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years ago[Crash Fix] Set global list variables back to NULL after g_slist_free_full() operation. accepted/tizen/unified/20190929.221445 submit/tizen/20190927.055416
Nishant Chaprana [Thu, 26 Sep 2019 13:31:41 +0000 (19:01 +0530)]
[Crash Fix] Set global list variables back to NULL after g_slist_free_full() operation.

Change-Id: I219130622e4d5471cf6f9ee6b30f911c8ff44d83
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
5 years agoFix buffer overflow issue
Abhay Agarwal [Thu, 26 Sep 2019 02:14:54 +0000 (11:14 +0900)]
Fix buffer overflow issue

Change-Id: I2e2ffc47bf5517015e0bbcad9b2cda9951a69b5f
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoAdd API to set light detection threshold
Abhay Agarwal [Wed, 25 Sep 2019 04:25:50 +0000 (13:25 +0900)]
Add API to set light detection threshold

Change-Id: Idef67a2c512af01aa3c14669c9c275a724946777
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoChanged presence_detected_cb in ua-test.
saerome.kim [Wed, 25 Sep 2019 23:49:06 +0000 (08:49 +0900)]
Changed presence_detected_cb in ua-test.

This version display sensor information when be called sensor callback.
So we changed the name of the exsiting __device_presence_detected_cb and
__device_absence_cb to __sensor_presence/absence_cb.

Change-Id: I5b384d7e1917cad57d1545eab314ae653f0a675b
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years ago[Fix] Allocate and free memory for sensor info
Abhay Agarwal [Tue, 24 Sep 2019 03:49:09 +0000 (12:49 +0900)]
[Fix] Allocate and free memory for sensor info

Change-Id: I7a1a2639c3b06e98fd3a2757d73e9fb6ef1b10e2
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoModified test app for sensor info in callback
Abhay Agarwal [Mon, 23 Sep 2019 10:03:45 +0000 (19:03 +0900)]
Modified test app for sensor info in callback

Change-Id: I79de27fcc552a788f348ffca6ad63c3edcec2539
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoSupport sensor info in detection callback
Abhay Agarwal [Fri, 20 Sep 2019 08:19:39 +0000 (17:19 +0900)]
Support sensor info in detection callback

Change-Id: I36d14926f676cc6ff1e3ffd988b670f0fad01e0d
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoSupport Add/Remove sensor during detection 39/214439/1
Abhay Agarwal [Thu, 19 Sep 2019 05:14:29 +0000 (14:14 +0900)]
Support Add/Remove sensor during detection

Change-Id: I7337191785ac65c251a549f058c294d7d19da7d1
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agocall stop presence detection only if started 38/214438/1
Abhay Agarwal [Wed, 18 Sep 2019 10:49:20 +0000 (19:49 +0900)]
call stop presence detection only if started

Change-Id: I569ea947646588105b5bf0cc7f987656f6e754cb
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
5 years agoChaged default detection cycle at ua-test app. 55/213955/1
saerome.kim [Tue, 17 Sep 2019 02:23:16 +0000 (11:23 +0900)]
Chaged default detection cycle at ua-test app.

Change-Id: I0a4ad435dc7d9e93265f67917b1c87fcebbdc7ea
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoUpdate detection cycle/window time accepted/tizen/unified/20190917.034102 submit/tizen/20190916.120818
Abhay agarwal [Mon, 2 Sep 2019 09:30:27 +0000 (15:00 +0530)]
Update detection cycle/window time

Change-Id: I43823c1502e9381c7476d10d974a81208a1e26e9
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
5 years agoFix __ua_send_absence_detection() to store monitor->absence_detected_bitmask
Lokesh [Tue, 10 Sep 2019 11:38:20 +0000 (17:08 +0530)]
Fix __ua_send_absence_detection() to store monitor->absence_detected_bitmask

1/ fix user_sensor_bitmask in __ua_monitor_send_user_absence_cb()
2/ _uam_to_ua_sensor() is newly named

Changed uat-detection menu.
1/ change default detection type: ANY
2/ removed stop presence/detection menu

Change-Id: I30c3df499d080a080f22186c412aab3e447aaa9d
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agofilter list of found_devices of a user based on sensors mentioned in AND/OR conditions
Lokesh [Mon, 9 Sep 2019 05:39:14 +0000 (11:09 +0530)]
filter list of found_devices of a user based on sensors mentioned in AND/OR conditions

Change-Id: I49c00ab54aa734506e4403b08f58fc04b2a4e9d7
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoMake '__ua_monitor_send_user_absence_cb' consistent with '__ua_monitor_send_user_pres...
Lokesh [Thu, 5 Sep 2019 11:51:18 +0000 (17:21 +0530)]
Make '__ua_monitor_send_user_absence_cb' consistent with '__ua_monitor_send_user_presence_cb'

Pass user_state pointer as the method parameter.

Change-Id: I7a10855f2aa3b12eee156b4855124255fe3e8ed0
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoChanged 'env_absence_bm' to 'env_absence_bitmask'
Lokesh [Thu, 5 Sep 2019 11:36:22 +0000 (17:06 +0530)]
Changed 'env_absence_bm' to 'env_absence_bitmask'

user_handle is checked to be non-null in __ua_monitor_send_user_presence_cb()

Change-Id: Ic0382c0c8a03887026943f78aebd5c1e2cdc1d16
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoFixed problem that cant'receive PRESENCE/ABSENCE if a least one device
saerome.kim [Wed, 4 Sep 2019 11:57:51 +0000 (20:57 +0900)]
Fixed problem that cant'receive PRESENCE/ABSENCE if a least one device
is not deceted.

Problem: PRESENCE/ABSENCE callback are not called if no device is detected.
Cause: monitor->presence_detected_bitmask might be updated in
       __a_sensor_presence_detected() according to the monitor->presence_mode.
       However, this function __ua_monitor_send_user_presence_cb() can be called
       before it is updated when "account" is valid.
Soultion: remove checking user_handle in __ua_monitor_send_user_presence_cb()

Change-Id: I6ce39a3e12c22d098a54d86abc165722495c43a7
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoCombined bitmask conditions menu and detection menu into one.
saerome.kim [Wed, 4 Sep 2019 01:33:13 +0000 (10:33 +0900)]
Combined bitmask conditions menu and detection menu into one.

Change-Id: Ibf8b870dfdaff8d4952966e0ecd8523313f7c3f5
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoAdded logical conjunction operator in between AND/OR conditions of user_cb
Lokesh [Tue, 3 Sep 2019 11:34:09 +0000 (17:04 +0530)]
Added logical conjunction operator in between AND/OR conditions of user_cb

1/ Added enum 'ua_condition_conjunction_e'

Change-Id: I3b665d1a7610197945a4005ee7f0c92d78af429b
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoFix in 'env_presence/absence_bm' in send_user_presence/absence_cb()
Lokesh [Tue, 3 Sep 2019 03:50:30 +0000 (09:20 +0530)]
Fix in 'env_presence/absence_bm' in send_user_presence/absence_cb()

Change-Id: I7c1e0d3cccb84559a43beb05ff21285d334b8201
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoFix absence_user_cb AND/OR conditions
Lokesh [Mon, 2 Sep 2019 08:33:18 +0000 (14:03 +0530)]
Fix absence_user_cb AND/OR conditions

Incorporate environmental sensors

Change-Id: Ia3835de7b8f2442e1c94594904b812fc2a1ac915
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoFix presence_user_cb AND/OR condition
Lokesh [Fri, 30 Aug 2019 10:01:21 +0000 (15:31 +0530)]
Fix presence_user_cb AND/OR condition

1/ Incorporate environmental sensors
2/ Send only one presence_user_cb for a user within a cycle

Change-Id: I0510fe074e4da808c3078d8ff15f20fc1ae4716f
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoFixed dexter issues
Lokesh [Fri, 6 Sep 2019 08:21:58 +0000 (13:51 +0530)]
Fixed dexter issues

Checker: 'sec_bof_strncat'
Defect ID: 33, 34 and 36.

Change-Id: I46c9bd3da8ffbc74567a94d0c0b22e87b9c6b7f7
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoFixed svace & coverity issues. 42/213342/1 accepted/tizen/unified/20190904.224506 submit/tizen/20190904.113521
saerome.kim [Wed, 4 Sep 2019 07:53:33 +0000 (16:53 +0900)]
Fixed svace & coverity issues.

- Coverity
1079311: check_return: Calling ua_user_get_account without checking return value.

- Svace
406760: INVARIANT_RESULT.OP_ZERO

Change-Id: I52d347f6430aa08846da5aec674b35cd30786108
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years ago[Fix] Compare mac in device list only when device id matches 41/213341/1
Abhay agarwal [Mon, 2 Sep 2019 06:23:21 +0000 (11:53 +0530)]
[Fix] Compare mac in device list only when device id matches

Change-Id: Iffa16e906c81fb4b23b5ea3e895c2fb4f3b0b0fd
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
5 years agoAdded 'ua_add_ibeacon_adv_data()' API accepted/tizen/unified/20190830.110646 submit/tizen/20190830.050936
Lokesh [Tue, 27 Aug 2019 03:58:54 +0000 (09:28 +0530)]
Added 'ua_add_ibeacon_adv_data()' API

Change-Id: Ib959f3aeac1de4d15c233bf6606b4615d5960fcf
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoFixed a coverity issue. accepted/tizen/unified/20190830.040748 submit/tizen/20190829.080217
saerome.kim [Thu, 29 Aug 2019 07:57:58 +0000 (16:57 +0900)]
Fixed a coverity issue.

1078723 Copy-paste error

Change-Id: Id0983ab4b5197264c088b3da0449bdc0cea107d6
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoFixed coverity issues. submit/tizen/20190829.070918
saerome.kim [Thu, 29 Aug 2019 06:37:56 +0000 (15:37 +0900)]
Fixed coverity issues.

1076181 Resource leak.
1076152 Resource leak.

Change-Id: Ia19998552ed4822fb3ad4e01a80425c631dbd33d
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoResolved Dexter defects accepted/tizen/unified/20190829.101443 submit/tizen/20190827.131417
Lokesh [Tue, 27 Aug 2019 06:03:56 +0000 (11:33 +0530)]
Resolved Dexter defects

Checker: 'invalidprintfargtype_sint'
DID: 35, 37, 38

Change-Id: Ib982638fbc2a5da85a25582221b3f0ed3e1d7e9b
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoIncresed SAM score 07/212807/1 submit/tizen/20190827.050311
saerome.kim [Tue, 27 Aug 2019 02:24:52 +0000 (11:24 +0900)]
Incresed SAM score

- clean codes and remove redundant code as a function.
- separate the codes related to the user and device in
user-awareness-user.c into two files.

Change-Id: I8a3351edc2cd7a3cf9fc07470d8724ab209db5e8
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoAdded an error code when user tries to remove a device. 06/212806/1
saerome.kim [Tue, 27 Aug 2019 03:55:02 +0000 (12:55 +0900)]
Added an error code when user tries to remove a device.

- return error code: UA_ERROR_RESOURCE_BUSY
- applied APIs.
  . ua_user_remove_device
  . ua_user_remove_device_by_device_id
  . ua_user_remove_device_by_mac_address

Change-Id: Ibe4becc4657ecb4c79dfa6801b694f0202882d18
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoApplied the error code added to ua-manager. accepted/tizen/unified/20190826.225910 submit/tizen/20190826.140219
saerome.kim [Mon, 26 Aug 2019 12:00:57 +0000 (21:00 +0900)]
Applied the error code added to ua-manager.
- ua-manager added UAM_ERROR_RESOURCE_BUSY.

Change-Id: I0498cffec7eafe00851828d8864a1132390d0200
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoFixed missing memory leak problem.
saerome.kim [Mon, 26 Aug 2019 10:55:50 +0000 (19:55 +0900)]
Fixed missing memory leak problem.

Change-Id: I8562188442ac18ed099709cf611d178a7eef1583
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoFixed the Coverity & Svace issues.
saerome.kim [Mon, 26 Aug 2019 08:57:21 +0000 (17:57 +0900)]
Fixed the Coverity & Svace issues.

1078724 Leaked_storage: Variable mac going out of scope leaks the storage it points to.
1078723 copy_paste_error: g_presence_and_cond looks like a copy-paste error.
1078720 Check return: Calling ua_device_get_mac_address without checking return value.
1078717 Check_return:Calling ua_device_get_mac_type without checking return value.
1076181 Leaked_storage: Variable service going out of scope leaks the storage it points to.
1076152 Leaked_storage: Variable service going out of scope leaks the storage it points to.
405915 Leaked_storage: Variable mac going out of scope leaks the storage it points to

Change-Id: I1c8d80568c0df9901abcdc0c26a5318b7faa3a6b
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoFixed a crash problme when removing a device from user using the 41/212741/1
saerome.kim [Mon, 26 Aug 2019 06:25:59 +0000 (15:25 +0900)]
Fixed a crash problme when removing a device from user using the
device's handle.

Change-Id: I2464e14a712f47aa8d3c1ff37aba09bd9d5b1022
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoChanged the unit of the parameters of 36/212536/1
saerome.kim [Thu, 22 Aug 2019 09:31:14 +0000 (18:31 +0900)]
Changed the unit of the parameters of
ua_monitor_set_brightness_threshold() from lux_value to lux.

Change-Id: I15176bb46b762f74309e8364cb7797b3c102d365
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
5 years agoFixed Doxygen issues in header file. 64/212464/1 accepted/tizen/unified/20190822.105945 submit/tizen/20190822.051725
Nishant Chaprana [Wed, 21 Aug 2019 13:02:22 +0000 (18:32 +0530)]
Fixed Doxygen issues in header file.

Change-Id: I451507a3399669cabfa73ef8db109c7fbdeee7a2
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
5 years agoAvoid false error case 31/212331/1
Lokesh [Tue, 20 Aug 2019 06:45:46 +0000 (12:15 +0530)]
Avoid false error case

Change-Id: I37606dc88a80785df318d86f2992ce77db4eafd3
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years agoFixed memory leak in ua_deinitialize() 30/212330/1
Lokesh [Tue, 20 Aug 2019 05:54:39 +0000 (11:24 +0530)]
Fixed memory leak in ua_deinitialize()

g_slist_free_full() frees the memory used by each element's data
and also of GSList.
Whereas, ua_user_destroy() was not able to free when user->isadded flag is true.
and the 'if (!u)' NULL check was incorrect.

Change-Id: Ib69388d88a57c5ef26f01440c1ae6ed5bc80d1ef
Signed-off-by: Lokesh <l.kasana@samsung.com>
5 years ago1/ Added ua_device_set/get_payload_device_icon() APIs 85/212285/2
Lokesh [Mon, 19 Aug 2019 10:26:37 +0000 (15:56 +0530)]
1/ Added ua_device_set/get_payload_device_icon() APIs

2/ Update BLE payload using ua_device_update().
3/ Replaced sizeof(some_string) to 'MENU_DATA_SIZE + 1' in testApp.

Change-Id: Iade5f32df68f035090b2a81ece2749958370b33b
Signed-off-by: Lokesh <l.kasana@samsung.com>