Hi Kevin, Notifications are constructed and sent internally by the stack following a few triggers as explained below.
Notifications are automatically sent following all POST/PUT requests to any Observable resource. This is handled internally by capturing the most recent resource state and packaging it into a notification. The resource's state is whatever is usually read by the GET handler of the resource. If you want notifications to be periodic, you must use oc_resource_set_periodic_observable() on the resource specifying a frequency of that observation. In this case, the stack internally polls the resource and sends out a notification with its most recent state every time a notification is scheduled. The application doesn't have to do thing. If you need to send notifications asynchronously, you will instead use oc_resource_set_observable() on the resource, and later call oc_notify_observers() (synchronizing with oc_main_poll()) from any task in your application that produces a change in the resource's state (again data structures read by the resource's GET handler). -Kishen. -- Kishen Maloor Intel Corporation From: <iotivity-dev@lists.iotivity.org> on behalf of Joo-Chul Lee <cms.r...@gmail.com> Date: Tuesday, July 23, 2019 at 7:28 PM To: iotivity-dev <iotivity-dev@lists.iotivity.org> Subject: [dev] [iotivity-lite] how to handle notification in iotivity-lite? Hi iotivity folks, I have a question about notification mechanism in IoTivity-lite. In IoTivity classic, server can check existence of “observe option” in callback function registered to specific Resource. and therefore the server can send following notification responses based on its notification logic. However, I can’t find such codes in IoTivity-lite samples. How can server know if there is “observe option” in request message? Could anyone explain how notification works in IoTivity-lite stack ? Thanks & BR :) - Kevin -- -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Joo-Chul Kevin Lee, ETRI 161 Gajeong-dong, Yuseong-gu, daejon, 305-700, KOREA E-mail: r...@etri.re.kr/cms.r...@gmail.com<http://r...@etri.re.kr/cms.r...@gmail.com> Tel: +82-42-860-1021 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#10243): https://lists.iotivity.org/g/iotivity-dev/message/10243 Mute This Topic: https://lists.iotivity.org/mt/32580414/21656 Group Owner: iotivity-dev+ow...@lists.iotivity.org Unsubscribe: https://lists.iotivity.org/g/iotivity-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-