Closed Bug 761482 Opened 12 years ago Closed 12 years ago

WebMobileConnection: make {voice|data}.operator an nsIDOMMozMobileOperatorInfo

Categories

(Core :: DOM: Device Interfaces, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16
blocking-kilimanjaro +
blocking-basecamp +

People

(Reporter: philikon, Assigned: marshall)

References

Details

(Keywords: dev-doc-needed)

Attachments

(1 file, 2 obsolete files)

This will allow us to read the MCC and MNC from content. Which is useful for all sorts of things, e.g. automatically configuring mobile network parameters.
Hey Marshall, mind taking this? :D
Assignee: nobody → marshall
blocking-basecamp: --- → ?
blocking-kilimanjaro: --- → ?
Yup! in fact, I've already done it in preparation for my patch for Bug #759637 :) I'll split out the patch here
(In reply to Marshall Culpepper [:marshall_law] from comment #2)
> Yup! in fact, I've already done it in preparation for my patch for Bug
> #759637 :) I'll split out the patch here

<3
blocking-basecamp: ? → +
blocking-kilimanjaro: ? → +
Attachment #631122 - Flags: superreview?(jonas)
Attachment #631122 - Flags: review?(philipp)
Corresponding Gaia pull request:
https://github.com/mozilla-b2g/gaia/pull/1620
One thing that has been bugging me is the inconsistency of nomenclature in the DOM API, i.e. "operator" vs "network".

This is mainly because of nomenclature differences in the Android RIL constant values, but those can easily be hidden as implementation details. Along with this change, I'm going to make the following DOM API updates:

rename MobileOperatorInfo -> MobileNetworkInfo
rename MobilleConnectionInfo.operator -> MobileConnectionInfo.network

With this change, getNetworks() will return an array of MobileNetworkInfo, which sounds much better :)

This will also pave the way for clearer names for the upcoming network selection APIs in Bug #759637
Blocks: 759637
Attachment #631122 - Flags: superreview?(jonas) → superreview+
Updated to make the API naming more consistent
Attachment #631122 - Attachment is obsolete: true
Attachment #631122 - Flags: review?(philipp)
Attachment #631468 - Flags: superreview?(jonas)
Attachment #631468 - Flags: review?(philipp)
Attachment #631468 - Flags: superreview?(jonas) → superreview+
Comment on attachment 631468 [details] [diff] [review]
MobileOperatorInfo -> MobileNetworkInfo, MobileConnectionInfo.network - v1

Review of attachment 631468 [details] [diff] [review]:
-----------------------------------------------------------------

Great patch! Only a few minor coding style nits.

::: dom/system/gonk/RILContentHelper.js
@@ +122,5 @@
>                                                   Ci.nsIRILContentHelper]}),
>  
> +  updateConnectionInfo: function updateConnectionInfo(srcInfo, destInfo) {
> +    for (let key in srcInfo) {
> +      if (key != 'network') {

Nit: double quotes

@@ +135,5 @@
> +    }
> +
> +    let network = destInfo.network;
> +    if (!network) {
> +        network = destInfo.network = new MobileNetworkInfo();

Nit: indent by 2 spaces

::: dom/system/gonk/ril_worker.js
@@ +2833,5 @@
> +      this.operator.longName != operator[0] ||
> +      this.operator.shortName != operator[1] ||
> +      this.operator.numeric != operator[2]) {
> +
> +    this.operator = {

If I was really picky, I would suggest normalizing this to:

  if (!this.operator) {
    this.operator = {type: "operatorchange"};
  }
  if (this.operator.longName != operator[0] ||
      this.operator.shortName != operator[1] ||
      this.operator.numeric != operator[2]) {
    this.operator.longName = ...
    ...
  }

but the operator will change so infrequently, it really doesn't matter.

@@ +2836,5 @@
> +
> +    this.operator = {
> +      longName: operator[0],
> +      shortName: operator[1],
> +      mcc: 0, mnc: 0,

Nit: put each field on its own line.

@@ +2845,5 @@
> +    try {
> +      this._processNetworkTuple(networkTuple, this.operator);
> +    } catch (e) {
> +      debug("Error processing operator tuple: " + e);
> +     }

Nit: align }
Attachment #631468 - Flags: review?(philipp) → review+
(In reply to Philipp von Weitershausen [:philikon] from comment #9)

> ::: dom/system/gonk/ril_worker.js
> @@ +2833,5 @@
> > +      this.operator.longName != operator[0] ||
> > +      this.operator.shortName != operator[1] ||
> > +      this.operator.numeric != operator[2]) {
> > +
> > +    this.operator = {
> 
> If I was really picky, I would suggest normalizing this to:
> 
>   if (!this.operator) {
>     this.operator = {type: "operatorchange"};
>   }
>   if (this.operator.longName != operator[0] ||
>       this.operator.shortName != operator[1] ||
>       this.operator.numeric != operator[2]) {
>     this.operator.longName = ...
>     ...
>   }
> 
> but the operator will change so infrequently, it really doesn't matter.

I'm actually glad you called this out, as "this.operator.numeric" is no longer used, but this.operator.mnc / this.operator.mcc are :) I've made your suggested changes as well as cleaned up the logic (and retested/rebased), and all is looking good.
Updated to fix nits, ready for checkin
Attachment #631468 - Attachment is obsolete: true
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/d93f4177aa6b
Flags: in-testsuite+
Keywords: checkin-needed
Target Milestone: --- → mozilla16
https://hg.mozilla.org/mozilla-central/rev/d93f4177aa6b
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: