Venkateshwarlu Domakonda | aa25363 | 2013-03-25 16:53:03 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2009-2012, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are met: |
| 6 | * * Redistributions of source code must retain the above copyright |
| 7 | * notice, this list of conditions and the following disclaimer. |
| 8 | * * Redistributions in binary form must reproduce the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer in the |
| 10 | * documentation and/or other materials provided with the distribution. |
| 11 | * * Neither the name of The Linux Foundation nor |
| 12 | * the names of its contributors may be used to endorse or promote |
| 13 | * products derived from this software without specific prior written |
| 14 | * permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 19 | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| 20 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 23 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 25 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 26 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | package qcom.fmradio; |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 30 | import android.util.Log; |
| 31 | import java.util.Arrays; |
| 32 | import java.lang.Runnable; |
| 33 | import qcom.fmradio.FmReceiver; |
Venkateshwarlu Domakonda | aa25363 | 2013-03-25 16:53:03 +0530 | [diff] [blame] | 34 | |
| 35 | class FmReceiverJNI { |
| 36 | /** |
| 37 | * General success |
| 38 | */ |
| 39 | static final int FM_JNI_SUCCESS = 0; |
| 40 | |
| 41 | /** |
| 42 | * General failure |
| 43 | */ |
| 44 | static final int FM_JNI_FAILURE = -1; |
| 45 | |
| 46 | /** |
| 47 | * native method: Open device |
| 48 | * @return The file descriptor of the device |
| 49 | * |
| 50 | */ |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 51 | private static final String TAG = "FmReceiverJNI"; |
Venkateshwarlu Domakonda | aa25363 | 2013-03-25 16:53:03 +0530 | [diff] [blame] | 52 | |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 53 | static { |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 54 | Log.d(TAG, "classinit native called"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 55 | classInitNative(); |
| 56 | } |
| 57 | static native void classInitNative(); |
| 58 | static native void initNative(); |
| 59 | static native void cleanupNative(); |
| 60 | |
himta ram | af268f2 | 2018-05-15 13:20:19 +0530 | [diff] [blame] | 61 | private FmRxEvCallbacks mCallback; |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 62 | static private final int STD_BUF_SIZE = 256; |
| 63 | static private byte[] mRdsBuffer = new byte[STD_BUF_SIZE]; |
| 64 | |
| 65 | public static byte[] getPsBuffer(byte[] buff) { |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 66 | Log.d(TAG, "getPsBuffer enter"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 67 | buff = Arrays.copyOf(mRdsBuffer, mRdsBuffer.length); |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 68 | Log.d(TAG, "getPsBuffer exit"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 69 | return buff; |
| 70 | } |
| 71 | |
| 72 | public void AflistCallback(byte[] aflist) { |
| 73 | Log.e(TAG, "AflistCallback enter " ); |
| 74 | if (aflist == null) { |
| 75 | Log.e(TAG, "aflist null return "); |
| 76 | return; |
| 77 | } |
| 78 | mRdsBuffer = Arrays.copyOf(aflist, aflist.length); |
| 79 | FmReceiver.mCallback.FmRxEvRdsAfInfo(); |
| 80 | Log.e(TAG, "AflistCallback exit " ); |
| 81 | } |
| 82 | |
Kamal Negi | 8813e0f | 2016-02-10 19:12:09 +0530 | [diff] [blame] | 83 | public void getSigThCallback(int val, int status) |
| 84 | { |
| 85 | Log.d(TAG, "get Signal Threshold callback"); |
| 86 | |
| 87 | FmReceiver.mCallback.FmRxEvGetSignalThreshold(val, status); |
| 88 | } |
| 89 | |
| 90 | public void getChDetThCallback(int val, int status) |
| 91 | { |
| 92 | FmReceiver.mCallback.FmRxEvGetChDetThreshold(val, status); |
| 93 | } |
| 94 | |
| 95 | public void setChDetThCallback(int status) |
| 96 | { |
| 97 | FmReceiver.mCallback.FmRxEvSetChDetThreshold(status); |
| 98 | } |
| 99 | |
| 100 | public void DefDataRdCallback(int val, int status) |
| 101 | { |
| 102 | FmReceiver.mCallback.FmRxEvDefDataRead(val, status); |
| 103 | } |
| 104 | |
| 105 | public void DefDataWrtCallback(int status) |
| 106 | { |
| 107 | FmReceiver.mCallback.FmRxEvDefDataWrite(status); |
| 108 | } |
| 109 | |
| 110 | public void getBlendCallback(int val, int status) |
| 111 | { |
| 112 | FmReceiver.mCallback.FmRxEvGetBlend(val, status); |
| 113 | } |
| 114 | |
| 115 | public void setBlendCallback(int status) |
| 116 | { |
| 117 | FmReceiver.mCallback.FmRxEvSetBlend(status); |
| 118 | } |
| 119 | |
| 120 | public void getStnParamCallback(int val, int status) |
| 121 | { |
| 122 | FmReceiver.mCallback.FmRxGetStationParam(val, status); |
| 123 | } |
| 124 | |
| 125 | public void getStnDbgParamCallback(int val, int status) |
| 126 | { |
| 127 | FmReceiver.mCallback.FmRxGetStationDbgParam(val, status); |
| 128 | } |
| 129 | |
Rupesh Tatiya | 9917f92 | 2017-06-21 13:00:43 +0530 | [diff] [blame] | 130 | public void enableSlimbusCallback(int status) |
| 131 | { |
| 132 | Log.d(TAG, "++enableSlimbusCallback" ); |
| 133 | FmReceiver.mCallback.FmRxEvEnableSlimbus(status); |
| 134 | Log.d(TAG, "--enableSlimbusCallback" ); |
| 135 | } |
| 136 | |
himta ram | 5698463 | 2018-03-19 13:07:29 +0530 | [diff] [blame] | 137 | public void enableSoftMuteCallback(int status) |
| 138 | { |
| 139 | Log.d(TAG, "++enableSoftMuteCallback" ); |
| 140 | FmReceiver.mCallback.FmRxEvEnableSoftMute(status); |
| 141 | Log.d(TAG, "--enableSoftMuteCallback" ); |
| 142 | } |
| 143 | |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 144 | public void RtPlusCallback(byte[] rtplus) { |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 145 | Log.d(TAG, "RtPlusCallback enter " ); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 146 | if (rtplus == null) { |
| 147 | Log.e(TAG, "psInfo null return "); |
| 148 | return; |
| 149 | } |
| 150 | mRdsBuffer = Arrays.copyOf(rtplus, rtplus.length); |
| 151 | FmReceiver.mCallback.FmRxEvRTPlus(); |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 152 | Log.d(TAG, "RtPlusCallback exit " ); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | public void RtCallback(byte[] rt) { |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 156 | Log.d(TAG, "RtCallback enter " ); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 157 | if (rt == null) { |
| 158 | Log.e(TAG, "psInfo null return "); |
| 159 | return; |
| 160 | } |
| 161 | mRdsBuffer = Arrays.copyOf(rt, rt.length); |
| 162 | FmReceiver.mCallback.FmRxEvRdsRtInfo(); |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 163 | Log.d(TAG, "RtCallback exit " ); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | public void ErtCallback(byte[] ert) { |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 167 | Log.d(TAG, "ErtCallback enter " ); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 168 | if (ert == null) { |
| 169 | Log.e(TAG, "ERT null return "); |
| 170 | return; |
| 171 | } |
| 172 | mRdsBuffer = Arrays.copyOf(ert, ert.length); |
| 173 | FmReceiver.mCallback.FmRxEvERTInfo(); |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 174 | Log.d(TAG, "RtCallback exit " ); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 175 | } |
| 176 | |
Satish kumar sugasi | d8731b7 | 2016-01-27 14:45:45 -0800 | [diff] [blame] | 177 | public void EccCallback(byte[] ecc) { |
| 178 | Log.i(TAG, "EccCallback enter " ); |
| 179 | if (ecc == null) { |
| 180 | Log.e(TAG, "ECC null return "); |
| 181 | return; |
| 182 | } |
| 183 | mRdsBuffer = Arrays.copyOf(ecc, ecc.length); |
| 184 | FmReceiver.mCallback.FmRxEvECCInfo(); |
| 185 | Log.i(TAG, "EccCallback exit " ); |
| 186 | } |
| 187 | |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 188 | public void PsInfoCallback(byte[] psInfo) { |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 189 | Log.d(TAG, "PsInfoCallback enter " ); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 190 | if (psInfo == null) { |
| 191 | Log.e(TAG, "psInfo null return "); |
| 192 | return; |
| 193 | } |
| 194 | Log.e(TAG, "length = " +psInfo.length); |
| 195 | mRdsBuffer = Arrays.copyOf(psInfo, psInfo.length); |
| 196 | FmReceiver.mCallback.FmRxEvRdsPsInfo(); |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 197 | Log.d(TAG, "PsInfoCallback exit"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | public void enableCallback() { |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 201 | Log.d(TAG, "enableCallback enter"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 202 | FmTransceiver.setFMPowerState(FmTransceiver.FMState_Rx_Turned_On); |
| 203 | Log.v(TAG, "RxEvtList: CURRENT-STATE : FMRxStarting ---> NEW-STATE : FMRxOn"); |
| 204 | FmReceiver.mCallback.FmRxEvEnableReceiver(); |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 205 | Log.d(TAG, "enableCallback exit"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 206 | } |
| 207 | |
| 208 | public void tuneCallback(int freq) { |
| 209 | int state; |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 210 | Log.d(TAG, "tuneCallback enter"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 211 | state = FmReceiver.getSearchState(); |
| 212 | switch(state) { |
| 213 | case FmTransceiver.subSrchLevel_SrchAbort: |
| 214 | Log.v(TAG, "Current state is SRCH_ABORTED"); |
| 215 | Log.v(TAG, "Aborting on-going search command..."); |
| 216 | /* intentional fall through */ |
| 217 | case FmTransceiver.subSrchLevel_SeekInPrg : |
| 218 | Log.v(TAG, "Current state is " + state); |
| 219 | FmReceiver.setSearchState(FmTransceiver.subSrchLevel_SrchComplete); |
| 220 | Log.v(TAG, "RxEvtList: CURRENT-STATE : Search ---> NEW-STATE : FMRxOn"); |
| 221 | FmReceiver.mCallback.FmRxEvSearchComplete(freq); |
| 222 | break; |
| 223 | default: |
| 224 | if (freq > 0) |
| 225 | FmReceiver.mCallback.FmRxEvRadioTuneStatus(freq); |
| 226 | else |
| 227 | Log.e(TAG, "get frequency command failed"); |
| 228 | break; |
| 229 | } |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 230 | Log.d(TAG, "tuneCallback exit"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 231 | } |
| 232 | |
| 233 | public void seekCmplCallback(int freq) { |
| 234 | int state; |
| 235 | |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 236 | Log.d(TAG, "seekCmplCallback enter"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 237 | state = FmReceiver.getSearchState(); |
Satish kumar sugasi | 44497e4 | 2016-10-18 23:11:59 -0700 | [diff] [blame] | 238 | switch (state) { |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 239 | case FmTransceiver.subSrchLevel_ScanInProg: |
| 240 | Log.v(TAG, "Current state is " + state); |
| 241 | FmReceiver.setSearchState(FmTransceiver.subSrchLevel_SrchComplete); |
| 242 | Log.v(TAG, "RxEvtList: CURRENT-STATE : Search ---> NEW-STATE :FMRxOn"); |
| 243 | FmReceiver.mCallback.FmRxEvSearchComplete(freq); |
| 244 | break; |
| 245 | case FmTransceiver.subSrchLevel_SrchAbort: |
| 246 | Log.v(TAG, "Current state is SRCH_ABORTED"); |
| 247 | Log.v(TAG, "Aborting on-going search command..."); |
| 248 | FmReceiver.setSearchState(FmTransceiver.subSrchLevel_SrchComplete); |
| 249 | Log.v(TAG, "RxEvtList: CURRENT-STATE : Search ---> NEW-STATE : FMRxOn"); |
| 250 | FmReceiver.mCallback.FmRxEvSearchComplete(freq); |
| 251 | break; |
| 252 | } |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 253 | Log.d(TAG, "seekCmplCallback exit"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 254 | } |
| 255 | |
Satish kumar sugasi | 44497e4 | 2016-10-18 23:11:59 -0700 | [diff] [blame] | 256 | public void srchListCallback(byte[] scan_tbl) { |
| 257 | int state; |
| 258 | state = FmReceiver.getSearchState(); |
| 259 | switch (state) { |
| 260 | case FmTransceiver.subSrchLevel_SrchListInProg: |
| 261 | Log.v(TAG, "FmRxEventListener: Current state is AUTO_PRESET_INPROGRESS"); |
| 262 | FmReceiver.setSearchState(FmTransceiver.subSrchLevel_SrchComplete); |
| 263 | Log.v(TAG, "RxEvtList: CURRENT-STATE : Search ---> NEW-STATE : FMRxOn"); |
| 264 | FmReceiver.mCallback.FmRxEvSearchListComplete(); |
| 265 | break; |
| 266 | case FmTransceiver.subSrchLevel_SrchAbort: |
| 267 | Log.v(TAG, "Current state is SRCH_ABORTED"); |
| 268 | Log.v(TAG, "Aborting on-going SearchList command..."); |
| 269 | FmReceiver.setSearchState(FmTransceiver.subSrchLevel_SrchComplete); |
| 270 | Log.v(TAG, "RxEvtList: CURRENT-STATE : Search ---> NEW-STATE : FMRxOn"); |
| 271 | FmReceiver.mCallback.FmRxEvSearchCancelled(); |
| 272 | break; |
| 273 | } |
| 274 | } |
| 275 | |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 276 | public void scanNxtCallback() { |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 277 | Log.d(TAG, "scanNxtCallback enter"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 278 | FmReceiver.mCallback.FmRxEvSearchInProgress(); |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 279 | Log.d(TAG, "scanNxtCallback exit"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | public void stereostsCallback(boolean stereo) { |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 283 | Log.d(TAG, "stereostsCallback enter"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 284 | FmReceiver.mCallback.FmRxEvStereoStatus (stereo); |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 285 | Log.d(TAG, "stereostsCallback exit"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | public void rdsAvlStsCallback(boolean rdsAvl) { |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 289 | Log.d(TAG, "rdsAvlStsCallback enter"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 290 | FmReceiver.mCallback.FmRxEvRdsLockStatus(rdsAvl); |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 291 | Log.d(TAG, "rdsAvlStsCallback exit"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 292 | } |
| 293 | |
| 294 | public void disableCallback() { |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 295 | Log.d(TAG, "disableCallback enter"); |
Satish kumar sugasi | 8a34ad3 | 2015-10-19 18:09:49 -0700 | [diff] [blame] | 296 | if (FmTransceiver.getFMPowerState() == FmTransceiver.subPwrLevel_FMTurning_Off) { |
| 297 | /*Set the state as FMOff */ |
| 298 | FmTransceiver.setFMPowerState(FmTransceiver.FMState_Turned_Off); |
| 299 | Log.v(TAG, "RxEvtList: CURRENT-STATE : FMTurningOff ---> NEW-STATE : FMOff"); |
| 300 | FmReceiver.mCallback.FmRxEvDisableReceiver(); |
| 301 | } else { |
| 302 | FmTransceiver.setFMPowerState(FmTransceiver.FMState_Turned_Off); |
| 303 | Log.d(TAG, "Unexpected RADIO_DISABLED recvd"); |
| 304 | Log.v(TAG, "RxEvtList: CURRENT-STATE : FMRxOn ---> NEW-STATE : FMOff"); |
| 305 | FmReceiver.mCallback.FmRxEvRadioReset(); |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 306 | Log.d(TAG, "disableCallback exit"); |
Satish kumar sugasi | 8a34ad3 | 2015-10-19 18:09:49 -0700 | [diff] [blame] | 307 | } |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 308 | } |
| 309 | |
| 310 | public FmReceiverJNI(FmRxEvCallbacks callback) { |
| 311 | mCallback = callback; |
| 312 | if (mCallback == null) |
| 313 | Log.e(TAG, "mCallback is null in JNI"); |
Satish kumar sugasi | 10da44e | 2016-03-14 17:52:50 -0700 | [diff] [blame] | 314 | Log.d(TAG, "init native called"); |
Satish kumar sugasi | 644b488 | 2016-05-04 20:15:31 -0700 | [diff] [blame] | 315 | initNative(); |
| 316 | } |
| 317 | |
himta ram | af268f2 | 2018-05-15 13:20:19 +0530 | [diff] [blame] | 318 | public FmReceiverJNI() { |
| 319 | Log.d(TAG, "FmReceiverJNI constructor called"); |
| 320 | } |
| 321 | |
Venkateshwarlu Domakonda | aa25363 | 2013-03-25 16:53:03 +0530 | [diff] [blame] | 322 | /** |
| 323 | * native method: |
| 324 | * @param fd |
| 325 | * @param control |
| 326 | * @param field |
| 327 | * @return |
| 328 | */ |
| 329 | static native int audioControlNative(int fd, int control, int field); |
| 330 | |
| 331 | /** |
| 332 | * native method: cancels search |
| 333 | * @param fd file descriptor of device |
| 334 | * @return May return |
| 335 | * {@link #FM_JNI_SUCCESS} |
| 336 | * {@link #FM_JNI_FAILURE} |
| 337 | */ |
| 338 | static native int cancelSearchNative(int fd); |
| 339 | |
| 340 | /** |
Venkateshwarlu Domakonda | aa25363 | 2013-03-25 16:53:03 +0530 | [diff] [blame] | 341 | * native method: get frequency |
| 342 | * @param fd file descriptor of device |
| 343 | * @return Returns frequency in int form |
| 344 | */ |
| 345 | static native int getFreqNative(int fd); |
| 346 | |
| 347 | /** |
| 348 | * native method: set frequency |
| 349 | * @param fd file descriptor of device |
| 350 | * @param freq freq to be set in int form |
| 351 | * @return {@link #FM_JNI_SUCCESS} |
| 352 | * {@link #FM_JNI_FAILURE} |
| 353 | * |
| 354 | */ |
| 355 | static native int setFreqNative(int fd, int freq); |
| 356 | |
| 357 | /** |
| 358 | * native method: get v4l2 control |
| 359 | * @param fd file descriptor of device |
| 360 | * @param id v4l2 id to be retrieved |
| 361 | * @return Returns current value of the |
| 362 | * v4l2 control |
| 363 | */ |
| 364 | static native int getControlNative (int fd, int id); |
| 365 | |
| 366 | /** |
| 367 | * native method: set v4l2 control |
| 368 | * @param fd file descriptor of device |
| 369 | * @param id v4l2 control to be set |
| 370 | * @param value value to be set |
| 371 | * @return {@link #FM_JNI_SUCCESS} |
| 372 | * {@link #FM_JNI_FAILURE} |
| 373 | */ |
| 374 | static native int setControlNative (int fd, int id, int value); |
| 375 | |
| 376 | /** |
| 377 | * native method: start search |
| 378 | * @param fd file descriptor of device |
| 379 | * @param dir search direction |
| 380 | * @return {@link #FM_JNI_SUCCESS} |
| 381 | * {@link #FM_JNI_FAILURE} |
| 382 | */ |
| 383 | static native int startSearchNative (int fd, int dir); |
| 384 | |
| 385 | /** |
Venkateshwarlu Domakonda | aa25363 | 2013-03-25 16:53:03 +0530 | [diff] [blame] | 386 | * native method: get RSSI value of the |
| 387 | * received signal |
| 388 | * @param fd file descriptor of device |
| 389 | * @return Returns signal strength in int form |
| 390 | * Signal value range from -120 to 10 |
| 391 | */ |
| 392 | static native int getRSSINative (int fd); |
| 393 | |
| 394 | /** |
| 395 | * native method: set FM band |
| 396 | * @param fd file descriptor of device |
| 397 | * @param low lower band |
| 398 | * @param high higher band |
| 399 | * @return {@link #FM_JNI_SUCCESS} |
| 400 | * {@link #FM_JNI_FAILURE} |
| 401 | */ |
| 402 | static native int setBandNative (int fd, int low, int high); |
| 403 | |
| 404 | /** |
| 405 | * native method: get lower band |
| 406 | * @param fd file descriptor of device |
| 407 | * @return Returns lower band in int form |
| 408 | */ |
| 409 | static native int getLowerBandNative (int fd); |
| 410 | |
| 411 | /** |
| 412 | * native method: get upper band |
| 413 | * @param fd file descriptor of device |
| 414 | * @return Returns upper band in int form |
| 415 | */ |
| 416 | static native int getUpperBandNative (int fd); |
| 417 | |
| 418 | /** |
| 419 | * native method: force Mono/Stereo mode |
| 420 | * @param fd file descriptor of device |
| 421 | * @param val force mono/stereo indicator |
| 422 | * @return {@link #FM_JNI_SUCCESS} |
| 423 | * {@link #FM_JNI_FAILURE} |
| 424 | */ |
| 425 | static native int setMonoStereoNative (int fd, int val); |
| 426 | |
| 427 | /** |
| 428 | * native method: get Raw RDS data |
| 429 | * @param fd file descriptor of device |
| 430 | * @param buff[] buffer |
| 431 | * @param count number of bytes to be read |
| 432 | * @return Returns number of bytes read |
| 433 | */ |
| 434 | static native int getRawRdsNative (int fd, byte buff[], int count); |
| 435 | |
Venkateshwarlu Domakonda | aa25363 | 2013-03-25 16:53:03 +0530 | [diff] [blame] | 436 | /** |
| 437 | * native method: Sets the repeat count for Programme service |
| 438 | * transmission. |
| 439 | * @param fd file descriptor of device |
| 440 | * @param repeatcount number of times PS string to be transmited |
| 441 | * repeatedly. |
| 442 | * @return {@link #FM_JNI_SUCCESS} |
| 443 | * {@link #FM_JNI_FAILURE} |
| 444 | */ |
| 445 | static native int setPSRepeatCountNative(int fd, int repeatCount); |
| 446 | /** |
| 447 | * native method: Sets the power level for the tramsmitter |
| 448 | * transmission. |
| 449 | * @param fd file descriptor of device |
| 450 | * @param powLevel is the level at which transmitter operates. |
| 451 | * @return {@link #FM_JNI_SUCCESS} |
| 452 | * {@link #FM_JNI_FAILURE} |
| 453 | */ |
| 454 | static native int setTxPowerLevelNative(int fd, int powLevel); |
Venkateshwarlu Domakonda | aa25363 | 2013-03-25 16:53:03 +0530 | [diff] [blame] | 455 | |
| 456 | /** |
| 457 | * native method: Configures the spur table |
| 458 | * @param fd file descriptor of device |
| 459 | * @return {@link #FM_JNI_SUCCESS} |
| 460 | * {@link #FM_JNI_FAILURE} |
| 461 | */ |
| 462 | static native int configureSpurTable(int fd); |
Venkateshwarlu Domakonda | c748b4b | 2014-05-19 10:41:10 +0530 | [diff] [blame] | 463 | |
| 464 | /** |
| 465 | * native method: Configures the new spur table |
| 466 | * @param fd file descriptor of device |
| 467 | * @return {@link #FM_JNI_SUCCESS} |
| 468 | * {@link #FM_JNI_FAILURE} |
| 469 | */ |
| 470 | static native int setSpurDataNative(int fd, short buff[], int len); |
Kamal Negi | ce09c30 | 2016-12-29 16:45:38 +0530 | [diff] [blame] | 471 | static native int enableSlimbus(int fd, int val); |
himta ram | 5698463 | 2018-03-19 13:07:29 +0530 | [diff] [blame] | 472 | static native int enableSoftMute(int fd, int val); |
Venkateshwarlu Domakonda | aa25363 | 2013-03-25 16:53:03 +0530 | [diff] [blame] | 473 | } |