# How To Know If AVSession Is Open On App Restart

**URL:** <https://forum.legato.io/t/how-to-know-if-avsession-is-open-on-app-restart/4830>\
**Category:** Legato Application Framework\
**Created:** [November 13, 2019, 12:17am UTC](https://forum.legato.io/t/how-to-know-if-avsession-is-open-on-app-restart/4830 "2019-11-13T00:17:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbeckwith](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/dbeckwith/32/663_2.png) [@dbeckwith](https://forum.legato.io/u/dbeckwith)\
**Post date:** [November 13, 2019, 12:17am UTC](https://forum.legato.io/t/how-to-know-if-avsession-is-open-on-app-restart/4830/1 "2019-11-13T00:17:32Z")

</div>

I have any app that is required to perform work if a `le_avdata session` is not open and stop that work when a `le_avdata session` is open. I used the `le_avdata_AddSessionStateHandler` which I have has works well. Something that I didn’t expect is when I update my app that has an open data session (only the app I’m updating is restarted all other apps are left running by Legato) there doesn’t seem to be an API to determine if a session is open or closed. Obviously the handler isn’t called because the session event has happened before the app restarted.

Is there an API to determine if an AVData session is open?

Thanks,  
Darren

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 13, 2019, 2:34am UTC](https://forum.legato.io/t/how-to-know-if-avsession-is-open-on-app-restart/4830/2 "2019-11-13T02:34:40Z")

</div>

can AT+WDSS? help on determinating this?

---

<div class="post-metadata">

**Author:** ![dbeckwith](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/dbeckwith/32/663_2.png) [@dbeckwith](https://forum.legato.io/u/dbeckwith)\
**Post date:** [November 13, 2019, 7:43pm UTC](https://forum.legato.io/t/how-to-know-if-avsession-is-open-on-app-restart/4830/3 "2019-11-13T19:43:44Z")

</div>

@jyijyi

Is there no way to do this from the le\_avdata API? It seems heavy handed to have to use the AT commands from within my app no?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 13, 2019, 11:13pm UTC](https://forum.legato.io/t/how-to-know-if-avsession-is-open-on-app-restart/4830/4 "2019-11-13T23:13:40Z")

</div>

Do you mean the AT command works for you?

---

<div class="post-metadata">

**Author:** ![dbeckwith](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/dbeckwith/32/663_2.png) [@dbeckwith](https://forum.legato.io/u/dbeckwith)\
**Post date:** [November 13, 2019, 11:25pm UTC](https://forum.legato.io/t/how-to-know-if-avsession-is-open-on-app-restart/4830/5 "2019-11-13T23:25:41Z")

</div>

I’m not sure how to go about accessing the AT commands from within my app. Can you please help me understand how I can issue AT commands from within my app?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 13, 2019, 11:59pm UTC](https://forum.legato.io/t/how-to-know-if-avsession-is-open-on-app-restart/4830/6 "2019-11-13T23:59:13Z")

</div>

Just open the AT command port and check.  
If it works, you can open /dev/ttyAT in your app to check

---

<div class="post-metadata">

**Author:** ![dbeckwith](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/dbeckwith/32/663_2.png) [@dbeckwith](https://forum.legato.io/u/dbeckwith)\
**Post date:** [November 14, 2019, 12:21am UTC](https://forum.legato.io/t/how-to-know-if-avsession-is-open-on-app-restart/4830/7 "2019-11-14T00:21:23Z")

</div>

@jyijyi OK thank you!

---

<div class="post-metadata">

**Author:** ![dbeckwith](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/dbeckwith/32/663_2.png) [@dbeckwith](https://forum.legato.io/u/dbeckwith)\
**Post date:** [November 14, 2019, 9:50pm UTC](https://forum.legato.io/t/how-to-know-if-avsession-is-open-on-app-restart/4830/8 "2019-11-14T21:50:06Z")

</div>

@jyijyi I can’t seem to get a response from the AT service I keep getting `ERROR`.

I run `microcom /dev/ttyAT` and then type `AT+WDSS?` and I get `ERROR`. The only response that gives me `OK` is `AT`. What’s also interesting is a lot of the AT examples show using the `-E` switch but this doesn’t seem to be an option for me.

Thoughts?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 14, 2019, 10:47pm UTC](https://forum.legato.io/t/how-to-know-if-avsession-is-open-on-app-restart/4830/9 "2019-11-14T22:47:23Z")

</div>

You mean all the AT commamd returns error?  
This is strange, i never encounter this before.
