Gaia/Network Alerts

From MozillaWiki
Jump to: navigation, search

Development Team

You'll be able to find the current team on the Firefox OS modules page.

The Network Alerts team is part of the larger Comms team.

Design Specs

See the CMAS user story in 2.1 features.

Source Code

The source code can be found in the gaia repository in github.

IRC

You can find us on the IRC server irc.mozilla.org, channel #fxos-comms(There is no specific channel for network-alerts, but you could still find devs here).

Filing bugs

You can file bug on Bugzilla. Please include the Firefox OS version you use, and possibly a screenshot or a video.

Debugging with emulator

First you will need a emulator build to run the emulator. Then you can connect to the telnet interface (on the port 5554) so that you can enter commands.

Alerts are just specific cell broadcast messages. So we'll use the "cbs" command of the emulator.

Send a GSM alert

Enter the command "cbs pdu [PDU_HEXSTRING]" for firing the fake alert message. Here is the example:

 cbs pdu C0021112011154741914AFA7C76B9058FEBEBB41E6371EA4AEB7E173D0DB5E9683E8E832881DD6E741E4F7B9D168341A8D46A3D168341A8D46A3D168341A8D46A3D168341A8D46A3D168341A8D46A3D168341A8D46A3D100

Where:

  • C002
    Serial Number. The couple Serial Number / Message ID should uniquely identify the message (maybe only the Serial Number is enough -- not sure here).
  • 1112
    Message ID. We currently support GSM Alerts from 4370 (0x1112) to 4399 (0x112F).
  • 01
    Data Coding Scheme: 01 is 7 bits.
  • 1
    Page Index: page index: There is only 1 page and it's this page, so we set the page index of this PDU to 1.
  • 1
    Total Number of Pages
  • 54741914AFA7C76B9058FEBEBB41E6371EA4AEB7E173D0DB5E9683E8E832881DD6E741E4F7B9D168341A8D46A3D168341A8D46A3D168341A8D46A3D168341A8D46A3D168341A8D46A3D168341A8D46A3D100
    Message content (with Fixed Length of 82 octets and with <CR> 0x0D as padding characters) : The quick brown fox jumps over the lazy dog

The message ID parameter represents different channels. Please reference |9.4.1.2.2 Message Identifier| in 3GPP TS 23.041.

<CR> is defined as padding characters in CBS messages. Please reference |6.2.1 GSM 7 bit Default Alphabet | in 3GPP TS 23.038.

Send a UMTS alert

 cbs pdu 011112C005010154741914AFA7C76B9058FEBEBB41E6371EA4AEB7E173D0DB5E9683E8E832881DD6E741E4F7B9D168341A8D46A3D168341A8D46A3D168341A8D46A3D168341A8D46A3D168341A8D46A3D168341A8D46A3D10052

Where:

  • 01
    Message Type -> CB_UMTS_MESSAGE_TYPE_CBS
  • 1112
    Message ID
  • C005
    Serial Number
  • 01
    Data Coding Scheme. 01 is 7 bits.
  • 01
    Num of Pages
  • 54741914AFA7C76B9058FEBEBB41E6371EA4AEB7E173D0DB5E9683E8E832881DD6E741E4F7B9D168341A8D46A3D168341A8D46A3D168341A8D46A3D168341A8D46A3D168341A8D46A3D168341A8D46A3D100
    Message content: The quick brown fox jumps over the lazy dog
  • 52
    CBS-Message-Information-Length. We set it to maximal number of octets per page (82) with <CR> 0x0D as padding characters.

Changing the Data Coding Scheme

To send a custom message more easily, we can change the Data Coding Scheme to UCS2.

Send a GSM alert in UCS2

 cbs pdu C0021112481100540068006500200071007500690063006b002000620072006f0077006e00200066006f00780020006a0075006d007000730020006f007600650072000D000D000D000D000D000D000D000D000D000D000D

Where:

  • C002
    Serial Number. The couple Serial Number / Message ID should uniquely identify the message (maybe only the Serial Number is enough -- not sure here).
  • 1112
    Message ID. We currently support GSM Alerts from 4370 (0x1112) to 4399 (0x112F).
  • 48
    Data Coding Scheme: 0x48, UCS2 encoding.
  • 1
    Page Index: There is only 1 page and it's this page, so we set the page index of this PDU to 1.
  • 1
    Total Number of Pages
  • 00540068006500200071007500690063006b002000620072006f0077006e00200066006f00780020006a0075006d007000730020006f007600650072000D000D000D000D000D000D000D000D000D000D000D
    Message content (with fixed length of 82 octets and <CR> 0x000D as padding characters) : The quick brown fox jumps over the lazy dog

Send a UMTS alert in UCS2

 cbs pdu 011112C005480100540068006500200071007500690063006b002000620072006f0077006e00200066006f00780020006a0075006d007000730020006f007600650072000D000D000D000D000D000D000D000D000D000D000D52

Where:

  • 01
    Message Type -> CB_UMTS_MESSAGE_TYPE_CBS
  • 1112
    Message ID
  • C005
    Serial Number
  • 48
    Data Coding Scheme: 0x48, UCS2 encoding.
  • 01
    Num of Pages
  • 00540068006500200071007500690063006b002000620072006f0077006e00200066006f00780020006a0075006d007000730020006f007600650072000D000D000D000D000D000D000D000D000D000D000D
    Message content: The quick brown fox jumps over the lazy dog
  • 52
    CBS-Message-Information-Length. We set it to maximal number of octets per page (82) with <CR> 0x0D as padding characters.

Debugging with WebIDE

First you need to open WebIDE and connect to your FxOS Device (USB or via WiFi) and then perform the following steps:

  • Select "Main Process" in the process list;
  • Open DevTools->Scratchpad (it should be enabled in DevTools settings);
  • Paste script below to the Scratchpad;
  • Modify cellBroadcastMessage with required parameters and press Run.
let cellBroadcastMessage = {
  messageId: 4370,
  serviceId: 0,
  gsmGeographicalScope: null,
  messageCode: 0,
  language: null,
  body: 'Tsunami!',
  messageClass: 6,
  timestamp: Date.now(),
  cdmaServiceCategory: null,
  etws: null
};

var sysMessageManager = Cc["@mozilla.org/system-message-internal;1"].getService(Ci.nsISystemMessagesInternal);
sysMessageManager.broadcastMessage('cellbroadcast-received', cellBroadcastMessage, {});

serviceId is the SIM where the message comes from.

The alert message structure

Please reference the CellBroadcast in gecko layer

Some future development

Handling all alert message in network-alerts app

  • bug 1093922: Currently we only handled CMAS message in network-alerts and handled rest of cell-broadcast messages in system app cellbroadcast module. In long term we will need to remove this module from system and handle all the alert message in network-alerts app.