B2G/hardware/ril/mock-ril/src/js/mock_ril.js
/**
 * Dispatch incoming requests from RIL to the appropriate component.
 */
Dispatch incoming requests from RIL to the appropriate component.
Dispatch incoming requests from RIL to the appropriate component .
function onRilRequest(reqNum, token, requestProtobuf) {
    try {
        rilErrCode = RIL_E_SUCCESS;
        if (typeof reqNum != 'number') {
            print('onRilRequest: reqNum is not a number');
            rilErrCode = RIL_E_GENERIC_FAILURE;
        }
        if (typeof token != 'number') {
            print('onRilRequest: token is not a number');
            rilErrCode = RIL_E_GENERIC_FAILURE;
        }
        if (typeof requestProtobuf != 'object') {
            print('onRilRequest: requestProtobuf is not an object');
            rilErrCode = RIL_E_GENERIC_FAILURE;
        }
        if (rilErrCode != RIL_E_SUCCESS) {
            sendRilRequestComplete(rilErrCode, reqNum, token);
            return 'onRilRequest X: invalid parameter';
        }
        try {
            entry = dispatchTable[reqNum];
            if (typeof entry == 'undefined') {
                throw ('entry = dispatchTable[' + reqNum + '] was undefined');
            } else {
                req = new Request(reqNum, token, requestProtobuf, rilSchema, entry.schemaName);
                for(i = 0; i < entry.components.length; i++) {
                    entry.components[i].add(req);
                }
            }
        } catch (err) {
            print('onRilRequest: Unknown reqNum=' + reqNum + ' err=' + err);
            sendRilRequestComplete(RIL_E_REQUEST_NOT_SUPPORTED, reqNum, token);
        }
    } catch (err) {
        print('onRilRequest X: Exception err=' + err);
        return('onRilRequest X: Exception err=' + err);
    }
    return 'onRilRequest X';
}
function onRilRequest ( reqNum , token , requestProtobuf ) { try { rilErrCode = RIL_E_SUCCESS ; if ( typeof reqNum != 'number' ) { print ( 'onRilRequest: reqNum is not a number' ) ; rilErrCode = RIL_E_GENERIC_FAILURE ; } if ( typeof token != 'number' ) { print ( 'onRilRequest: token is not a number' ) ; rilErrCode = RIL_E_GENERIC_FAILURE ; } if ( typeof requestProtobuf != 'object' ) { print ( 'onRilRequest: requestProtobuf is not an object' ) ; rilErrCode = RIL_E_GENERIC_FAILURE ; } if ( rilErrCode != RIL_E_SUCCESS ) { sendRilRequestComplete ( rilErrCode , reqNum , token ) ; return 'onRilRequest X: invalid parameter' ; } try { entry = dispatchTable [ reqNum ] ; if ( typeof entry == 'undefined' ) { throw ( 'entry = dispatchTable[' + reqNum + '] was undefined' ) ; } else { req = new Request ( reqNum , token , requestProtobuf , rilSchema , entry . schemaName ) ; for ( i = 0 ; i < entry . components . length ; i ++ ) { entry . components [ i ] . add ( req ) ; } } } catch ( err ) { print ( 'onRilRequest: Unknown reqNum=' + reqNum + ' err=' + err ) ; sendRilRequestComplete ( RIL_E_REQUEST_NOT_SUPPORTED , reqNum , token ) ; } } catch ( err ) { print ( 'onRilRequest X: Exception err=' + err ) ; return ( 'onRilRequest X: Exception err=' + err ) ; } return 'onRilRequest X' ; }
Dispatch incoming requests from RIL to the appropriate component.
Dispatch incoming requests from RIL to the appropriate component .
//print('onRilRequest E: reqNum=' + reqNum + ' token=' + token); /**
         * Validate parameters
         */ //print('onRilRequest: get entry from dispatchTable reqNum=' + reqNum); // print('onRilRequest X: reqNum=' + reqNum + ' token=' + token);