]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Class1Send.c++:
authorAidan Van Dyk <aidan@ifax.com>
Mon, 31 Jan 2005 20:20:59 +0000 (20:20 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Mon, 31 Jan 2005 20:20:59 +0000 (20:20 +0000)
     Class2Params is a subclass of FaxParams.  We don't need
     a new "DCS" made, we just need to "update()" to make sure
     T30 bits agree with the params.
   Class2Params.h, Class2Params.c++:
     Class2Params is a subclass of FaxParams.  It doesn't need to "getDCS".
     It needs to "update" the T30 bits of it's superclass (FaxParams) at some
     points.
     1) override virtual void update (void) to accomplish this

faxd/Class1Send.c++
util/Class2Params.c++
util/Class2Params.h

index c7e515ec5cf8a65a56053e3a5a55b2d55eea99cd..ba91e1d4a22d95de6271a9c1fd4344e29ebb880d 100644 (file)
@@ -618,11 +618,11 @@ Class1Modem::sendTraining(Class2Params& params, int tries, fxStr& emsg)
        if (useV34) hadV34Trouble = true;       // sadly, some receivers will do this with V.34
        return (false);
     }
-    FaxParams dcs_caps = params.getDCS();
+    params.update();
     // we should respect the frame-size preference indication by the remote (DIS_FRAMESIZE)
     if (params.ec != EC_DISABLE && 
        (conf.class1ECMFrameSize == 64 || dis_caps.isBitEnabled(FaxParams::BITNUM_FRAMESIZE))) {
-       dcs_caps.setBit(FaxParams::BITNUM_FRAMESIZE, true); // we don't want to add this bit if not using ECM
+       params.setBit(FaxParams::BITNUM_FRAMESIZE, true); // we don't want to add this bit if not using ECM
        frameSize = 64;
     } else
        frameSize = 256;
@@ -669,10 +669,10 @@ Class1Modem::sendTraining(Class2Params& params, int tries, fxStr& emsg)
             * latter is never used.
             */
            params.br = curcap->br;
-           dcs_caps.setBit(FaxParams::BITNUM_SIGRATE_11, curcap->sr&DCSSIGRATE_9600V29);
-           dcs_caps.setBit(FaxParams::BITNUM_SIGRATE_12, curcap->sr&DCSSIGRATE_4800V27);
-           dcs_caps.setBit(FaxParams::BITNUM_SIGRATE_13, curcap->sr&DCSSIGRATE_14400V33);
-           dcs_caps.setBit(FaxParams::BITNUM_SIGRATE_14, curcap->sr&DCSSIGRATE_14400V17);
+           params.setBit(FaxParams::BITNUM_SIGRATE_11, curcap->sr&DCSSIGRATE_9600V29);
+           params.setBit(FaxParams::BITNUM_SIGRATE_12, curcap->sr&DCSSIGRATE_4800V27);
+           params.setBit(FaxParams::BITNUM_SIGRATE_13, curcap->sr&DCSSIGRATE_14400V33);
+           params.setBit(FaxParams::BITNUM_SIGRATE_14, curcap->sr&DCSSIGRATE_14400V17);
            /*
             * Set the number of train attemps on the same
             * modulation; having set it to 1 we immediately drop
@@ -687,17 +687,17 @@ Class1Modem::sendTraining(Class2Params& params, int tries, fxStr& emsg)
             * T.30 Table 2 Note 33 says that when V.34-fax is used
             * DCS bits 11-14 should be set to zero.
             */
-           dcs_caps.setBit(FaxParams::BITNUM_SIGRATE_11, false);
-           dcs_caps.setBit(FaxParams::BITNUM_SIGRATE_12, false);
-           dcs_caps.setBit(FaxParams::BITNUM_SIGRATE_13, false);
-           dcs_caps.setBit(FaxParams::BITNUM_SIGRATE_14, false);
+           params.setBit(FaxParams::BITNUM_SIGRATE_11, false);
+           params.setBit(FaxParams::BITNUM_SIGRATE_12, false);
+           params.setBit(FaxParams::BITNUM_SIGRATE_13, false);
+           params.setBit(FaxParams::BITNUM_SIGRATE_14, false);
        }
        int t = 1;
        do {
            if (!useV34) protoTrace("SEND training at %s %s",
                modulationNames[curcap->mod],
                Class2Params::bitRateNames[curcap->br]);
-           if (!sendPrologue(dcs_caps, lid)) {
+           if (!sendPrologue(params, lid)) {
                if (abortRequested())
                    goto done;
                protoTrace("Error sending T.30 prologue frames");
index 9fc6ce4679ee6fabd9ff6a07c2f1f581a09df235..9982e34bb2bf4cda1b908d808afec266d18ee549 100644 (file)
@@ -367,8 +367,8 @@ Class2Params::setFromDCS(u_int dcs, u_int xinfo)
 /*
  * Return a 24-bit T.30 DCS frame that reflects the parameters.
  */
-FaxParams
-Class2Params::getDCS() const
+void
+Class2Params::update (void)
 {
     u_int dcs = DCS_T4RCVR
            | vrDISTab[vr&1]
@@ -396,9 +396,8 @@ Class2Params::getDCS() const
        ;
     dcs |= (dcs_xinfo != 0 ? DCS_XTNDFIELD : 0);
 
-    FaxParams dcs_caps(dcs, dcs_xinfo);
+    setupT30(dcs, dcs_xinfo);
 
-    return dcs_caps;
 }
 
 /*
index 0a4ed8bc71c374313dffba06bb0d2e68e16512bd..edabc9a7ad81d95b141e1784cc697b3dcc624c2b 100644 (file)
@@ -74,6 +74,7 @@ public:
     static u_int DCSbrTab[16];         // DIS actual bit rate
 
     Class2Params();
+    virtual void update (void);
 
     int operator==(const Class2Params&) const;
     int operator!=(const Class2Params&) const;
@@ -83,7 +84,6 @@ public:
     void setFromDIS(u_int dis, u_int xinfo = 0);
     void setFromDCS(FaxParams& dcs);
     void setFromDCS(u_int dcs, u_int xinfo = 0);
-    FaxParams getDCS() const;
     bool is2D() const;
 
     u_int transferSize(u_int ms) const;