1 /* 2 * 3 * Copyright 2001-2011 Texas Instruments, Inc. - http://www.ti.com/ 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 #include "android_runtime/AndroidRuntime.h" 19 #include "jni.h" 20 #include "JNIHelp.h" 21 #include "v4l2_JbtlLog.h" 22 #include "JFmTxNative.h" 23 24 #include <stdlib.h> 25 26 #define LOG_TAG "JFmTxNative" 27 #include <cutils/properties.h> 28 29 using namespace android; 30 static int radio_fd; 31 extern long jContext; 32 33 #undef VIDIOC_S_MODULATOR 34 #define VIDIOC_S_MODULATOR 1078220343 35 36 extern "C" { 37 #include <stdio.h> 38 #include <fcntl.h> 39 #include <asoundlib.h> 40 #include <linux/videodev.h> 41 #include <math.h> 42 #include <pthread.h> 43 #include <errno.h> 44 #include <string.h> 45 46 void nativeJFmTx_Callback(long context, int status, 47 int command, long value); 48 extern void MCP_HAL_LOG_EnableLogToAndroid(const char *app_name); 49 50 } //extern "C" 51 52 static jclass _sJClass; 53 static JavaVM *g_jVM = NULL; 54 55 static jmethodID _sMethodId_nativeCb_fmTxCmdEnable; 56 static jmethodID _sMethodId_nativeCb_fmTxCmdDisable; 57 static jmethodID _sMethodId_nativeCb_fmTxCmdDestroy; 58 static jmethodID _sMethodId_nativeCb_fmTxCmdTune; 59 static jmethodID _sMethodId_nativeCb_fmTxCmdGetTunedFrequency; 60 static jmethodID _sMethodId_nativeCb_fmTxCmdStartTransmission; 61 static jmethodID _sMethodId_nativeCb_fmTxCmdStopTransmission; 62 static jmethodID _sMethodId_nativeCb_fmTxCmdEnableRds; 63 static jmethodID _sMethodId_nativeCb_fmTxCmdDisableRds; 64 static jmethodID _sMethodId_nativeCb_fmTxCmdSetRdsTextRtMsg; 65 static jmethodID _sMethodId_nativeCb_fmTxCmdSetRdsTextPsMsg; 66 /* 67 static jmethodID _sMethodId_nativeCb_fmTxCmdSetRdsTransmissionMode; 68 // static jmethodID _sMethodId_nativeCb_fmTxCmdGetRdsTransmissionMode; 69 static jmethodID _sMethodId_nativeCb_fmTxCmdSetRdsTrafficCodes; 70 static jmethodID _sMethodId_nativeCb_fmTxCmdGetRdsTrafficCodes; 71 static jmethodID _sMethodId_nativeCb_fmTxCmdGetRdsTextPsMsg; 72 static jmethodID _sMethodId_nativeCb_fmTxCmdGetRdsTextRtMsg; 73 static jmethodID _sMethodId_nativeCb_fmTxCmdWriteRdsRawData; 74 static jmethodID _sMethodId_nativeCb_fmTxCmdReadRdsRawData; 75 static jmethodID _sMethodId_nativeCb_fmTxCmdChangeAudioSource; 76 */ 77 static jmethodID _sMethodId_nativeCb_fmTxCmdSetInterruptMask; 78 static jmethodID _sMethodId_nativeCb_fmTxCmdSetMonoStereoMode; 79 static jmethodID _sMethodId_nativeCb_fmTxCmdGetMonoStereoMode; 80 static jmethodID _sMethodId_nativeCb_fmTxCmdSetPowerLevel; 81 static jmethodID _sMethodId_nativeCb_fmTxCmdGetPowerLevel; 82 static jmethodID _sMethodId_nativeCb_fmTxCmdSetMuteMode; 83 static jmethodID _sMethodId_nativeCb_fmTxCmdGetMuteMode; 84 static jmethodID _sMethodId_nativeCb_fmTxCmdSetRdsAfCode; 85 static jmethodID _sMethodId_nativeCb_fmTxCmdGetRdsAfCode; 86 static jmethodID _sMethodId_nativeCb_fmTxCmdSetRdsPiCode; 87 static jmethodID _sMethodId_nativeCb_fmTxCmdGetRdsPiCode; 88 static jmethodID _sMethodId_nativeCb_fmTxCmdSetRdsPtyCode; 89 static jmethodID _sMethodId_nativeCb_fmTxCmdGetRdsPtyCode; 90 static jmethodID _sMethodId_nativeCb_fmTxCmdSetRdsTextRepertoire; 91 static jmethodID _sMethodId_nativeCb_fmTxCmdGetRdsTextRepertoire; 92 static jmethodID _sMethodId_nativeCb_fmTxCmdSetRdsPsDispalyMode; 93 static jmethodID _sMethodId_nativeCb_fmTxCmdGetRdsPsDispalyMode; 94 static jmethodID _sMethodId_nativeCb_fmTxCmdSetRdsPsDisplaySpeed; 95 static jmethodID _sMethodId_nativeCb_fmTxCmdGetRdsPsDisplaySpeed; 96 static jmethodID _sMethodId_nativeCb_fmTxCmdSetRdsTransmittedMask; 97 static jmethodID _sMethodId_nativeCb_fmTxCmdGetRdsTransmittedMask; 98 static jmethodID _sMethodId_nativeCb_fmTxCmdSetRdsMusicSpeechFlag ; 99 static jmethodID _sMethodId_nativeCb_fmTxCmdGetRdsMusicSpeechFlag ; 100 static jmethodID _sMethodId_nativeCb_fmTxCmdSetPreEmphasisFilter; 101 static jmethodID _sMethodId_nativeCb_fmTxCmdGetPreEmphasisFilter; 102 static jmethodID _sMethodId_nativeCb_fmTxCmdSetRdsExtendedCountryCode; 103 static jmethodID _sMethodId_nativeCb_fmTxCmdGetRdsExtendedCountryCode; 104 static jmethodID _sMethodId_nativeCb_fmTxCmdChangeDigitalAudioConfiguration; 105 106 107 108 int fm_read_transmitter_capabilities(int radio_fd) 109 { 110 struct v4l2_capability cap; 111 int res; 112 113 res = ioctl(radio_fd,VIDIOC_QUERYCAP,&cap); 114 if(res < 0) 115 { 116 V4L2_JBTL_LOGD("Failed to read %s capabilities\n",DEFAULT_RADIO_DEVICE); 117 return FM_FAILED; 118 } 119 if((cap.capabilities & V4L2_CAP_RADIO) == 0) 120 { 121 V4L2_JBTL_LOGD("%s is not radio devcie",DEFAULT_RADIO_DEVICE); 122 return FM_FAILED; 123 } 124 V4L2_JBTL_LOGD("\n***%s Info ****\n",DEFAULT_RADIO_DEVICE); 125 V4L2_JBTL_LOGD("Driver : %s\n",cap.driver); 126 V4L2_JBTL_LOGD("Card : %s\n",cap.card); 127 V4L2_JBTL_LOGD("Bus : %s\n",cap.bus_info); 128 V4L2_JBTL_LOGD("Capabilities : 0x%x\n",cap.capabilities); 129 130 return FM_SUCCESS; 131 } 132 133 static int nativeJFmTx_Create(JNIEnv *env,jobject obj,jobject jContextValue) 134 { 135 int fmStatus ; 136 137 V4L2_JBTL_LOGD("Java_JFmRx_nativeJFmRx_Create(): Entered"); 138 139 radio_fd = open(DEFAULT_RADIO_DEVICE, O_RDWR); 140 if(radio_fd < 0) 141 { 142 V4L2_JBTL_LOGD("Unable to open %s ..\n",DEFAULT_RADIO_DEVICE); 143 jniThrowIOException(env, errno); 144 return FM_FAILED; 145 } 146 147 fmStatus = fm_read_transmitter_capabilities(radio_fd); 148 if(fmStatus< 0) 149 { 150 close(radio_fd); 151 return fmStatus; 152 } 153 154 V4L2_JBTL_LOGD("nativeJFmRx_create:Exiting Successfully"); 155 156 return fmStatus; 157 return 0; 158 } 159 160 static jint nativeJFmTx_Destroy(JNIEnv *env, jobject obj,jlong jContextValue) 161 { 162 163 return 0; 164 165 } 166 167 168 169 static int nativeJFmTx_Enable(JNIEnv *env, jobject obj, jlong jContextValue) 170 { 171 int status ; 172 struct v4l2_modulator vm; 173 174 V4L2_JBTL_LOGD("nativeJFmRx_enable(): Entered"); 175 176 jContext = jContextValue; 177 vm.index = 0; 178 179 status = ioctl(radio_fd, VIDIOC_S_MODULATOR, &vm); 180 if(status < 0) 181 { 182 V4L2_JBTL_LOGD("Failed to Enable FM\n"); 183 return status; 184 } 185 186 V4L2_JBTL_LOGD("nativeJFmRx_enable: FM_RX_Enable() returned %d",(int)status); 187 nativeJFmTx_Callback(jContext,status,FM_TX_CMD_ENABLE,status); 188 V4L2_JBTL_LOGD("nativeJFmRx_enable(): Exit"); 189 190 return status; 191 } 192 193 194 static int nativeJFmTx_Disable(JNIEnv *env, jobject obj, jlong jContextValue) 195 { 196 V4L2_JBTL_LOGD("nativeJFmTx_disable(): Entered"); 197 198 jContext = jContextValue; 199 close(radio_fd); 200 nativeJFmTx_Callback(jContext,0,FM_TX_CMD_DISABLE,0); 201 202 V4L2_JBTL_LOGD("nativeJFmTx_disable(): Exit");; 203 204 return FM_SUCCESS; 205 } 206 207 208 static int nativeJFmTx_Tune(JNIEnv *env, jobject obj,jlong jContextValue,jlong user_freq) 209 { 210 struct v4l2_frequency vf; 211 struct v4l2_tuner vt; 212 int status, div; 213 214 V4L2_JBTL_LOGD("nativeJFmRx_tune(): Entered"); 215 216 vf.tuner = 0; 217 vf.frequency = rint(user_freq * 16 + 0.5); 218 219 status = ioctl(radio_fd, VIDIOC_S_FREQUENCY, &vf); 220 if(status < 0) 221 { 222 V4L2_JBTL_LOGD("Failed to tune to frequency %d\n",user_freq); 223 return FM_FAILED; 224 } 225 V4L2_JBTL_LOGD("Tuned to frequency %2.1f MHz\n",user_freq); 226 227 jContext = jContextValue; 228 nativeJFmTx_Callback(jContext,status,FM_TX_CMD_TUNE,user_freq); 229 230 V4L2_JBTL_LOGD("nativeJFmRx_Tune(): Exit"); 231 return FM_PENDING; 232 233 } 234 235 static int nativeJFmTx_GetTunedFrequency(JNIEnv *env, jobject obj,jlong jContextValue) 236 { 237 return 0; 238 239 } 240 static int nativeJFmTx_StartTransmission(JNIEnv *env, jobject obj, jlong jContextValue) 241 { 242 V4L2_JBTL_LOGD("nativeJFmRx_enable(): Init"); 243 jContext = jContextValue; 244 nativeJFmTx_Callback(jContext,0,FM_TX_CMD_START_TRANSMISSION,0); 245 V4L2_JBTL_LOGD("nativeJFmRx_enable(): Exit"); 246 247 return 0; 248 249 } 250 251 static int nativeJFmTx_StopTransmission(JNIEnv *env, jobject obj, jlong jContextValue) 252 { 253 V4L2_JBTL_LOGD("nativeJFmRx_enable(): Init"); 254 jContext = jContextValue; 255 nativeJFmTx_Callback(jContext,0,FM_TX_CMD_STOP_TRANSMISSION,0); 256 V4L2_JBTL_LOGD("nativeJFmRx_enable(): Exit"); 257 return 0; 258 259 } 260 261 262 static int nativeJFmTx_EnableRds(JNIEnv *env, jobject obj, jlong jContextValue) 263 { 264 struct v4l2_modulator vmod; 265 int ret; 266 267 V4L2_JBTL_LOGD("nativeJFmTx_EnableRds(): Init"); 268 vmod.index = 0; 269 ret = ioctl(radio_fd, VIDIOC_G_MODULATOR, &vmod); 270 if(ret < 0) 271 { 272 printf("Failed to get TX mode\n"); 273 return -1; 274 } 275 vmod.txsubchans = vmod.txsubchans | V4L2_TUNER_SUB_RDS; 276 277 ret = ioctl(radio_fd, VIDIOC_S_MODULATOR, &vmod); 278 if(ret < 0) 279 { 280 printf("Failed to set TX mode\n"); 281 return -1; 282 } 283 284 jContext = jContextValue; 285 nativeJFmTx_Callback(jContext,0,FM_TX_CMD_ENABLE_RDS,0); 286 287 V4L2_JBTL_LOGD("nativeJFmTx_EnableRds(): Exit");; 288 289 return 0; 290 291 } 292 293 294 static int nativeJFmTx_DisableRds(JNIEnv *env, jobject obj, jlong jContextValue) 295 { 296 struct v4l2_modulator vmod; 297 int ret; 298 299 V4L2_JBTL_LOGD("nativeJFmTx_DisableRds(): Init"); 300 vmod.index = 0; 301 ret = ioctl(radio_fd, VIDIOC_G_MODULATOR, &vmod); 302 if(ret < 0) 303 { 304 printf("Failed to get TX mode\n"); 305 return -1; 306 } 307 vmod.txsubchans = vmod.txsubchans & ~V4L2_TUNER_SUB_RDS; 308 309 ret = ioctl(radio_fd, VIDIOC_S_MODULATOR, &vmod); 310 if(ret < 0) 311 { 312 printf("Failed to set TX mode\n"); 313 return -1; 314 } 315 316 jContext = jContextValue; 317 nativeJFmTx_Callback(jContext,0,FM_TX_CMD_DISABLE_RDS,0); 318 319 V4L2_JBTL_LOGD("nativeJFmTx_DisableRds(): Exit");; 320 321 return 0; 322 } 323 324 static int nativeJFmTx_SetRdsTransmissionMode(JNIEnv *env, jobject obj, jlong jContextValue,jint mode) 325 { 326 327 /* FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 328 ALOGD("nativeJFmTx_SetRdsTransmissionMode(): Entered"); 329 330 FmTxStatus status =FM_TX_SetRdsTransmissionMode(fmTxContext,(FmTxRdsTransmissionMode)mode); 331 ALOGD("nativeJFmTx_SetRdsTransmissionMode: FM_TX_SetRdsTransmissionMode() returned %d",(int)status); 332 */ 333 ALOGD("nativeJFmTx_SetRdsTransmissionMode(): Exit"); 334 return 0; 335 } 336 337 /* 338 static int nativeJFmTx_GetRdsTransmissionMode(JNIEnv *env, jobject obj, jlong jContextValue) 339 { 340 341 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 342 ALOGD("nativeJFmTx_GetRdsTransmissionMode(): Entered"); 343 344 FmTxStatus status =FM_TX_GetRdsTransmissionMode(fmTxContext); 345 ALOGD("nativeJFmTx_GetRdsTransmissionMode: FM_TX_GetRdsTransmissionMode() returned %d",(int)status); 346 347 ALOGD("nativeJFmTx_GetRdsTransmissionMode(): Exit"); 348 return status; 349 } 350 351 */ 352 static int nativeJFmTx_SetRdsTextPsMsg(JNIEnv *env, jobject obj, jlong jContextValue,jstring psString,jint length) 353 { 354 355 /* FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 356 const char *psStr = (char*) env->GetStringUTFChars(psString, &iscopy); 357 358 ALOGD("nativeJFmTx_SetRdsTextPsMsg(): Entered"); 359 ALOGD("nativeJFmTx_SetRdsTextPsMsg():--> psStr= %s",psStr); 360 361 FmTxStatus status =FM_TX_SetRdsTextPsMsg(fmTxContext,(const FMC_U8 *)psStr,(FMC_UINT)length); 362 ALOGD("nativeJFmTx_SetRdsTextPsMsg: FM_TX_SetRdsTextPsMsg() returned %d",(int)status); 363 */ 364 struct v4l2_ext_controls_kfmapp vec; 365 struct v4l2_ext_control_kfmapp vctrls; 366 jboolean iscopy; 367 int res; 368 char rds_text[100]; 369 370 vec.ctrl_class = V4L2_CTRL_CLASS_FM_TX; 371 vec.count = 1; 372 vctrls.id = V4L2_CID_RDS_TX_PS_NAME; 373 vctrls.string = (char*) env->GetStringUTFChars(psString, &iscopy); 374 vctrls.size = strlen(rds_text) + 1; 375 vec.controls = &vctrls; 376 377 ALOGE("Entered RDS PS Name is - %s\n",vctrls.string); 378 res = ioctl(radio_fd, VIDIOC_S_EXT_CTRLS, &vec); 379 if(res < 0) 380 { 381 ALOGE("Failed to set FM Tx RDS Radio PS Name\n"); 382 return res; 383 } 384 385 ALOGD("nativeJFmTx_SetRdsTextPsMsg(): Exit"); 386 387 return res; 388 } 389 /* 390 static int nativeJFmTx_GetRdsTextPsMsg(JNIEnv *env, jobject obj, jlong jContextValue) 391 { 392 393 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 394 ALOGD("nativeJFmTx_GetRdsTextPsMsg(): Entered"); 395 396 FmTxStatus status =FM_TX_GetRdsTextPsMsg(fmTxContext); 397 ALOGD("nativeJFmTx_GetRdsTextPsMsg: FM_TX_GetRdsTextPsMsg() returned %d",(int)status); 398 399 ALOGD("nativeJFmTx_GetRdsTextPsMsg(): Exit"); 400 401 return status; 402 } 403 404 static int nativeJFmTx_WriteRdsRawData(JNIEnv *env, jobject obj, jlong jContextValue,jstring msg,jint length) 405 { 406 407 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 408 ALOGD("nativeJFmTx_WriteRdsRawData(): Entered"); 409 410 jboolean iscopy; 411 const char *rawData = (char*) env->GetStringUTFChars(msg, &iscopy); 412 413 414 FmTxStatus status =FM_TX_WriteRdsRawData(fmTxContext,(const FMC_U8 *)rawData,(FMC_UINT)length); 415 ALOGD("nativeJFmTx_WriteRdsRawData: FM_TX_WriteRdsRawData() returned %d",(int)status); 416 417 ALOGD("nativeJFmTx_WriteRdsRawData(): Exit"); 418 return status; 419 } 420 421 422 static int nativeJFmTx_ReadRdsRawData(JNIEnv *env, jobject obj, jlong jContextValue) 423 { 424 425 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 426 ALOGD("nativeJFmTx_ReadRdsRawData(): Entered"); 427 428 FmTxStatus status =FM_TX_ReadRdsRawData(fmTxContext); 429 ALOGD("nativeJFmTx_ReadRdsRawData: FM_TX_ReadRdsRawData() returned %d",(int)status); 430 431 ALOGD("nativeJFmTx_ReadRdsRawData(): Exit"); 432 return status; 433 } 434 */ 435 static int nativeJFmTx_SetMuteMode(JNIEnv *env, jobject obj, jlong jContextValue,jint mode) 436 { 437 438 struct v4l2_control vt; 439 int status; 440 441 ALOGD("nativeJFmTx_SetMuteMode(): Entered"); 442 vt.id = V4L2_CID_AUDIO_MUTE; 443 444 if (mode == 0) 445 vt.value = FM_MUTE_OFF; 446 else 447 vt.value = FM_MUTE_ON; 448 449 status = ioctl(radio_fd,VIDIOC_S_CTRL,&vt); 450 if(status < 0) 451 { 452 ALOGD("nativeJFmTx_SetMuteMode(): Faile returned %d\n", status); 453 return status; 454 } 455 456 ALOGD("nativeJFmTx_SetMuteMode(): Exit"); 457 return status; 458 } 459 460 static int nativeJFmTx_GetMuteMode(JNIEnv *env, jobject obj, jlong jContextValue) 461 { 462 ALOGD("nativeJFmTx_GetMuteMode(): Entered"); 463 464 ALOGD("nativeJFmTx_GetMuteMode(): Exit"); 465 return 0; 466 } 467 /* 468 static int nativeJFmTx_SetRdsPsDisplayMode(JNIEnv *env, jobject obj, jlong jContextValue, jint displayMode) 469 { 470 471 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 472 ALOGD("nativeJFmTx_SetRdsPsDisplayMode(): Entered"); 473 474 FmTxStatus status =FM_TX_SetRdsPsDisplayMode(fmTxContext,(FmcRdsPsDisplayMode)displayMode); 475 ALOGD("nativeJFmTx_SetRdsPsDisplayMode: FM_TX_SetRdsPsDisplayMode() returned %d",(int)status); 476 477 ALOGD("nativeJFmTx_SetRdsPsDisplayMode(): Exit"); 478 return status; 479 } 480 481 482 static int nativeJFmTx_GetRdsPsDisplayMode(JNIEnv *env, jobject obj, jlong jContextValue) 483 { 484 485 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 486 ALOGD("nativeJFmTx_GetRdsPsDisplayMode(): Entered"); 487 488 FmTxStatus status =FM_TX_GetRdsPsDisplayMode(fmTxContext); 489 ALOGD("nativeJFmTx_GetRdsPsDisplayMode: FM_TX_GetRdsPsDisplayMode() returned %d",(int)status); 490 491 ALOGD("nativeJFmTx_GetRdsPsDisplayMode(): Exit"); 492 return status; 493 } 494 495 */ 496 static int nativeJFmTx_SetRdsTextRtMsg(JNIEnv *env, jobject obj, jlong jContextValue, jint msgType,jstring msg,jint length) 497 { 498 499 // FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 500 501 jboolean iscopy; 502 const char *rtMsg = (char*) env->GetStringUTFChars(msg, &iscopy); 503 struct v4l2_ext_controls_kfmapp vec; 504 struct v4l2_ext_control_kfmapp vctrls; 505 int res; 506 char rds_text[100]; 507 508 ALOGD("nativeJFmTx_SetRdsTextRtMsg(): Entered"); 509 510 511 vec.ctrl_class = V4L2_CTRL_CLASS_FM_TX; 512 vec.count = 1; 513 vctrls.id = V4L2_CID_RDS_TX_RADIO_TEXT; 514 vctrls.string = (char*) env->GetStringUTFChars(msg, &iscopy); 515 vctrls.size = strlen(rtMsg) + 1; 516 vec.controls = &vctrls; 517 518 ALOGD("nativeJFmTx_SetRdsTextRtMsg():--> RTMsg = %s",vctrls.string); 519 res = ioctl(radio_fd, VIDIOC_S_EXT_CTRLS, &vec); 520 if(res < 0) 521 { 522 ALOGE("Failed to set FM Tx RDS Radio text"); 523 return res; 524 } 525 526 // FmTxStatus status =FM_TX_SetRdsTextRtMsg(fmTxContext,(FmcRdsRtMsgType)msgType,(const FMC_U8 *)rtMsg,(FMC_UINT)length); 527 // ALOGD("nativeJFmTx_SetRdsTextRtMsg: FM_TX_SetRdsTextRtMsg() returned %d",(int)status); 528 529 ALOGD("nativeJFmTx_SetRdsTextRtMsg(): Exit"); 530 return 0; 531 } 532 533 /* 534 static int nativeJFmTx_GetRdsTextRtMsg(JNIEnv *env, jobject obj, jlong jContextValue) 535 { 536 537 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 538 ALOGD("nativeJFmTx_GetRdsTextRtMsg(): Entered"); 539 FmTxStatus status =FM_TX_GetRdsTextRtMsg(fmTxContext); 540 ALOGD("nativeJFmTx_GetRdsTextRtMsg: FM_TX_SetRdsTextRtMsg() returned %d",(int)status); 541 542 ALOGD("nativeJFmTx_GetRdsTextRtMsg(): Exit"); 543 return status; 544 } 545 546 */ 547 static int nativeJFmTx_SetRdsTransmittedGroupsMask(JNIEnv *env, jobject obj, jlong jContextValue, jlong fieldMask) 548 { 549 550 /* FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 551 ALOGD("nativeJFmTx_SetRdsTransmittedGroupsMask(): Entered"); 552 553 FmTxStatus status =FM_TX_SetRdsTransmittedGroupsMask(fmTxContext,(FmTxRdsTransmittedGroupsMask)fieldMask); 554 ALOGD("nativeJFmTx_SetRdsTransmittedGroupsMask: FM_TX_SetRdsTransmittedGroupsMask() returned %d",(int)status); 555 */ 556 ALOGD("nativeJFmTx_SetRdsTransmittedGroupsMask(): Exit"); 557 return 0; 558 } 559 560 /* 561 static int nativeJFmTx_GetRdsTransmittedGroupsMask(JNIEnv *env, jobject obj, jlong jContextValue) 562 { 563 564 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 565 ALOGD("nativeJFmTx_GetRdsTransmittedGroupsMask(): Entered"); 566 567 FmTxStatus status =FM_TX_GetRdsTransmittedGroupsMask(fmTxContext); 568 ALOGD("nativeJFmTx_GetRdsTransmittedGroupsMask: FM_TX_GetRdsTransmittedGroupsMask() returned %d",(int)status); 569 570 ALOGD("nativeJFmTx_GetRdsTransmittedGroupsMask(): Exit"); 571 return status; 572 } 573 574 static int nativeJFmTx_SetRdsTrafficCodes(JNIEnv *env, jobject obj, jlong jContextValue, jint taCode,jint tpCode) 575 { 576 577 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 578 ALOGD("nativeJFmTx_SetRdsTrafficCodes(): Entered"); 579 580 FmTxStatus status =FM_TX_SetRdsTrafficCodes(fmTxContext,(FmcRdsTaCode)taCode,(FmcRdsTpCode)tpCode); 581 ALOGD("nativeJFmTx_SetRdsTrafficCodes: FM_TX_SetRdsTrafficCodes() returned %d",(int)status); 582 583 ALOGD("nativeJFmTx_SetRdsTrafficCodes(): Exit"); 584 return status; 585 } 586 587 static int nativeJFmTx_GetRdsTrafficCodes(JNIEnv *env, jobject obj, jlong jContextValue) 588 { 589 590 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 591 ALOGD("nativeJFmTx_GetRdsTrafficCodes(): Entered"); 592 593 FmTxStatus status =FM_TX_GetRdsTrafficCodes(fmTxContext); 594 ALOGD("nativeJFmTx_GetRdsTrafficCodes: FM_TX_GetRdsTrafficCodes() returned %d",(int)status); 595 596 ALOGD("nativeJFmTx_GetRdsTrafficCodes(): Exit"); 597 return status; 598 } 599 600 static int nativeJFmTx_SetRdsMusicSpeechFlag(JNIEnv *env, jobject obj, jlong jContextValue, jint musicSpeechFlag) 601 { 602 603 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 604 ALOGD("nativeJFmTx_SetRdsMusicSpeechFlag(): Entered"); 605 606 FmTxStatus status =FM_TX_SetRdsMusicSpeechFlag(fmTxContext,(FmcRdsMusicSpeechFlag)musicSpeechFlag); 607 ALOGD("nativeJFmTx_SetRdsMusicSpeechFlag: FM_TX_SetRdsMusicSpeechFlag() returned %d",(int)status); 608 609 ALOGD("nativeJFmTx_SetRdsMusicSpeechFlag(): Exit"); 610 return status; 611 } 612 613 614 static int nativeJFmTx_GetRdsMusicSpeechFlag(JNIEnv *env, jobject obj, jlong jContextValue) 615 { 616 617 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 618 ALOGD("nativeJFmTx_GetRdsMusicSpeechFlag(): Entered"); 619 620 FmTxStatus status =FM_TX_GetRdsMusicSpeechFlag(fmTxContext); 621 ALOGD("nativeJFmTx_GetRdsMusicSpeechFlag: FM_TX_GetRdsMusicSpeechFlag() returned %d",(int)status); 622 623 ALOGD("nativeJFmTx_GetRdsMusicSpeechFlag(): Exit"); 624 return status; 625 } 626 627 static int nativeJFmTx_SetRdsExtendedCountryCode(JNIEnv *env, jobject obj, jlong jContextValue, jint ecc) 628 { 629 630 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 631 ALOGD("nativeJFmTx_SetRdsExtendedCountryCode(): Entered"); 632 633 FmTxStatus status =FM_TX_SetRdsECC(fmTxContext,(FmcRdsExtendedCountryCode)ecc); 634 ALOGD("nativeJFmTx_SetRdsExtendedCountryCode: FM_TX_SetRdsECC() returned %d",(int)status); 635 636 ALOGD("nativeJFmTx_SetRdsExtendedCountryCode(): Exit"); 637 return status; 638 } 639 640 static int nativeJFmTx_GetRdsExtendedCountryCode(JNIEnv *env, jobject obj, jlong jContextValue) 641 { 642 643 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 644 ALOGD("nativeJFmTx_GetRdsExtendedCountryCode(): Entered"); 645 646 FmTxStatus status =FM_TX_GetRdsECC(fmTxContext); 647 ALOGD("nativeJFmTx_GetRdsExtendedCountryCode: FM_TX_GetRdsECC() returned %d",(int)status); 648 649 ALOGD("nativeJFmTx_GetRdsExtendedCountryCode(): Exit"); 650 return status; 651 } 652 653 static int nativeJFmTx_ChangeAudioSource(JNIEnv *env, jobject obj, jlong jContextValue,jint txSource,jint eSampleFreq) 654 { 655 656 FmTxContext * fmTxContext = (FmTxContext *)jContextValue; 657 ALOGD("nativeJFmTx_ChangeAudioSource(): Entered"); 658 659 ALOGD(" txSource = %d , Sampling frequency = %d ",(int) txSource, (int) eSampleFreq); 660 FmTxStatus status =FM_TX_ChangeAudioSource(fmTxContext,(FmTxAudioSource)txSource,(ECAL_SampleFrequency)eSampleFreq); 661 ALOGD("nativeJFmTx_ChangeAudioSource: FM_TX_ChangeAudioSource() returned %d",(int)status); 662 663 ALOGD("nativeJFmTx_ChangeAudioSource(): Exit"); 664 return status; 665 } 666 */ 667 668 static int nativeJFmTx_ChangeDigitalSourceConfiguration(JNIEnv *env, jobject obj, jlong jContextValue,jint eSampleFreq) 669 { 670 return 0; 671 672 } 673 674 675 static int nativeJFmTx_SetRdsTextRepertoire(JNIEnv *env, jobject obj, jlong jContextValue,jint repertoire) 676 { 677 return 0; 678 679 } 680 681 682 static int nativeJFmTx_GetRdsTextRepertoire(JNIEnv *env, jobject obj, jlong jContextValue,jint repertoire) 683 { 684 return 0; 685 } 686 687 static int nativeJFmTx_SetRdsPtyCode(JNIEnv *env, jobject obj, jlong jContextValue,jint ptyCode) 688 { 689 int user_val; 690 int res; 691 struct v4l2_ext_controls_kfmapp vec; 692 struct v4l2_ext_control_kfmapp vctrls; 693 694 ALOGE("nativeJFmTx_SetRdsPtyCode(): Entered"); 695 696 vec.ctrl_class = V4L2_CTRL_CLASS_FM_TX; 697 vec.count = 1; 698 vctrls.id = V4L2_CID_RDS_TX_PTY; 699 vctrls.value = ptyCode; 700 vctrls.size = 0; 701 vec.controls = &vctrls; 702 703 res = ioctl(radio_fd, VIDIOC_S_EXT_CTRLS, &vec); 704 if(res < 0) 705 { 706 ALOGE("Failed to set FM Tx RDS PTY\n"); 707 return res; 708 } 709 710 ALOGE("nativeJFmTx_SetRdsPtyCode(): Exit"); 711 712 return res; 713 } 714 715 static int nativeJFmTx_GetRdsPtyCode(JNIEnv *env, jobject obj, jlong jContextValue,jint ptyCode) 716 { 717 return 0; 718 } 719 720 static int nativeJFmTx_SetRdsPiCode(JNIEnv *env, jobject obj, jlong jContextValue,jint piCode) 721 { 722 struct v4l2_ext_controls_kfmapp vec; 723 struct v4l2_ext_control_kfmapp vctrls; 724 int res; 725 726 ALOGD("nativeJFmTx_SetRdsPiCode(): Enter"); 727 728 vec.ctrl_class = V4L2_CTRL_CLASS_FM_TX; 729 vec.count = 1; 730 vctrls.id = V4L2_CID_RDS_TX_PI; 731 vctrls.value = piCode; 732 vctrls.size = 0; 733 vec.controls = &vctrls; 734 735 res = ioctl(radio_fd, VIDIOC_S_EXT_CTRLS, &vec); 736 if(res < 0) 737 { 738 ALOGE("Failed to set FM Tx RDS PI Code\n"); 739 return res; 740 } 741 742 ALOGD("Setting FM Tx RDS PI Code is Succesful\n"); 743 744 return res; 745 } 746 747 static int nativeJFmTx_GetRdsPiCode(JNIEnv *env, jobject obj, jlong jContextValue) 748 { 749 return 0; 750 } 751 static int nativeJFmTx_SetRdsAfCode(JNIEnv *env, jobject obj, jlong jContextValue,jint afCode) 752 { 753 int fd, res; 754 char str[10]; 755 756 sprintf(str, "%d", afCode); 757 758 ALOGD("nativeJFmTx_SetRdsAfCode(): Enter"); 759 760 fd = open(FMTX_RDS_AF_SYSFS_ENTRY, O_RDWR); 761 if (fd < 0) { 762 ALOGD("Can't open %s", FMTX_RDS_AF_SYSFS_ENTRY); 763 return -1; 764 } 765 766 /* Need max 6 cahrs to set AF between 75000 KHz to 108000 KHz */ 767 res = write(fd, str, 6); 768 if(res <= 0) { 769 ALOGD("Failed to set FM TX RDS AF Frequency\n"); 770 goto exit; 771 } 772 773 ALOGD("FM RDS Alternate Frequency Set is succesfull\n"); 774 exit: 775 close(fd); 776 return res; 777 } 778 779 static int nativeJFmTx_GetRdsAfCode(JNIEnv *env, jobject obj, jlong jContextValue) 780 { 781 return 0; 782 } 783 784 static int nativeJFmTx_SetMonoStereoMode(JNIEnv *env, jobject obj, jlong jContextValue,jint monoStereoMode) 785 { 786 return 0; 787 } 788 789 static int nativeJFmTx_GetMonoStereoMode(JNIEnv *env, jobject obj, jlong jContextValue) 790 { 791 return 0; 792 793 } 794 795 static int nativeJFmTx_SetPowerLevel(JNIEnv *env, jobject obj, jlong jContextValue,jint powerLevel) 796 { 797 struct v4l2_ext_controls_kfmapp vec; 798 struct v4l2_ext_control_kfmapp vctrls; 799 int res; 800 801 ALOGD("nativeJFmTx_SetPowerLevel(): Enter and power level = %d\n",powerLevel); 802 803 vec.ctrl_class = V4L2_CTRL_CLASS_FM_TX; 804 vec.count = 1; 805 vctrls.id = V4L2_CID_TUNE_POWER_LEVEL; 806 vctrls.value = 122 - powerLevel; 807 vctrls.size = 0; 808 vec.controls = &vctrls; 809 810 res = ioctl(radio_fd, VIDIOC_S_EXT_CTRLS, &vec); 811 if(res < 0) 812 { 813 ALOGE("Failed to set FM Tx power level\n"); 814 return res; 815 } 816 817 ALOGE("Setting FM Tx Power level to ---> %d\n", 122 - vctrls.value); 818 819 return res; 820 } 821 822 static int nativeJFmTx_GetPowerLevel(JNIEnv *env, jobject obj, jlong jContextValue) 823 { 824 return 0; 825 826 } 827 828 static int nativeJFmTx_SetPreEmphasisFilter(JNIEnv *env, jobject obj, jlong jContextValue,jint preEmpFilter) 829 { 830 return 0; 831 } 832 833 834 static int nativeJFmTx_GetPreEmphasisFilter(JNIEnv *env, jobject obj, jlong jContextValue) 835 { 836 return 0; 837 838 } 839 840 static int nativeJFmTx_SetRdsPsScrollSpeed(JNIEnv *env, jobject obj, jlong jContextValue,jint scrollSpeed) 841 { 842 return 0; 843 844 } 845 846 static int nativeJFmTx_GetRdsPsScrollSpeed(JNIEnv *env, jobject obj, jlong jContextValue) 847 { 848 return 0; 849 850 } 851 //################################################################################ 852 853 // SIGNALS 854 855 //############################################################################### 856 857 void nativeJFmTx_Callback(long context, int status, 858 int command, long value) 859 { 860 861 V4L2_JBTL_LOGI("nativeJFmTx_Callback: Entered, "); 862 863 JNIEnv* env = NULL; 864 bool attachedThread = false; 865 int jRet ; 866 867 jRet = g_jVM->GetEnv((void **)&env,JNI_VERSION_1_4); 868 869 870 if(jRet < 0) 871 { 872 V4L2_JBTL_LOGI("failed to get JNI env,assuming native thread"); 873 jRet = g_jVM->AttachCurrentThread((&env), NULL); 874 875 if(jRet != JNI_OK) 876 { 877 V4L2_JBTL_LOGI("failed to atatch to current thread %d",jRet); 878 return ; 879 } 880 881 attachedThread = true; 882 } 883 884 if(env == NULL) 885 { 886 V4L2_JBTL_LOGD("nativeJFmRx_Callback: Entered, env is null"); 887 } 888 889 890 switch (command) { 891 892 case FM_TX_CMD_ENABLE: 893 V4L2_JBTL_LOGI("FM_TX_CMD_ENABLE:Status: %d ",status); 894 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdEnable, 895 (jlong)context, 896 (jint)status, 897 (jint)value); 898 break; 899 900 case FM_TX_CMD_DISABLE: 901 V4L2_JBTL_LOGI("FM_TX_CMD_DISABLE:Status: %d ",status); 902 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdDisable, 903 (jlong)context, 904 (jint)status, 905 (jint)value); 906 break; 907 /* 908 case FM_TX_CMD_SET_INTERRUPT_MASK: 909 V4L2_JBTL_LOGI("FM_TX_CMD_SET_INTERRUPT_MASK:Status: %d ",status); 910 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetInterruptMask, 911 (jlong)context, 912 (jint)status, 913 (jint)value); 914 break; 915 916 case FM_TX_CMD_GET_INTERRUPT_STATUS: 917 V4L2_JBTL_LOGI("FM_TX_CMD_DISABLE:Status: %d ",status); 918 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetInterruptMask, 919 (jlong)context, 920 (jint)status, 921 (jint)value); 922 break; 923 924 */ 925 case FM_TX_CMD_START_TRANSMISSION: 926 V4L2_JBTL_LOGI("FM_TX_CMD_START_TRANSMISSION:Status: %d ",status); 927 // lptUnavailResources = (jclass *)event->p.cmdDone.v.audioOperation.ptUnavailResources; 928 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdStartTransmission, 929 (jlong)context, 930 (jint)status); 931 break; 932 933 case FM_TX_CMD_STOP_TRANSMISSION: 934 V4L2_JBTL_LOGI("FM_TX_CMD_STOP_TRANSMISSION:Status: %d ",status); 935 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdStopTransmission, 936 (jlong)context, 937 (jint)status, 938 (jint)value); 939 break; 940 941 case FM_TX_CMD_TUNE: 942 V4L2_JBTL_LOGI("FM_TX_CMD_TUNE:Status: %d ",status); 943 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdTune, 944 (jlong)context, 945 (jint)status, 946 (jint)value); 947 break; 948 949 case FM_TX_CMD_GET_TUNED_FREQUENCY: 950 V4L2_JBTL_LOGI("FM_TX_CMD_GET_TUNED_FREQUENCY:Status: %d,Value: %d ",status,value); 951 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetTunedFrequency, 952 (jlong)context, 953 (jint)status, 954 (jint)value); 955 break; 956 957 958 case FM_TX_CMD_SET_MONO_STEREO_MODE: 959 V4L2_JBTL_LOGI("FM_TX_CMD_SET_MONO_STEREO_MODE:Status: %d ",status); 960 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetMonoStereoMode, 961 (jlong)context, 962 (jint)status, 963 (jint)value); 964 break; 965 966 case FM_TX_CMD_GET_MONO_STEREO_MODE: 967 V4L2_JBTL_LOGI("FM_TX_CMD_GET_MONO_STEREO_MODE:Status: %d,Value: %d ",status,value); 968 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetMonoStereoMode, 969 (jlong)context, 970 (jint)status, 971 (jint)value); 972 break; 973 974 /* 975 case FM_TX_CMD_SET_POWER_LEVEL: 976 V4L2_JBTL_LOGI("FM_TX_CMD_SET_POWER_LEVEL:Status: %d ",status); 977 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetPowerLevel, 978 (jlong)context, 979 (jint)status, 980 (jint)value); 981 break; 982 983 case FM_TX_CMD_GET_POWER_LEVEL: 984 V4L2_JBTL_LOGI("FM_TX_CMD_GET_POWER_LEVEL:Status: %d,Value: %d ",status,value); 985 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetPowerLevel, 986 (jlong)context, 987 (jint)status, 988 (jint)value); 989 break; 990 */ 991 case FM_TX_CMD_SET_MUTE_MODE: 992 V4L2_JBTL_LOGI("FM_TX_CMD_SET_MUTE_MODE:Status: %d ",status); 993 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetMuteMode, 994 (jlong)context, 995 (jint)status, 996 (jint)value); 997 break; 998 999 case FM_TX_CMD_GET_MUTE_MODE: 1000 V4L2_JBTL_LOGI("FM_TX_CMD_SET_MUTE_MODE:Status: %d ",status); 1001 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetMuteMode, 1002 (jlong)context, 1003 (jint)status, 1004 (jint)value); 1005 break; 1006 1007 case FM_TX_CMD_ENABLE_RDS: 1008 V4L2_JBTL_LOGI("FM_TX_CMD_ENABLE_RDS:Status: %d ",status); 1009 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdEnableRds, 1010 (jlong)context, 1011 (jint)status, 1012 (jint)value); 1013 break; 1014 1015 case FM_TX_CMD_DISABLE_RDS: 1016 V4L2_JBTL_LOGI("FM_TX_CMD_DISABLE_RDS:Status: %d ",status); 1017 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdDisableRds, 1018 (jlong)context, 1019 (jint)status, 1020 (jint)value); 1021 break; 1022 1023 case FM_TX_CMD_SET_RDS_TEXT_RT_MSG: 1024 V4L2_JBTL_LOGI("FM_TX_CMD_SET_RDS_TEXT_RT_MSG:Status: %d ",status); 1025 1026 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetRdsTextRtMsg, 1027 (jlong)context, 1028 (jint)status, 1029 (jint)value); 1030 1031 break; 1032 1033 case FM_TX_CMD_SET_RDS_TEXT_PS_MSG: 1034 V4L2_JBTL_LOGI("FM_TX_CMD_SET_RDS_TEXT_PS_MSG:Status: %d ",status); 1035 1036 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetRdsTextPsMsg, 1037 (jlong)context, 1038 (jint)status, 1039 (jint)value); 1040 1041 break; 1042 1043 case FM_TX_CMD_SET_RDS_PTY_CODE: 1044 V4L2_JBTL_LOGI("FM_TX_CMD_SET_RDS_PI_CODE:Status: %d ",status); 1045 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetRdsPtyCode, 1046 (jlong)context, 1047 (jint)status, 1048 (jint)value); 1049 break; 1050 1051 /* 1052 case FM_TX_CMD_SET_RDS_TRANSMISSION_MODE: 1053 V4L2_JBTL_LOGI("FM_TX_CMD_SET_RDS_TRANSMISSION_MODE:Status: %d ",status); 1054 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetRdsTransmissionMode, 1055 (jlong)context, 1056 (jint)status, 1057 (jint)value); 1058 break; 1059 1060 case FM_TX_CMD_GET_RDS_TRANSMISSION_MODE 1061 V4L2_JBTL_LOGI("FM_TX_CMD_GET_POWER_LEVEL:Status: %d,Value: %d ",status,value); 1062 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetRdsTransmissionMode, 1063 (jlong)context, 1064 (jint)status, 1065 (jint)value); 1066 break; 1067 */ 1068 case FM_TX_CMD_SET_RDS_AF_CODE: 1069 V4L2_JBTL_LOGI("FM_TX_CMD_SET_RDS_AF_CODE:Status: %d ",status); 1070 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetRdsAfCode, 1071 (jlong)context, 1072 (jint)status, 1073 (jint)value); 1074 break; 1075 /* 1076 case FM_TX_CMD_GET_RDS_AF_CODE: 1077 V4L2_JBTL_LOGI("FM_TX_CMD_GET_POWER_LEVEL:Status: %d,Value: %d ",status,value); 1078 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetRdsAfCode, 1079 (jlong)context, 1080 (jint)status, 1081 (jint)value); 1082 break; 1083 1084 case FM_TX_CMD_SET_RDS_PI_CODE: 1085 V4L2_JBTL_LOGI("FM_TX_CMD_SET_RDS_PI_CODE:Status: %d ",status); 1086 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetRdsPiCode, 1087 (jlong)context, 1088 (jint)status, 1089 (jint)value); 1090 break; 1091 1092 case FM_TX_CMD_GET_RDS_PI_CODE: 1093 V4L2_JBTL_LOGI("FM_TX_CMD_GET_RDS_PI_CODE:Status: %d,Value: %d ",status,value); 1094 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetRdsPiCode, 1095 (jlong)context, 1096 (jint)status, 1097 (jint)value); 1098 break; 1099 1100 case FM_TX_CMD_GET_RDS_PTY_CODE: 1101 V4L2_JBTL_LOGI("FM_TX_CMD_GET_RDS_PTY_CODE:Status: %d,Value: %d ",status,value); 1102 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetRdsPtyCode, 1103 (jlong)context, 1104 (jint)status, 1105 (jint)value); 1106 break; 1107 1108 case FM_TX_CMD_SET_RDS_TEXT_REPERTOIRE: 1109 V4L2_JBTL_LOGI("FM_TX_CMD_SET_RDS_TEXT_REPERTOIRE:Status: %d ",status); 1110 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetRdsTextRepertoire, 1111 (jlong)context, 1112 (jint)status, 1113 (jint)value); 1114 break; 1115 1116 case FM_TX_CMD_GET_RDS_TEXT_REPERTOIRE: 1117 V4L2_JBTL_LOGI("FM_TX_CMD_GET_RDS_TEXT_REPERTOIRE:Status: %d,Value: %d ",status,value); 1118 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetRdsTextRepertoire, 1119 (jlong)context, 1120 (jint)status, 1121 (jint)value); 1122 break; 1123 1124 case FM_TX_CMD_SET_RDS_PS_DISPLAY_MODE: 1125 V4L2_JBTL_LOGI("FM_TX_CMD_SET_RDS_PS_DISPLAY_MODE:Status: %d ",status); 1126 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetRdsPsDispalyMode, 1127 (jlong)context, 1128 (jint)status, 1129 (jint)value); 1130 break; 1131 1132 case FM_TX_CMD_GET_RDS_PS_DISPLAY_MODE: 1133 V4L2_JBTL_LOGI("FM_TX_CMD_GET_RDS_PS_DISPLAY_MODE:Status: %d,Value: %d ",status,value); 1134 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetRdsPsDispalyMode, 1135 (jlong)context, 1136 (jint)status, 1137 (jint)value); 1138 break; 1139 1140 case FM_TX_CMD_SET_RDS_PS_DISPLAY_SPEED: 1141 V4L2_JBTL_LOGI("FM_TX_CMD_SET_RDS_PS_DISPLAY_SPEED:Status: %d ",status); 1142 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetRdsPsDisplaySpeed, 1143 (jlong)context, 1144 (jint)status, 1145 (jint)value); 1146 break; 1147 1148 case FM_TX_CMD_GET_RDS_PS_DISPLAY_SPEED: 1149 V4L2_JBTL_LOGI("FM_TX_CMD_GET_RDS_PS_DISPLAY_SPEED:Status: %d,Value: %d ",status,value); 1150 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetRdsPsDisplaySpeed, 1151 (jlong)context, 1152 (jint)status, 1153 (jint)value); 1154 break; 1155 1156 case FM_TX_CMD_GET_RDS_TEXT_PS_MSG: 1157 V4L2_JBTL_LOGI("FM_TX_CMD_GET_RDS_TEXT_PS_MSG:Status: %d ",status); 1158 1159 jRadioTextMsg = env->NewByteArray(event->p.cmdDone.v.psMsg.len); 1160 1161 if (jRadioTextMsg == NULL) 1162 { 1163 V4L2_JBTL_LOGE("FM_TX_CMD_GET_RDS_TEXT_PS_MSG: Failed converting elements"); 1164 goto EXCEPTION; 1165 } 1166 1167 env->SetByteArrayRegion(jRadioTextMsg,0,event->p.cmdDone.v.psMsg.len,(jbyte*)event->p.cmdDone.v.psMsg.msg); 1168 1169 if (env->ExceptionOccurred()) { 1170 V4L2_JBTL_LOGE("FM_TX_CMD_GET_RDS_TEXT_PS_MSG: env->SetByteArrayRegion failed"); 1171 goto EXCEPTION; 1172 } 1173 1174 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetRdsTextPsMsg, 1175 (jlong)context, 1176 (jint)status, 1177 (jint)event->p.cmdDone.v.psMsg.len, 1178 jRadioTextMsg); 1179 break; 1180 1181 case FM_TX_CMD_GET_RDS_TEXT_RT_MSG: 1182 V4L2_JBTL_LOGI("FM_TX_CMD_GET_RDS_TEXT_RT_MSG:Status: %d ",status); 1183 1184 jRadioTextMsg = env->NewByteArray(event->p.cmdDone.v.rtMsg.len); 1185 1186 if (jRadioTextMsg == NULL) 1187 { 1188 V4L2_JBTL_LOGE("FM_TX_CMD_GET_RDS_TEXT_RT_MSG: Failed converting elements"); 1189 goto EXCEPTION; 1190 } 1191 1192 env->SetByteArrayRegion(jRadioTextMsg,0,event->p.cmdDone.v.rtMsg.len,(jbyte*)event->p.cmdDone.v.rtMsg.msg); 1193 1194 if (env->ExceptionOccurred()) { 1195 V4L2_JBTL_LOGE("FM_TX_CMD_GET_RDS_TEXT_RT_MSG: env->SetByteArrayRegion failed"); 1196 goto EXCEPTION; 1197 } 1198 1199 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetRdsTextRtMsg, 1200 (jlong)context, 1201 (jint)status, 1202 (jint)event->p.cmdDone.v.rtMsg.rtMsgType, 1203 (jint)event->p.cmdDone.v.rtMsg.len, 1204 jRadioTextMsg); 1205 break; 1206 1207 case FM_TX_CMD_SET_RDS_TRANSMITTED_MASK: 1208 V4L2_JBTL_LOGI("FM_TX_CMD_SET_RDS_TRANSMITTED_MASK:Status: %d ",status); 1209 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetRdsTransmittedMask, 1210 (jlong)context, 1211 (jint)status, 1212 (jint)value); 1213 break; 1214 1215 case FM_TX_CMD_GET_RDS_TRANSMITTED_MASK: 1216 V4L2_JBTL_LOGI("FM_TX_CMD_GET_RDS_TRANSMITTED_MASK:Status: %d ",status); 1217 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetRdsTransmittedMask, 1218 (jlong)context, 1219 (jint)status, 1220 (jint)value); 1221 break; 1222 1223 case FM_TX_CMD_SET_RDS_TRAFFIC_CODES: 1224 V4L2_JBTL_LOGI("FM_TX_CMD_SET_RDS_TRAFFIC_CODES:Status: %d ",status); 1225 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetRdsTrafficCodes, 1226 (jlong)context, 1227 (jint)status, 1228 (jint)event->p.cmdDone.v.trafficCodes.taCode, 1229 (jint)event->p.cmdDone.v.trafficCodes.tpCode); 1230 break; 1231 1232 case FM_TX_CMD_GET_RDS_TRAFFIC_CODES: 1233 V4L2_JBTL_LOGI("FM_TX_CMD_GET_RDS_TRAFFIC_CODES:Status: %d , taCode: %d ,tpCode: %d ",status,event->p.cmdDone.v.trafficCodes.taCode,event->p.cmdDone.v.trafficCodes.tpCode); 1234 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetRdsTrafficCodes, 1235 (jlong)context, 1236 (jint)status, 1237 (jint)event->p.cmdDone.v.trafficCodes.taCode, 1238 (jint)event->p.cmdDone.v.trafficCodes.tpCode); 1239 break; 1240 1241 case FM_TX_CMD_SET_RDS_MUSIC_SPEECH_FLAG: 1242 V4L2_JBTL_LOGI("FM_TX_CMD_SET_RDS_MUSIC_SPEECH_FLAG:Status: %d ",status); 1243 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetRdsMusicSpeechFlag, 1244 (jlong)context, 1245 (jint)status, 1246 (jint)value); 1247 break; 1248 1249 case FM_TX_CMD_GET_RDS_MUSIC_SPEECH_FLAG: 1250 V4L2_JBTL_LOGI("FM_TX_CMD_GET_RDS_MUSIC_SPEECH_FLAG:Status: %d,Value: %d ",status,value); 1251 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetRdsMusicSpeechFlag, 1252 (jlong)context, 1253 (jint)status, 1254 (jint)value); 1255 break; 1256 1257 case FM_TX_CMD_SET_PRE_EMPHASIS_FILTER: 1258 V4L2_JBTL_LOGI("FM_TX_CMD_SET_PRE_EMPHASIS_FILTER:Status: %d ",status); 1259 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetPreEmphasisFilter, 1260 (jlong)context, 1261 (jint)status, 1262 (jint)value); 1263 break; 1264 1265 case FM_TX_CMD_GET_PRE_EMPHASIS_FILTER: 1266 V4L2_JBTL_LOGI("FM_TX_CMD_GET_PRE_EMPHASIS_FILTER:Status: %d,Value: %d ",status,value); 1267 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetPreEmphasisFilter, 1268 (jlong)context, 1269 (jint)status, 1270 (jint)value); 1271 break; 1272 1273 case FM_TX_CMD_SET_RDS_EXTENDED_COUNTRY_CODE: 1274 V4L2_JBTL_LOGI("FM_TX_CMD_SET_RDS_EXTENDED_COUNTRY_CODE:Status: %d ",status); 1275 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdSetRdsExtendedCountryCode, 1276 (jlong)context, 1277 (jint)status, 1278 (jint)value); 1279 break; 1280 1281 case FM_TX_CMD_GET_RDS_EXTENDED_COUNTRY_CODE: 1282 V4L2_JBTL_LOGI("FM_TX_CMD_GET_PRE_EMPHASIS_FILTER:Status: %d,Value: %d ",status,value); 1283 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdGetRdsExtendedCountryCode, 1284 (jlong)context, 1285 (jint)status, 1286 (jint)value); 1287 break; 1288 1289 case FM_TX_CMD_WRITE_RDS_RAW_DATA: 1290 V4L2_JBTL_LOGI("FM_TX_CMD_WRITE_RDS_RAW_DATA:Status: %d ",status); 1291 jRadioTextMsg = env->NewByteArray(event->p.cmdDone.v.rawRds.len); 1292 1293 if (jRadioTextMsg == NULL) 1294 { 1295 V4L2_JBTL_LOGE("FM_TX_CMD_WRITE_RDS_RAW_DATA: Failed converting elements"); 1296 goto EXCEPTION; 1297 } 1298 1299 env->SetByteArrayRegion(jRadioTextMsg,0,event->p.cmdDone.v.rawRds.len,(jbyte*)event->p.cmdDone.v.rawRds.data); 1300 1301 if (env->ExceptionOccurred()) { 1302 V4L2_JBTL_LOGE("FM_TX_CMD_WRITE_RDS_RAW_DATA: env->SetByteArrayRegion failed"); 1303 goto EXCEPTION; 1304 } 1305 1306 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdWriteRdsRawData, 1307 (jlong)context, 1308 (jint)status, 1309 (jint)event->p.cmdDone.v.rawRds.len, 1310 jRadioTextMsg); 1311 break; 1312 1313 case FM_TX_CMD_READ_RDS_RAW_DATA: 1314 V4L2_JBTL_LOGI("FM_TX_CMD_READ_RDS_RAW_DATA:Status: %d ",status); 1315 jRadioTextMsg = env->NewByteArray(event->p.cmdDone.v.rawRds.len); 1316 1317 if (jRadioTextMsg == NULL) 1318 { 1319 V4L2_JBTL_LOGE("FM_TX_CMD_READ_RDS_RAW_DATA: Failed converting elements"); 1320 goto EXCEPTION; 1321 } 1322 1323 env->SetByteArrayRegion(jRadioTextMsg,0,event->p.cmdDone.v.rawRds.len,(jbyte*)event->p.cmdDone.v.rawRds.data); 1324 1325 if (env->ExceptionOccurred()) { 1326 V4L2_JBTL_LOGE("FM_TX_CMD_READ_RDS_RAW_DATA: env->SetByteArrayRegion failed"); 1327 goto EXCEPTION; 1328 } 1329 1330 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdReadRdsRawData, 1331 (jlong)context, 1332 (jint)status, 1333 (jint)event->p.cmdDone.v.rawRds.len, 1334 jRadioTextMsg); 1335 break; 1336 1337 case FM_TX_CMD_CHANGE_AUDIO_SOURCE: 1338 V4L2_JBTL_LOGI("FM_TX_CMD_CHANGE_AUDIO_SOURCE:Status: %d ",status); 1339 lptUnavailResources = (jclass *)event->p.cmdDone.v.audioOperation.ptUnavailResources; 1340 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdChangeAudioSource, 1341 (jlong)context, 1342 (jint)status, 1343 (jclass)lptUnavailResources); 1344 break; 1345 */ 1346 case FM_TX_CMD_CHANGE_DIGITAL_AUDIO_CONFIGURATION: 1347 V4L2_JBTL_LOGI("FM_TX_CMD_CHANGE_AUDIO_SOURCE:Status: %d ",status); 1348 env->CallStaticVoidMethod(_sJClass,_sMethodId_nativeCb_fmTxCmdChangeDigitalAudioConfiguration, 1349 (jlong)context, 1350 (jint)status, 1351 (jint)value); 1352 break; 1353 1354 default: 1355 V4L2_JBTL_LOGE("nativeJFmTx_Callback():EVENT cmdType-------------->default"); 1356 // V4L2_JBTL_LOGE("unhandled fm cmdType %d", event->p.cmdDone.cmdType); 1357 break; 1358 } //end switch 1359 1360 if (env->ExceptionOccurred()) { 1361 V4L2_JBTL_LOGE("nativeJFmTx_Callback: ExceptionOccurred"); 1362 goto EXCEPTION; 1363 } 1364 1365 /*Delete the local references 1366 if (jRadioTextMsg!= NULL) 1367 env->DeleteLocalRef(jRadioTextMsg); 1368 */ 1369 V4L2_JBTL_LOGD("nativeJFmTx_Callback: Exiting, Calling DetachCurrentThread at the END"); 1370 1371 // g_jVM->DetachCurrentThread(); 1372 1373 return; 1374 1375 EXCEPTION: 1376 V4L2_JBTL_LOGE("nativeJFmTx_Callback: Exiting due to failure"); 1377 /* if (jRadioTextMsg!= NULL) 1378 env->DeleteLocalRef(jRadioTextMsg); 1379 */ 1380 if (env->ExceptionOccurred()) { 1381 env->ExceptionDescribe(); 1382 env->ExceptionClear(); 1383 } 1384 1385 g_jVM->DetachCurrentThread(); 1386 1387 return; 1388 1389 } 1390 1391 /********************************************************************** 1392 * Callback registration 1393 1394 ***********************************************************************/ 1395 #define VERIFY_METHOD_ID(methodId) \ 1396 if (!_VerifyMethodId(methodId, #methodId)) { \ 1397 V4L2_JBTL_LOGE("Error obtaining method id for %s", #methodId); \ 1398 return; \ 1399 } 1400 1401 static bool _VerifyMethodId(jmethodID methodId, const char *name) 1402 { 1403 bool result = true; 1404 1405 if (methodId == NULL) 1406 { 1407 V4L2_JBTL_LOGE("_VerifyMethodId: Failed getting method id of %s", name); 1408 result = false; 1409 } 1410 1411 return result; 1412 } 1413 1414 1415 1416 void nativeJFmTx_ClassInitNative(JNIEnv* env, jclass clazz){ 1417 V4L2_JBTL_LOGD("nativeJFmTx_ClassInitNative: Entered"); 1418 1419 1420 if (NULL == env) 1421 { 1422 V4L2_JBTL_LOGE("nativeJFmRx_ClassInitNative: NULL == env"); 1423 } 1424 1425 env->GetJavaVM(&g_jVM); 1426 1427 /* Save class information in global reference in order to prevent class unloading */ 1428 _sJClass = (jclass)env->NewGlobalRef(clazz); 1429 1430 /* Initialize structure of RBTL callbacks */ 1431 V4L2_JBTL_LOGD("nativeJFmTx_ClassInitNative: Initializing FMTX callback structure"); 1432 1433 1434 V4L2_JBTL_LOGD("nativeJFmTx_ClassInitNative: Obtaining method IDs"); 1435 1436 1437 _sMethodId_nativeCb_fmTxCmdEnable = env->GetStaticMethodID(clazz, 1438 "nativeCb_fmTxCmdEnable", 1439 "(JIJ)V"); 1440 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdEnable); 1441 1442 1443 _sMethodId_nativeCb_fmTxCmdDisable = env->GetStaticMethodID(clazz, 1444 "nativeCb_fmTxCmdDisable", 1445 "(JIJ)V"); 1446 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdDisable); 1447 1448 _sMethodId_nativeCb_fmTxCmdDestroy = env->GetStaticMethodID(clazz, 1449 "nativeCb_fmTxCmdDestroy", 1450 "(JIJ)V"); 1451 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdDestroy); 1452 1453 1454 _sMethodId_nativeCb_fmTxCmdTune = env->GetStaticMethodID(clazz, 1455 "nativeCb_fmTxCmdTune", 1456 "(JIJ)V"); 1457 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdTune); 1458 1459 1460 _sMethodId_nativeCb_fmTxCmdGetTunedFrequency= env->GetStaticMethodID(clazz, 1461 "nativeCb_fmTxCmdGetTunedFrequency", 1462 "(JIJ)V"); 1463 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetTunedFrequency); 1464 1465 1466 1467 _sMethodId_nativeCb_fmTxCmdStartTransmission = env->GetStaticMethodID(clazz, 1468 "nativeCb_fmTxCmdStartTransmission", 1469 "(JI)V"); 1470 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdStartTransmission); 1471 1472 1473 _sMethodId_nativeCb_fmTxCmdStopTransmission = env->GetStaticMethodID(clazz, 1474 "nativeCb_fmTxCmdStopTransmission", 1475 "(JIJ)V"); 1476 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdStopTransmission); 1477 1478 1479 _sMethodId_nativeCb_fmTxCmdEnableRds = env->GetStaticMethodID(clazz, 1480 "nativeCb_fmTxCmdEnableRds", 1481 "(JIJ)V"); 1482 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdEnableRds); 1483 1484 1485 _sMethodId_nativeCb_fmTxCmdDisableRds = env->GetStaticMethodID(clazz, 1486 "nativeCb_fmTxCmdDisableRds", 1487 "(JIJ)V"); 1488 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdDisableRds); 1489 1490 _sMethodId_nativeCb_fmTxCmdSetRdsTextRtMsg= env->GetStaticMethodID(clazz, 1491 "nativeCb_fmTxCmdSetRdsTextRtMsg", 1492 "(JIII[B)V"); 1493 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetRdsTextRtMsg); 1494 1495 1496 /* 1497 _sMethodId_nativeCb_fmTxCmdSetRdsTransmissionMode = env->GetStaticMethodID(clazz, 1498 "nativeCb_fmTxCmdSetRdsTransmissionMode", 1499 "(JIJ)V"); 1500 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetRdsTransmissionMode); 1501 _sMethodId_nativeCb_fmTxCmdGetRdsTransmissionMode = env->GetStaticMethodID(clazz, 1502 "nativeCb_fmTxCmdGetRdsTransmissionMode", 1503 "(JIJ)V"); 1504 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetRdsTransmissionMode); 1505 1506 _sMethodId_nativeCb_fmTxCmdGetRdsTrafficCodes= env->GetStaticMethodID(clazz, 1507 "nativeCb_fmTxCmdGetRdsTrafficCodes", 1508 "(JIII)V"); 1509 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetRdsTrafficCodes); 1510 1511 1512 _sMethodId_nativeCb_fmTxCmdSetRdsTrafficCodes= env->GetStaticMethodID(clazz, 1513 "nativeCb_fmTxCmdSetRdsTrafficCodes", 1514 "(JIII)V"); 1515 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetRdsTrafficCodes); 1516 1517 1518 */ 1519 _sMethodId_nativeCb_fmTxCmdSetRdsTextPsMsg= env->GetStaticMethodID(clazz, 1520 "nativeCb_fmTxCmdSetRdsTextPsMsg", 1521 "(JII[B)V"); 1522 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetRdsTextPsMsg); 1523 1524 /* 1525 _sMethodId_nativeCb_fmTxCmdGetRdsTextPsMsg= env->GetStaticMethodID(clazz, 1526 "nativeCb_fmTxCmdGetRdsTextPsMsg", 1527 "(JII[B)V"); 1528 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetRdsTextPsMsg); 1529 1530 1531 _sMethodId_nativeCb_fmTxCmdGetRdsTextRtMsg= env->GetStaticMethodID(clazz, 1532 "nativeCb_fmTxCmdGetRdsTextRtMsg", 1533 "(JIII[B)V"); 1534 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetRdsTextRtMsg); 1535 1536 1537 _sMethodId_nativeCb_fmTxCmdWriteRdsRawData= env->GetStaticMethodID(clazz, 1538 "nativeCb_fmTxCmdWriteRdsRawData", 1539 "(JII[B)V"); 1540 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdWriteRdsRawData); 1541 1542 1543 _sMethodId_nativeCb_fmTxCmdReadRdsRawData= env->GetStaticMethodID(clazz, 1544 "nativeCb_fmTxCmdReadRdsRawData", 1545 "(JII[B)V"); 1546 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdReadRdsRawData); 1547 1548 */ 1549 1550 _sMethodId_nativeCb_fmTxCmdSetInterruptMask= env->GetStaticMethodID(clazz, 1551 "nativeCb_fmTxCmdSetInterruptMask", 1552 "(JIJ)V"); 1553 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetInterruptMask); 1554 1555 /* 1556 _sMethodId_nativeCb_fmTxCmdGetInterruptMask= env->GetStaticMethodID(clazz, 1557 "nativeCb_fmTxCmdGetInterruptMask", 1558 "(JIJ)V"); 1559 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetInterruptMask); 1560 */ 1561 1562 1563 _sMethodId_nativeCb_fmTxCmdSetMonoStereoMode= env->GetStaticMethodID(clazz, 1564 "nativeCb_fmTxCmdSetMonoStereoMode", 1565 "(JIJ)V"); 1566 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetMonoStereoMode); 1567 1568 1569 _sMethodId_nativeCb_fmTxCmdGetMonoStereoMode= env->GetStaticMethodID(clazz, 1570 "nativeCb_fmTxCmdGetMonoStereoMode", 1571 "(JIJ)V"); 1572 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetMonoStereoMode); 1573 1574 1575 1576 _sMethodId_nativeCb_fmTxCmdSetPowerLevel= env->GetStaticMethodID(clazz, 1577 "nativeCb_fmTxCmdSetPowerLevel", 1578 "(JIJ)V"); 1579 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetPowerLevel); 1580 1581 1582 1583 _sMethodId_nativeCb_fmTxCmdGetPowerLevel= env->GetStaticMethodID(clazz, 1584 "nativeCb_fmTxCmdGetPowerLevel", 1585 "(JIJ)V"); 1586 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetPowerLevel); 1587 1588 1589 _sMethodId_nativeCb_fmTxCmdSetMuteMode= env->GetStaticMethodID(clazz, 1590 "nativeCb_fmTxCmdSetMuteMode", 1591 "(JIJ)V"); 1592 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetMuteMode); 1593 1594 1595 _sMethodId_nativeCb_fmTxCmdGetMuteMode= env->GetStaticMethodID(clazz, 1596 "nativeCb_fmTxCmdGetMuteMode", 1597 "(JIJ)V"); 1598 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetMuteMode); 1599 1600 1601 _sMethodId_nativeCb_fmTxCmdSetRdsAfCode= env->GetStaticMethodID(clazz, 1602 "nativeCb_fmTxCmdSetRdsAfCode", 1603 "(JIJ)V"); 1604 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetRdsAfCode); 1605 1606 1607 1608 _sMethodId_nativeCb_fmTxCmdGetRdsAfCode= env->GetStaticMethodID(clazz, 1609 "nativeCb_fmTxCmdGetRdsAfCode", 1610 "(JIJ)V"); 1611 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetRdsAfCode); 1612 1613 1614 1615 _sMethodId_nativeCb_fmTxCmdSetRdsPiCode= env->GetStaticMethodID(clazz, 1616 "nativeCb_fmTxCmdSetRdsPiCode", 1617 "(JIJ)V"); 1618 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetRdsPiCode); 1619 1620 1621 _sMethodId_nativeCb_fmTxCmdGetRdsPiCode= env->GetStaticMethodID(clazz, 1622 "nativeCb_fmTxCmdGetRdsPiCode", 1623 "(JIJ)V"); 1624 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetRdsPiCode); 1625 1626 1627 _sMethodId_nativeCb_fmTxCmdSetRdsPtyCode= env->GetStaticMethodID(clazz, 1628 "nativeCb_fmTxCmdSetRdsPtyCode", 1629 "(JIJ)V"); 1630 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetRdsPtyCode); 1631 1632 1633 _sMethodId_nativeCb_fmTxCmdGetRdsPtyCode= env->GetStaticMethodID(clazz, 1634 "nativeCb_fmTxCmdGetRdsPtyCode", 1635 "(JIJ)V"); 1636 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetRdsPtyCode); 1637 1638 1639 1640 _sMethodId_nativeCb_fmTxCmdSetRdsPsDispalyMode= env->GetStaticMethodID(clazz, 1641 "nativeCb_fmTxCmdSetRdsPsDispalyMode", 1642 "(JIJ)V"); 1643 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetRdsPsDispalyMode); 1644 1645 1646 1647 _sMethodId_nativeCb_fmTxCmdGetRdsPsDispalyMode= env->GetStaticMethodID(clazz, 1648 "nativeCb_fmTxCmdGetRdsPsDispalyMode", 1649 "(JIJ)V"); 1650 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetRdsPsDispalyMode); 1651 1652 1653 1654 _sMethodId_nativeCb_fmTxCmdSetRdsPsDisplaySpeed= env->GetStaticMethodID(clazz, 1655 "nativeCb_fmTxCmdSetRdsPsDisplaySpeed", 1656 "(JIJ)V"); 1657 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetRdsPsDisplaySpeed); 1658 1659 1660 _sMethodId_nativeCb_fmTxCmdGetRdsPsDisplaySpeed= env->GetStaticMethodID(clazz, 1661 "nativeCb_fmTxCmdGetRdsPsDisplaySpeed", 1662 "(JIJ)V"); 1663 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetRdsPsDisplaySpeed); 1664 1665 1666 _sMethodId_nativeCb_fmTxCmdSetRdsTransmittedMask= env->GetStaticMethodID(clazz, 1667 "nativeCb_fmTxCmdSetRdsTransmittedMask", 1668 "(JIJ)V"); 1669 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetRdsTransmittedMask); 1670 1671 1672 _sMethodId_nativeCb_fmTxCmdGetRdsTransmittedMask= env->GetStaticMethodID(clazz, 1673 "nativeCb_fmTxCmdGetRdsTransmittedMask", 1674 "(JIJ)V"); 1675 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetRdsTransmittedMask); 1676 1677 1678 _sMethodId_nativeCb_fmTxCmdSetRdsMusicSpeechFlag = env->GetStaticMethodID(clazz, 1679 "nativeCb_fmTxCmdSetRdsMusicSpeechFlag", 1680 "(JIJ)V") ; 1681 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetRdsMusicSpeechFlag); 1682 1683 1684 _sMethodId_nativeCb_fmTxCmdGetRdsMusicSpeechFlag = env->GetStaticMethodID(clazz, 1685 "nativeCb_fmTxCmdGetRdsMusicSpeechFlag", 1686 "(JIJ)V") ; 1687 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetRdsMusicSpeechFlag); 1688 1689 1690 _sMethodId_nativeCb_fmTxCmdSetPreEmphasisFilter= env->GetStaticMethodID(clazz, 1691 "nativeCb_fmTxCmdSetPreEmphasisFilter", 1692 "(JIJ)V"); 1693 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetPreEmphasisFilter); 1694 1695 1696 _sMethodId_nativeCb_fmTxCmdGetPreEmphasisFilter= env->GetStaticMethodID(clazz, 1697 "nativeCb_fmTxCmdGetPreEmphasisFilter", 1698 "(JIJ)V"); 1699 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetPreEmphasisFilter); 1700 1701 1702 1703 _sMethodId_nativeCb_fmTxCmdSetRdsExtendedCountryCode= env->GetStaticMethodID(clazz, 1704 "nativeCb_fmTxCmdSetRdsExtendedCountryCode", 1705 "(JIJ)V"); 1706 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetRdsExtendedCountryCode); 1707 1708 1709 _sMethodId_nativeCb_fmTxCmdGetRdsExtendedCountryCode= env->GetStaticMethodID(clazz, 1710 "nativeCb_fmTxCmdGetRdsExtendedCountryCode", 1711 "(JIJ)V"); 1712 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetRdsExtendedCountryCode); 1713 1714 1715 _sMethodId_nativeCb_fmTxCmdChangeDigitalAudioConfiguration= env->GetStaticMethodID(clazz, 1716 "nativeCb_fmTxCmdChangeDigitalAudioConfiguration", 1717 "(JIJ)V"); 1718 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdChangeDigitalAudioConfiguration); 1719 1720 /* 1721 _sMethodId_nativeCb_fmTxCmdChangeAudioSource= env->GetStaticMethodID(clazz, 1722 "nativeCb_fmTxCmdChangeAudioSource", 1723 "(JILcom/ti/jfm/core/JFmCcmVacUnavailResourceList;)V"); 1724 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdChangeAudioSource); 1725 */ 1726 _sMethodId_nativeCb_fmTxCmdSetRdsTextRepertoire= env->GetStaticMethodID(clazz, 1727 "nativeCb_fmTxCmdSetRdsTextRepertoire", 1728 "(JIJ)V"); 1729 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdSetRdsTextRepertoire); 1730 1731 1732 _sMethodId_nativeCb_fmTxCmdGetRdsTextRepertoire= env->GetStaticMethodID(clazz, 1733 "nativeCb_fmTxCmdGetRdsTextRepertoire", 1734 "(JIJ)V"); 1735 VERIFY_METHOD_ID(_sMethodId_nativeCb_fmTxCmdGetRdsTextRepertoire); 1736 1737 V4L2_JBTL_LOGD("nativeJFmTx_ClassInitNative:Exiting"); 1738 } 1739 1740 JNINativeMethod JFmTxNative_sMethods[] = { 1741 /* name, signature, funcPtr */ 1742 {"nativeJFmTx_ClassInitNative", "()V", (void*)nativeJFmTx_ClassInitNative}, 1743 {"nativeJFmTx_Create","(Lcom/ti/jfm/core/JFmContext;)I", (void*)nativeJFmTx_Create}, 1744 {"nativeJFmTx_Destroy","(J)I", (void*)nativeJFmTx_Destroy}, 1745 {"nativeJFmTx_Enable","(J)I", (void*)nativeJFmTx_Enable}, 1746 {"nativeJFmTx_Disable","(J)I", (void*)nativeJFmTx_Disable}, 1747 {"nativeJFmTx_Tune","(JJ)I", (void*)nativeJFmTx_Tune}, 1748 {"nativeJFmTx_StopTransmission","(J)I", (void*)nativeJFmTx_StopTransmission}, 1749 {"nativeJFmTx_StartTransmission","(J)I", (void*)nativeJFmTx_StartTransmission}, 1750 {"nativeJFmTx_EnableRds","(J)I", (void*)nativeJFmTx_EnableRds}, 1751 {"nativeJFmTx_DisableRds","(J)I", (void*)nativeJFmTx_DisableRds}, 1752 {"nativeJFmTx_SetRdsTransmissionMode","(JI)I", (void*)nativeJFmTx_SetRdsTransmissionMode}, 1753 {"nativeJFmTx_SetRdsTextPsMsg","(JLjava/lang/String;I)I", (void*)nativeJFmTx_SetRdsTextPsMsg}, 1754 /* 1755 {"nativeJFmTx_GetRdsTextPsMsg","(J)I", (void*)nativeJFmTx_GetRdsTextPsMsg}, 1756 {"nativeJFmTx_WriteRdsRawData","(JLjava/lang/String;I)I", (void*)nativeJFmTx_WriteRdsRawData}, 1757 */ 1758 {"nativeJFmTx_SetMuteMode","(JI)I", (void*)nativeJFmTx_SetMuteMode}, 1759 {"nativeJFmTx_GetMuteMode","(J)I", (void*)nativeJFmTx_GetMuteMode}, 1760 {"nativeJFmTx_SetRdsTextRtMsg","(JILjava/lang/String;I)I", (void*)nativeJFmTx_SetRdsTextRtMsg}, 1761 {"nativeJFmTx_SetRdsTransmittedGroupsMask","(JJ)I", (void*)nativeJFmTx_SetRdsTransmittedGroupsMask}, 1762 /* 1763 {"nativeJFmTx_SetRdsPsDisplayMode","(JI)I", (void*)nativeJFmTx_SetRdsPsDisplayMode}, 1764 {"nativeJFmTx_GetRdsPsDisplayMode","(J)I", (void*)nativeJFmTx_GetRdsPsDisplayMode}, 1765 {"nativeJFmTx_GetRdsTextRtMsg","(J)I", (void*)nativeJFmTx_GetRdsTextRtMsg}, 1766 {"nativeJFmTx_GetRdsTransmittedGroupsMask","(J)I", (void*)nativeJFmTx_GetRdsTransmittedGroupsMask}, 1767 {"nativeJFmTx_SetRdsTrafficCodes","(JII)I", (void*)nativeJFmTx_SetRdsTrafficCodes}, 1768 {"nativeJFmTx_GetRdsTrafficCodes","(J)I", (void*)nativeJFmTx_GetRdsTrafficCodes}, 1769 {"nativeJFmTx_SetRdsMusicSpeechFlag","(JI)I", (void*)nativeJFmTx_SetRdsMusicSpeechFlag}, 1770 {"nativeJFmTx_GetRdsMusicSpeechFlag","(J)I", (void*)nativeJFmTx_GetRdsMusicSpeechFlag}, 1771 {"nativeJFmTx_SetRdsExtendedCountryCode","(JI)I", (void*)nativeJFmTx_SetRdsExtendedCountryCode}, 1772 {"nativeJFmTx_GetRdsExtendedCountryCode","(J)I", (void*)nativeJFmTx_GetRdsExtendedCountryCode}, 1773 {"nativeJFmTx_ReadRdsRawData","(J)I", (void*)nativeJFmTx_ReadRdsRawData}, 1774 {"nativeJFmTx_ChangeAudioSource","(JII)I", (void*)nativeJFmTx_ChangeAudioSource}, 1775 */ 1776 {"nativeJFmTx_ChangeDigitalSourceConfiguration","(JI)I", (void*)nativeJFmTx_ChangeDigitalSourceConfiguration}, 1777 {"nativeJFmTx_SetRdsTextRepertoire","(JI)I", (void*)nativeJFmTx_SetRdsTextRepertoire}, 1778 {"nativeJFmTx_GetRdsTextRepertoire","(J)I", (void*)nativeJFmTx_GetRdsTextRepertoire}, 1779 {"nativeJFmTx_SetRdsPtyCode","(JI)I", (void*)nativeJFmTx_SetRdsPtyCode}, 1780 {"nativeJFmTx_GetRdsPtyCode","(J)I", (void*)nativeJFmTx_GetRdsPtyCode}, 1781 {"nativeJFmTx_SetRdsPiCode","(JI)I", (void*)nativeJFmTx_SetRdsPiCode}, 1782 {"nativeJFmTx_GetRdsPiCode","(J)I", (void*)nativeJFmTx_GetRdsPiCode}, 1783 {"nativeJFmTx_SetRdsAfCode","(JI)I", (void*)nativeJFmTx_SetRdsAfCode}, 1784 {"nativeJFmTx_GetRdsAfCode","(J)I", (void*)nativeJFmTx_GetRdsAfCode}, 1785 {"nativeJFmTx_SetMonoStereoMode","(JI)I", (void*)nativeJFmTx_SetMonoStereoMode}, 1786 {"nativeJFmTx_GetMonoStereoMode","(J)I", (void*)nativeJFmTx_GetMonoStereoMode}, 1787 {"nativeJFmTx_SetPowerLevel","(JI)I", (void*)nativeJFmTx_SetPowerLevel}, 1788 {"nativeJFmTx_GetPowerLevel","(J)I", (void*)nativeJFmTx_GetPowerLevel}, 1789 {"nativeJFmTx_SetPreEmphasisFilter","(JI)I", (void*)nativeJFmTx_SetPreEmphasisFilter}, 1790 {"nativeJFmTx_GetPreEmphasisFilter","(J)I", (void*)nativeJFmTx_GetPreEmphasisFilter}, 1791 {"nativeJFmTx_SetRdsPsScrollSpeed","(JI)I", (void*)nativeJFmTx_SetRdsPsScrollSpeed}, 1792 {"nativeJFmTx_GetRdsPsScrollSpeed","(J)I", (void*)nativeJFmTx_GetRdsPsScrollSpeed} 1793 1794 }; 1795 1796 /* 1797 * Register several native methods for one class. 1798 */ 1799 1800 int getTxNativeSize() 1801 { 1802 return NELEM(JFmTxNative_sMethods); 1803 } 1804 1805