SoK/2021/StatusReport/Anjani Kumar

From KDE Community Wiki

Plasma Mobile: CAP Weather Alerts Support in KWeatherCore and D-Bus daemon for notifications in KWeather

Background

KWeatherCore was released with a well defined API such as requesting weather data just by a location name or co-ordinates.One part of this project is to add an API in this library to support weather alerts. This API adds support to read CAP(Common Alerting Protocol) documents from meteorological departments of governments around the world.

The other part is to build in this API a daemon in KWeather that sends weather alerts notifications. Plasma Mobile platform experience will greatly improve once this is complete.

Mentors

Links

Repositories

Phase 1

Project planning

CAP specification turned out to be vast and all the CAP sources of different countries use different features of the specification making it difficult to write a same CAP parser for all the countries. First of all we looked at the CAP specification document. Using this, Han wrote a skeleton class for us to store the fields described in this document. But there were limitations to this specification. Some common challenges are:-

  • Not all countries support filtering weather alerts by location. Even though some do, they mark them as experimental and can be dropped anytime without notice.
  • Some put restrictions on how often we can query for CAP alerts.

Devin gave us a list of all CAP sources of different countries. This was great as we learned that most countries provide a common ATOM/RSS feed of all weather alerts and they link to the actual CAP XML document. For example, this is the CAP feed of France [1]. Entries in this field contain a link to the original CAP data that we need to parse according to CAP specification.

So it was decided that we use this feed as a source for weather alerts of a country. Nikunj Goyal will be writing a feed parser. While I will be working on the CAP parser.

Work Done

This is some of the work that I've done so far. The complete work history can be tracked in this branch.

  • 2abd1f32 - Making an AbstractCAPProvider to download CAP feed or CAP data.
  • 5b6aa677 - Create a class to hold parsed CAP data.
  • bed8e354 - Create a class to hold parsed data of <alert> tag which is the root of a CAP xml. This class holds the vector of all <info> tags(held by AlertInfo class) that are present under one <alert> tag.
  • 17306862 -Complete the CAP Xml parser written using QXmlStreamReader

What I've learnt so far

This is the first time I'm working on a library. Also the first time reading a protocol specification and writing an implementation for it.I've done C++ projects but not in this depth. Working on a library makes one think about many things like what needs to exported, maintaining binary compatibility, etc. The mentors always provide key insights and help in undoing my bad habits while writing code. I read this document [2] thoroughly and learned many things especially how to maintain binary compatibility in a library.

Contact

If you want to make suggestions in this project do contact me.

Anjani Kumar

Email :- [email protected]

Matrix :- @anjanik012:kde.org

Telegram :- @anjanik012