1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta name="robots" content="noindex">
<title>pcp.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">
<!-- Generated by Doxygen 1.0.0 on Mon Jan 17 00:45:27 2000 -->
<center>
<a class="qindex"href="index.html">Main Page</a> <a class="qindex"href="annotated.html">Compound List</a> <a class="qindex"href="files.html">File List</a> <a class="qindex"href="headers.html">Header Files</a> <a class="qindex"href="sources.html">Sources</a> <a class="qindex"href="functions.html">Compound Members</a> <a class="qindex"href="globals.html">File Members</a> </center>
<hr><h1>pcp.cpp</h1><div class="fragment"><pre>00001 /*
00002 Copyright (C) 1999 PolyWog and Javaman for Ghetto.Org
00003 This file is part of the PCR-1000 API Library.
00004
00005 The PCR-1000 API Library is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU Library General Public License as
00007 published by the Free Software Foundation; either version 2 of the
00008 License, or (at your option) any later version.
00009
00010 The PCR-1000 API Library is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00013 Library General Public License for more details.
00014
00015 You should have received a copy of the GNU Library General Public
00016 License along with the PCR-1000 API Library; see the file LICENSE. If not,
00017 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018 Boston, MA 02111-1307, USA.
00019 */
00020
00021 /*
00022 * This file declares PCP.
00023 * PCP Is the actual object that interfaces with the GUI
00024 * This API deals with the error handling and the calls
00025 * that must be made to and from the radio, via the PComm
00026 * serial i/o object.
00027 */
00028
00029 #include "pcp.h"
00030
00031 #include <stdio.h>
00032 #include <unistd.h>
00033 #include <stdlib.h>
00034
00035 #if defined (SunOS) || defined (Irix)
00036 #include <strings.h>
00037 #else // def SunOs/Irix
00038 #include <string.h>
00039 #endif // def SunOs/Irix
00040
<a name="l00041"><a class="code" href="class_pcp.html#a0">00041</a></a> <a class="code" href="class_pcp.html#a0">PCP :: PCP</a>(char *port, tcflag_t speed, const char *name)
00042 {
00043 PCPRadio = new <a class="code" href="class_pradinf.html">PRadInf</a>;
00044 PCPComm = new PComm(port, speed, name);
00045
00046 bzero(PCPRadio, sizeof( <a class="code" href="class_pradinf.html">PRadInf</a>));
00047 bzero(PCPTemp, sizeof(PCPTemp));
00048
00049 strncpy(PCPRadio->PCPPort, port, 0xff);
00050 PCPRadio->PCPSpeed = speed;
00051 PCPRadio->PCPVolume = 0;
00052 PCPRadio->PCPSquelch = 0;
00053 PCPRadio->PCPFreq = 146000000;
00054 strncpy(PCPRadio->PCPMode, PCRMODNFM, sizeof(PCPRadio->PCPMode));
00055 strncpy(PCPRadio->PCPFilter, PCRFLTR15, sizeof(PCPRadio->PCPFilter));
00056 PCPRadio->PCPToneSq=0;
00057 PCPRadio->PCPToneSqFloat=0.0;
00058 PCPRadio->PCPAutoGain=false;
00059 PCPRadio->PCPNoiseBlank=false;
00060 PCPRadio->PCPRFAttenuator=false;
00061 PCPRadio->PCPAutoUpdate = false;
00062 PCPStatus = false;
00063 }
<a name="l00079"><a class="code" href="class_pcp.html#a1">00079</a></a> <a class="code" href="class_pcp.html#a1">PCP :: ~PCP</a>()
00080 {
00081 delete PCPComm;
00082 }
<a name="l00090"><a class="code" href="class_pcp.html#a2">00090</a></a> bool <a class="code" href="class_pcp.html#a2">PCP :: PCPInit</a>(bool autoUpdate)
00091 {
00092 if (autoUpdate==false) {
00093 PCPComm->PCTell(PCRINITM);
00094 fprintf(stderr, "Radio is coming up. Please wait...\n");
00095 sleep(1);
00096 if (PCPStatus)
00097 if (PCPCheckResponse()) {
00098 PCPRadio->PCPAutoUpdate=false;
00099 return true;
00100 }
00101 } else {
00102 PCPComm->PCTell(PCRINITA);
00103 sleep(1);
00104 if (PCPStatus)
00105 if (PCPCheckResponse()) {
00106 PCPRadio->PCPAutoUpdate=true;
00107 return true;
00108 }
00109 }
00110
00111 return false;
00112 }
<a name="l00131"><a class="code" href="class_pcp.html#a3">00131</a></a> bool <a class="code" href="class_pcp.html#a3">PCP :: PCPPowerUp</a>()
00132 {
00133 PCPComm->PCTell(PCRPWRON);
00134 if (PCPCheckResponse()) {
00135 // PCPCheckResponse();
00136 PCPStatus=true;
00137 return true;
00138 }
00139 return false;
00140 }
<a name="l00152"><a class="code" href="class_pcp.html#a4">00152</a></a> bool <a class="code" href="class_pcp.html#a4">PCP :: PCPPowerDown</a>()
00153 {
00154 PCPComm->PCTell(PCRPWROFF);
00155 // if (PCPCheckResponse()) {
00156 PCPCheckResponse();
00157 PCPStatus=false;
00158 return true;
00159 // }
00160 // return false;
00161 }
<a name="l00173"><a class="code" href="class_pcp.html#a5">00173</a></a> bool <a class="code" href="class_pcp.html#a5">PCP :: PCPSetSpeed</a>(tcflag_t speed)
00174 {
00175 if ( (B300<=speed)&&(speed<=B38400) ) {
00176 bzero(PCPRadio->PCPInitSpeed, sizeof(PCPRadio->PCPInitSpeed));
00177 switch (speed) {
00178 case B38400:
00179 // you probably want to set the speed
00180 // to fastest available, so let's put
00181 // this here first
00182 strncpy(PCPRadio->PCPInitSpeed, PCRBD38400,
00183 sizeof(PCPRadio->PCPInitSpeed)-1);
00184 break;
00185 case B19200:
00186 strncpy(PCPRadio->PCPInitSpeed, PCRBD19200,
00187 sizeof(PCPRadio->PCPInitSpeed)-1);
00188 break;
00189 case B300:
00190 strncpy(PCPRadio->PCPInitSpeed, PCRBD300,
00191 sizeof(PCPRadio->PCPInitSpeed)-1);
00192 break;
00193 case B1200:
00194 strncpy(PCPRadio->PCPInitSpeed, PCRBD1200,
00195 sizeof(PCPRadio->PCPInitSpeed)-1);
00196 break;
00197 case B2400:
00198 strncpy(PCPRadio->PCPInitSpeed, PCRBD2400,
00199 sizeof(PCPRadio->PCPInitSpeed)-1);
00200 break;
00201 default:
00202 // if all else fails, we'll always
00203 // have paris! ~=^)
00204 strncpy(PCPRadio->PCPInitSpeed, PCRBD9600,
00205 sizeof(PCPRadio->PCPInitSpeed)-1);
00206 }
00207 PCPComm->PCTell(PCPRadio->PCPInitSpeed);
00208 delete PCPComm;
00209 PCPComm = new PComm(PCPRadio->PCPPort, speed, "PCPComm_R");
00210 // investigate possible responses, i dont think one is given.
00211 // PCPCheckResponse();
00212 PCPRadio->PCPSpeed = speed;
00213 return true;
00214 }
00215
00216 return false;
00217 }
<a name="l00246"><a class="code" href="class_pcp.html#a6">00246</a></a> bool <a class="code" href="class_pcp.html#a6">PCP :: PCPSetPort</a>(const char *port)
00247 {
00248 PCPComm->PCClose();
00249 return(PCPComm->PCOpen(port));
00250 }
<a name="l00263"><a class="code" href="class_pcp.html#a7">00263</a></a> bool <a class="code" href="class_pcp.html#a7">PCP :: PCPSetVolume</a>(int volume)
00264 {
00265 if ((0<=volume)&&(volume<=99)) {
00266 bzero(PCPTemp, sizeof(PCPTemp));
00267 sprintf(PCPTemp, "%s%0.2d", PCRVOL, volume);
00268 PCPComm->PCTell(PCPTemp);
00269 if (PCPCheckResponse()) {
00270 PCPRadio->PCPVolume=volume;
00271 return true;
00272 }
00273 }
00274
00275 return false;
00276 }
<a name="l00292"><a class="code" href="class_pcp.html#a8">00292</a></a> bool <a class="code" href="class_pcp.html#a8">PCP :: PCPSetSquelch</a>(int squelch)
00293 {
00294 if ((0<=squelch)&&(squelch<=99)) {
00295 bzero(PCPTemp, sizeof(PCPTemp));
00296 sprintf(PCPTemp, "%s%0.2d", PCRSQL, squelch);
00297 PCPComm->PCTell(PCPTemp);
00298 if (PCPCheckResponse()) {
00299 PCPRadio->PCPSquelch=squelch;
00300 return true;
00301 }
00302 }
00303
00304 return false;
00305 }
<a name="l00322"><a class="code" href="class_pcp.html#a9">00322</a></a> bool <a class="code" href="class_pcp.html#a9">PCP :: PCPSetFreq</a>(pcrfreq_t freq)
00323 {
00324 char freqConv[32];
00325 bzero(freqConv, sizeof(freqConv));
00326
00327 if ((LOWERFRQ<=freq)&&(freq<=UPPERFRQ)) {
00328 bzero(PCPTemp, sizeof(PCPTemp));
00329 sprintf(freqConv, "%0.10lu", freq);
00330 strcpy(PCPTemp, PCRFRQ);
00331 strcat(PCPTemp, freqConv);
00332 strcat(PCPTemp, PCPRadio->PCPMode);
00333 strcat(PCPTemp, PCPRadio->PCPFilter);
00334 strcat(PCPTemp, "00");
00335 PCPComm->PCTell(PCPTemp);
00336 if (PCPCheckResponse()) {
00337 PCPRadio->PCPFreq=freq;
00338 #ifdef DEBUG_VER_
00339 fprintf(stderr, "PCP: PCPSETFREQ - Success\n");
00340 #endif
00341 return true;
00342 }
00343 }
00344 #ifdef DEBUG_VER_
00345 fprintf(stderr, "PCP: PCPSETFREQ - Failed\n");
00346 #endif
00347 return false;
00348 }
<a name="l00374"><a class="code" href="class_pcp.html#a10">00374</a></a> bool <a class="code" href="class_pcp.html#a10">PCP :: PCPSetMode</a>(const char *mode)
00375 {
00376 char freqConv[32];
00377 char temp[8];
00378
00379 bzero(PCPTemp, sizeof(PCPTemp));
00380 sprintf(freqConv, "%0.10lu", PCPRadio->PCPFreq);
00381 strcpy(PCPTemp, PCRFRQ);
00382 strcat(PCPTemp, freqConv);
00383
00384 if ( strncmp(mode, "AM", 2)==0 ) {
00385 strcat(PCPTemp, PCRMODAM);
00386 strcpy(temp, PCRMODAM);
00387 } else if ( strncmp(mode, "CW", 2)== 0 ) {
00388 strcat(PCPTemp, PCRMODCW);
00389 strcpy(temp, PCRMODCW);
00390 } else if ( strncmp(mode, "LSB", 3)==0 ) {
00391 strcat(PCPTemp, PCRMODLSB);
00392 strcpy(temp, PCRMODLSB);
00393 } else if ( strncmp(mode, "USB", 3)==0 ) {
00394 strcat(PCPTemp, PCRMODUSB);
00395 strcpy(temp, PCRMODUSB);
00396 } else if ( strncmp(mode, "NFM", 3)==0 ) {
00397 strcat(PCPTemp, PCRMODNFM);
00398 strcpy(temp, PCRMODNFM);
00399 } else if ( strncmp(mode, "WFM", 3)==0 ) {
00400 strcat(PCPTemp, PCRMODWFM);
00401 strcpy(temp, PCRMODWFM);
00402 } else {
00403 return false;
00404 }
00405
00406 strcat(PCPTemp, PCPRadio->PCPFilter);
00407 strcat(PCPTemp, "00");
00408 PCPComm->PCTell(PCPTemp);
00409 if (PCPCheckResponse()) {
00410 #ifdef DEBUG_VER_
00411 fprintf(stderr, "Storing PCPRadio->PCPMode: %s\n", temp);
00412 #endif // DEBUG_VER_
00413 strcpy(PCPRadio->PCPMode,temp);
00414 return true;
00415 }
00416
00417 return false;
00418
00419 }
<a name="l00441"><a class="code" href="class_pcp.html#a11">00441</a></a> bool <a class="code" href="class_pcp.html#a11">PCP :: PCPSetFilter</a>(const char *filter)
00442 {
00443 char freqConv[32];
00444 char temp[8];
00445
00446 bzero(PCPTemp, sizeof(PCPTemp));
00447 sprintf(freqConv, "%0.10lu", PCPRadio->PCPFreq);
00448 strcpy(PCPTemp, PCRFRQ);
00449 strcat(PCPTemp, freqConv);
00450 strcat(PCPTemp, PCPRadio->PCPMode);
00451
00452 if ( strncmp(filter, "3", 1)==0 ) {
00453 strcat(PCPTemp, PCRFLTR3);
00454 strcpy(temp, PCRFLTR3);
00455 } else if ( strncmp(filter, "6", 1)== 0 ) {
00456 strcat(PCPTemp, PCRFLTR6);
00457 strcpy(temp, PCRFLTR6);
00458 } else if ( strncmp(filter, "15", 2)==0 ) {
00459 strcat(PCPTemp, PCRFLTR15);
00460 strcpy(temp, PCRFLTR15);
00461 } else if ( strncmp(filter, "50", 2)==0 ) {
00462 strcat(PCPTemp, PCRFLTR50);
00463 strcpy(temp, PCRFLTR50);
00464 } else if ( strncmp(filter, "230", 3)==0 ) {
00465 strcat(PCPTemp, PCRFLTR230);
00466 strcpy(temp, PCRFLTR230);
00467 } else {
00468 return false;
00469 }
00470
00471 strcat(PCPTemp, "00");
00472 PCPComm->PCTell(PCPTemp);
00473 if (PCPCheckResponse()) {
00474 #ifdef DEBUG_VER_
00475 fprintf(stderr, "Storing PCPRadio->PCPFilter: %s\n", temp);
00476 #endif DEBUG_VER_
00477 strcpy(PCPRadio->PCPFilter,temp);
00478 return true;
00479 }
00480
00481 return false;
00482 }
<a name="l00503"><a class="code" href="class_pcp.html#a14">00503</a></a> bool <a class="code" href="class_pcp.html#a14">PCP :: PCPSetToneSq</a>(const char *value)
00504 {
00505 #ifdef DEBUG_VER_
00506 fprintf(stderr, "PCP: PCPSETTONESQ (string) - %s\n", value);
00507 #endif // DEBUG_VER_
00508
00509 bzero(PCPTemp, sizeof(PCPTemp));
00510 strncpy(PCPTemp, PCRTSQL, sizeof(PCPTemp));
00511 strncat(PCPTemp, value, sizeof(PCPTemp));
00512 PCPComm->PCTell(PCPTemp);
00513 if (PCPCheckResponse()) {
00514 PCPRadio->PCPToneSq=value;
00515 return true;
00516 }
00517
00518 return false;
00519 }
<a name="l00537"><a class="code" href="class_pcp.html#a15">00537</a></a> bool <a class="code" href="class_pcp.html#a14">PCP :: PCPSetToneSq</a>(float passvalue)
00538 {
00539 #ifdef DEBUG_VER_
00540 fprintf(stderr, "PCP: PCPSETTONESQ (float) - %f\n", passvalue);
00541 #endif // DEBUG_VER_
00542
00543 int tone;
00544
00545 tone = (int)(passvalue * 10.0 + .1); // Hack to remove truncating errors.
00546 PCPRadio->PCPToneSqFloat=passvalue;
00547
00548 switch (tone)
00549 {
00550 case 0: return PCPSetToneSq("00"); break;
00551 case 670: return PCPSetToneSq("01"); break;
00552 case 693: return PCPSetToneSq("02"); break;
00553 case 710: return PCPSetToneSq("03"); break;
00554 case 719: return PCPSetToneSq("04"); break;
00555 case 744: return PCPSetToneSq("05"); break;
00556 case 770: return PCPSetToneSq("06"); break;
00557 case 797: return PCPSetToneSq("07"); break;
00558 case 825: return PCPSetToneSq("08"); break;
00559 case 854: return PCPSetToneSq("09"); break;
00560 case 885: return PCPSetToneSq("0A"); break;
00561 case 915: return PCPSetToneSq("0B"); break;
00562 case 948: return PCPSetToneSq("0C"); break;
00563 case 974: return PCPSetToneSq("0D"); break;
00564 case 1000: return PCPSetToneSq("0E"); break;
00565 case 1035: return PCPSetToneSq("0F"); break;
00566 case 1072: return PCPSetToneSq("10"); break;
00567 case 1109: return PCPSetToneSq("11"); break;
00568 case 1148: return PCPSetToneSq("12"); break;
00569 case 1188: return PCPSetToneSq("13"); break;
00570 case 1230: return PCPSetToneSq("14"); break;
00571 case 1273: return PCPSetToneSq("15"); break;
00572 case 1318: return PCPSetToneSq("16"); break;
00573 case 1365: return PCPSetToneSq("17"); break;
00574 case 1413: return PCPSetToneSq("18"); break;
00575 case 1462: return PCPSetToneSq("19"); break;
00576 case 1514: return PCPSetToneSq("1A"); break;
00577 case 1567: return PCPSetToneSq("1B"); break;
00578 case 1598: return PCPSetToneSq("1C"); break;
00579 case 1622: return PCPSetToneSq("1D"); break;
00580 case 1655: return PCPSetToneSq("1E"); break;
00581 case 1679: return PCPSetToneSq("1F"); break;
00582 case 1713: return PCPSetToneSq("20"); break;
00583 case 1738: return PCPSetToneSq("21"); break;
00584 case 1773: return PCPSetToneSq("22"); break;
00585 case 1799: return PCPSetToneSq("23"); break;
00586 case 1835: return PCPSetToneSq("24"); break;
00587 case 1862: return PCPSetToneSq("25"); break;
00588 case 1899: return PCPSetToneSq("26"); break;
00589 case 1928: return PCPSetToneSq("27"); break;
00590 case 1966: return PCPSetToneSq("28"); break;
00591 case 1995: return PCPSetToneSq("29"); break;
00592 case 2035: return PCPSetToneSq("2A"); break;
00593 case 2065: return PCPSetToneSq("2B"); break;
00594 case 2107: return PCPSetToneSq("2C"); break;
00595 case 2181: return PCPSetToneSq("2D"); break;
00596 case 2257: return PCPSetToneSq("2E"); break;
00597 case 2291: return PCPSetToneSq("2F"); break;
00598 case 2336: return PCPSetToneSq("30"); break;
00599 case 2418: return PCPSetToneSq("31"); break;
00600 case 2503: return PCPSetToneSq("32"); break;
00601 case 2541: return PCPSetToneSq("33"); break;
00602 default: PCPSetToneSq("00"); break;
00603 }
00604 return false;
00605 }
<a name="l00623"><a class="code" href="class_pcp.html#a16">00623</a></a> bool <a class="code" href="class_pcp.html#a16">PCP :: PCPSetAutoGain</a>(bool value)
00624 {
00625 #ifdef DEBUG_VER_
00626 fprintf(stderr, "PCP: PCPSETAUTOGAIN - %d\n", value);
00627 #endif // DEBUG_VER_
00628
00629 (value)?(PCPComm->PCTell(PCRAGCON)):(PCPComm->PCTell(PCRAGCOFF));
00630
00631 if (PCPCheckResponse()) {
00632 PCPRadio->PCPAutoGain=value;
00633 return true;
00634 }
00635
00636 return false;
00637 }
<a name="l00655"><a class="code" href="class_pcp.html#a17">00655</a></a> bool <a class="code" href="class_pcp.html#a17">PCP :: PCPSetNB</a>(bool value)
00656 {
00657 #ifdef DEBUG_VER_
00658 fprintf(stderr, "PCP: PCPSETNB - %d\n", value);
00659 #endif // DEBUG_VER_
00660
00661 (value)?(PCPComm->PCTell(PCRNBON)):(PCPComm->PCTell(PCRNBOFF));
00662
00663 if (PCPCheckResponse()) {
00664 PCPRadio->PCPNoiseBlank=value;
00665 return true;
00666 }
00667
00668 return false;
00669 }
<a name="l00687"><a class="code" href="class_pcp.html#a18">00687</a></a> bool <a class="code" href="class_pcp.html#a18">PCP :: PCPSetRFAttenuator</a> ( bool value )
00688 {
00689 #ifdef DEBUG_VER_
00690 fprintf(stderr, "PCP: PCPSETRFATTENUATOR - %d\n", value);
00691 #endif // DEBUG_VER_
00692
00693 (value)?(PCPComm->PCTell(PCRRFAON)):(PCPComm->PCTell(PCRRFAOFF));
00694
00695 if (PCPCheckResponse()) {
00696 PCPRadio->PCPRFAttenuator=value;
00697 return true;
00698 }
00699
00700 return false;
00701 }
00719
00720 // getter methods //
00722
<a name="l00723"><a class="code" href="class_pcp.html#a19">00723</a></a> bool <a class="code" href="class_pcp.html#a19">PCP :: PCPIsOn</a>()
00724 {
00725 return PCPStatus;
00726 }
<a name="l00739"><a class="code" href="class_pcp.html#a13">00739</a></a> const char *<a class="code" href="class_pcp.html#a13">PCP :: PCPSigStrengthStr</a>()
00740 {
00741 #ifdef DEBUG_VER_
00742 fprintf(stderr, "PCP: PCPSIGSTRENGTH (string) Called\n");
00743 #endif // DEBUG_VER_
00744 if(PCPComm->PCAsk(PCRQRST)) {
00745 if(PCPComm->PCHear(PCPTemp)) {
00746 return (const char*)PCPTemp;
00747 }
00748 }
00749
00750 return 0;
00751 }
<a name="l00766"><a class="code" href="class_pcp.html#a12">00766</a></a> int <a class="code" href="class_pcp.html#a12">PCP :: PCPSigStrength</a>()
00767 {
00768 #ifdef DEBUG_VER_
00769 fprintf(stderr, "PCP: PCPSIGSTRENGTH (int) Called\n");
00770 #endif // DEBUG_VER_
00771
00772 int sigstr;
00773 char digit;
00774 if(PCPComm->PCAsk(PCRQRST)) {
00775 if(PCPComm->PCHear(PCPTemp)) {
00776 digit = PCPTemp[2];
00777 if((digit >= 'A') && (digit <= 'F'))
00778 sigstr = (digit - 'A' + 1) * 16;
00779 else
00780 sigstr = atoi(&digit) * 16;
00781
00782 digit = PCPTemp[3];
00783 if((digit >= 'A') && (digit <= 'F'))
00784 sigstr += digit - 'A' + 1;
00785 else
00786 sigstr += atoi(&digit);
00787
00788 return sigstr;
00789 }
00790 }
00791
00792 return 0;
00793 }
<a name="l00802"><a class="code" href="class_pcp.html#a20">00802</a></a> bool <a class="code" href="class_pcp.html#a20">PCP :: PCPQueryOn</a>()
00803 {
00804 #ifdef DEBUG_VER_
00805 fprintf(stderr, "PCP: PCPQUERYON Called\n");
00806 #endif // DEBUG_VER_
00807 if(PCPComm->PCAsk("H1")) {
00808 if(PCPComm->PCHear(PCPTemp)) {
00809 if(strcmp(PCPTemp, "H101") == 0)
00810 return true;
00811 else
00812 return false;
00813 }
00814 }
00815
00816 return false;
00817 }
<a name="l00832"><a class="code" href="class_pcp.html#a21">00832</a></a> bool <a class="code" href="class_pcp.html#a21">PCP :: PCPQuerySquelch</a>()
00833 {
00834 char __tempvar1[8];
00835 bzero(__tempvar1, sizeof(__tempvar1));
00836 strncpy(__tempvar1, PCRASQL, sizeof(__tempvar1)-1);
00837 strncat(__tempvar1, PCRASQLCL, sizeof(__tempvar1)-strlen(__tempvar1)-1);
00838
00839 if (PCPComm->PCAsk(PCRQSQL)) {
00840 if(PCPComm->PCHear(PCPTemp)) {
00841 if (strncmp(PCPTemp, __tempvar1, 4)==0) {
00842 return false;
00843 } else {
00844 return true;
00845 }
00846 }
00847 }
00848 return false;
00849 }
<a name="l00862"><a class="code" href="class_pcp.html#a22">00862</a></a> const char *<a class="code" href="class_pcp.html#a22">PCP :: PCPGetPort</a>()
00863 // return a character string representing the current
00864 // port setting /dev/*
00865 {
00866 return PCPRadio->PCPPort;
00867 }
<a name="l00882"><a class="code" href="class_pcp.html#a23">00882</a></a> tcflag_t <a class="code" href="class_pcp.html#a23">PCP :: PCPGetSpeed_t</a>()
00883 {
00884 return PCPRadio->PCPSpeed;
00885 }
<a name="l00897"><a class="code" href="class_pcp.html#a24">00897</a></a> const char *<a class="code" href="class_pcp.html#a24">PCP :: PCPGetSpeed</a>()
00898 {
00899 switch(PCPRadio->PCPSpeed) {
00900 case B300: return "300"; break;
00901 case B600: return "600"; break;
00902 case B1200: return "1200"; break;
00903 case B1800: return "1800"; break;
00904 case B2400: return "2400"; break;
00905 case B4800: return "4800"; break;
00906 case B9600: return "9600"; break;
00907 case B19200: return "19200"; break;
00908 case B38400: return "38400"; break;
00909 case B57600: return "57600"; break;
00910 default: return "unknown"; break;
00911 }
00912 return "unknown";
00913 }
<a name="l00927"><a class="code" href="class_pcp.html#a25">00927</a></a> int <a class="code" href="class_pcp.html#a25">PCP :: PCPGetVolume</a>()
00928 {
00929 return (PCPRadio->PCPVolume);
00930 }
<a name="l00942"><a class="code" href="class_pcp.html#a26">00942</a></a> const char *<a class="code" href="class_pcp.html#a26">PCP :: PCPGetVolumeStr</a>()
00943 {
00944 sprintf(PCPTemp, "%d", PCPRadio->PCPVolume);
00945 return (PCPTemp);
00946 }
<a name="l00959"><a class="code" href="class_pcp.html#a27">00959</a></a> int <a class="code" href="class_pcp.html#a27">PCP :: PCPGetSquelch</a>()
00960 {
00961 return (PCPRadio->PCPSquelch);
00962 }
<a name="l00974"><a class="code" href="class_pcp.html#a28">00974</a></a> const char *<a class="code" href="class_pcp.html#a28">PCP :: PCPGetSquelchStr</a>()
00975 {
00976 sprintf(PCPTemp, "%d", PCPRadio->PCPSquelch);
00977 return (PCPTemp);
00978 }
<a name="l00991"><a class="code" href="class_pcp.html#a29">00991</a></a> pcrfreq_t <a class="code" href="class_pcp.html#a29">PCP :: PCPGetFreq</a>()
00992 {
00993 return PCPRadio->PCPFreq;
00994 }
<a name="l01008"><a class="code" href="class_pcp.html#a30">01008</a></a> const char *<a class="code" href="class_pcp.html#a30">PCP :: PCPGetFreqStr</a>()
01009 {
01010 sprintf(PCPTemp, "%0.10lu", PCPRadio->PCPFreq);
01011 return PCPTemp;
01012 }
<a name="l01026"><a class="code" href="class_pcp.html#a31">01026</a></a> const pcrcmd_t *<a class="code" href="class_pcp.html#a31">PCP :: PCPGetMode</a>()
01027 {
01028 return (PCPRadio->PCPMode);
01029 }
<a name="l01041"><a class="code" href="class_pcp.html#a32">01041</a></a> const char *<a class="code" href="class_pcp.html#a32">PCP :: PCPGetModeStr</a>()
01042 {
01043 bzero(PCPTemp, sizeof(PCPTemp));
01044
01045 if (strcmp(PCRMODWFM, PCPRadio->PCPMode)==0) {
01046 strcpy(PCPTemp, "WFM");
01047 return PCPTemp;
01048 } else if (strcmp(PCRMODNFM, PCPRadio->PCPMode)==0) {
01049 strcpy(PCPTemp, "NFM");
01050 return PCPTemp;
01051 } else if (strcmp(PCRMODCW, PCPRadio->PCPMode)==0) {
01052 strcpy(PCPTemp, "CW");
01053 return PCPTemp;
01054 } else if (strcmp(PCRMODAM, PCPRadio->PCPMode)==0) {
01055 strcpy(PCPTemp, "AM");
01056 return PCPTemp;
01057 } else if (strcmp(PCRMODUSB, PCPRadio->PCPMode)==0) {
01058 strcpy(PCPTemp, "USB");
01059 return PCPTemp;
01060 } else if (strcmp(PCRMODLSB, PCPRadio->PCPMode)==0) {
01061 strcpy(PCPTemp, "LSB");
01062 return PCPTemp;
01063 }
01064
01065 strcpy(PCPTemp, "UNKNOWN");
01066 return PCPTemp;
01067
01068 }
<a name="l01081"><a class="code" href="class_pcp.html#a33">01081</a></a> const pcrcmd_t *<a class="code" href="class_pcp.html#a33">PCP :: PCPGetFilter</a>()
01082 {
01083 return (PCPRadio->PCPFilter);
01084 }
<a name="l01096"><a class="code" href="class_pcp.html#a34">01096</a></a> const char *<a class="code" href="class_pcp.html#a34">PCP :: PCPGetFilterStr</a>()
01097 {
01098 bzero(PCPTemp, sizeof(PCPTemp));
01099
01100 if (strcmp(PCRFLTR230, PCPRadio->PCPFilter)==0) {
01101 strcpy(PCPTemp, "230");
01102 return PCPTemp;
01103 } else if (strcmp(PCRFLTR50, PCPRadio->PCPFilter)==0) {
01104 strcpy(PCPTemp, "50");
01105 return PCPTemp;
01106 } else if (strcmp(PCRFLTR15, PCPRadio->PCPFilter)==0) {
01107 strcpy(PCPTemp, "15");
01108 return PCPTemp;
01109 } else if (strcmp(PCRFLTR6, PCPRadio->PCPFilter)==0) {
01110 strcpy(PCPTemp, "6");
01111 return PCPTemp;
01112 } else if (strcmp(PCRFLTR3, PCPRadio->PCPFilter)==0) {
01113 strcpy(PCPTemp, "3");
01114 return PCPTemp;
01115 }
01116
01117 return PCPRadio->PCPFilter;
01118 }
<a name="l01131"><a class="code" href="class_pcp.html#a35">01131</a></a> const char *<a class="code" href="class_pcp.html#a35">PCP :: PCPGetToneSq</a>()
01132 {
01133 return PCPRadio->PCPToneSq;
01134 }
<a name="l01146"><a class="code" href="class_pcp.html#a36">01146</a></a> const char *<a class="code" href="class_pcp.html#a36">PCP :: PCPGetToneSqStr</a>()
01147 {
01148 bzero(PCPTemp, sizeof(PCPTemp));
01149 sprintf(PCPTemp, "%f", PCPRadio->PCPToneSqFloat);
01150 return PCPTemp;
01151 }
<a name="l01164"><a class="code" href="class_pcp.html#a37">01164</a></a> bool <a class="code" href="class_pcp.html#a37">PCP :: PCPGetAutoGain</a>()
01165 {
01166 return PCPRadio->PCPAutoGain;
01167 }
<a name="l01179"><a class="code" href="class_pcp.html#a38">01179</a></a> const char *<a class="code" href="class_pcp.html#a38">PCP :: PCPGetAutoGainStr</a>()
01180 {
01181 bzero(PCPTemp, sizeof(PCPTemp));
01182 (PCPGetAutoGain())?(strcpy(PCPTemp,"1")):(strcpy(PCPTemp,"0"));
01183 return PCPTemp;
01184 }
<a name="l01197"><a class="code" href="class_pcp.html#a39">01197</a></a> bool <a class="code" href="class_pcp.html#a39">PCP :: PCPGetNB</a>()
01198 {
01199 return PCPRadio->PCPNoiseBlank;
01200 }
<a name="l01212"><a class="code" href="class_pcp.html#a40">01212</a></a> const char *<a class="code" href="class_pcp.html#a40">PCP :: PCPGetNBStr</a>()
01213 {
01214 bzero(PCPTemp, sizeof(PCPTemp));
01215 (PCPGetNB())?(strcpy(PCPTemp,"1")):(strcpy(PCPTemp,"0"));
01216 return PCPTemp;
01217 }
<a name="l01230"><a class="code" href="class_pcp.html#a41">01230</a></a> bool <a class="code" href="class_pcp.html#a41">PCP :: PCPGetRFAttenuator</a>()
01231 {
01232 return PCPRadio->PCPRFAttenuator;
01233 }
<a name="l01245"><a class="code" href="class_pcp.html#a42">01245</a></a> const char *<a class="code" href="class_pcp.html#a42">PCP :: PCPGetRFAttenuatorStr</a>()
01246 {
01247 bzero(PCPTemp, sizeof(PCPTemp));
01248 (PCPGetRFAttenuator())?(strcpy(PCPTemp,"1")):(strcpy(PCPTemp,"0"));
01249 return PCPTemp;
01250 }
<a name="l01263"><a class="code" href="class_pcp.html#a43">01263</a></a> const <a class="code" href="class_pradinf.html">PRadInf</a> <a class="code" href="class_pcp.html#a43">PCP :: PCPGetRadioInfo</a>()
01264 {
01265 return *PCPRadio;
01266 }
01267
<a name="l01268"><a class="code" href="class_pcp.html#c0">01268</a></a> bool <a class="code" href="class_pcp.html#c0">PCP :: PCPCheckResponse</a>()
01269 {
01270 PCPComm->PCHear(PCPTemp);
01271 if (strncmp(PCPTemp, PCRAOK, 4)==0) {
01272 PCPErrRead=false;
01273 return true;
01274 } else if (strncmp(PCPTemp, PCRABAD, 4)==0) {
01275 PCPErrRead=false;
01276 return false;
01277 }
01278
01279 PCPErrRead = true;
01280 return false;
01281 }
</div></pre><hr><address><small>Generated at Mon Jan 17 00:45:27 2000 for Icom PCR-1000 Library by
<a href="http://www.stack.nl/~dimitri/doxygen/index.html">
<img src="doxygen.gif" alt="doxygen" align=center border=0
width=118 height=53></a> 1.0.0 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
© 1997-1999</small></address>
</body>
</html>
|