UC3M

Telematic/Audiovisual Syst./Communication Syst. Engineering

Systems Architecture

September 2017 - January 2018

5.12.2.  Managing cells in your mobile phone

Work Plan

A mobile application needs to store the cells that are within range at each time. The number of cells is unknown and changes depending on the device position. Each cell has a unique identifier (positive integer) and a level of signal quality (number between 0 and 100). At each time, the application denotes one of the cells as the current (the one offering the highest signal quality). Every certain time, this information is updated depending on the signal quality field.

The following two functions are already implemented in the application:

  • ... new_cell(). Returns a pointer to a new cell structure. The result type is the data structure to store the cell information.

  • void remove_cell(...). Function opposite to the previous one, receives a pointer to a cell data structure and gets rid off it. You must call this function to make the data structure disappear.

You have to rite the following code portions:

  • Define the data structure to store the cell data and declaration of the variables required to stored the application data.

  • void fill_fields(...). Function that assigns the values given as parameters to the fields of a structure pointed to by an additional parameter. Decide first the parameters received by the function and then the code.

  • void update_current(...). Function that assigns as current the one with the higher quality signal.

  • What change would you make in the definition of the data structure to store the data in a circular form (that is, they are ordered as a circle)?

You may following the steps:

  1. How will you represent the set of cells? Do you know in advance how many cells you have to manipulate?

  2. Define the data structures required to store the set of cells. How do you distinguish the actual cell?

  3. What do you think it should be the prototype of the function new_cell?

  4. Define the prototype of the fill_fields function. Write its code.

  5. Implement the update_current function.

  6. What is the meaning of a circular structure and how to implement it in C?