Changeset 3278 in ntrip


Ignore:
Timestamp:
Apr 26, 2011, 4:09:39 PM (14 years ago)
Author:
stoecker
Message:

added type 1045

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bnseph.cpp

    r3146 r3278  
    914914}
    915915
     916#define GALILEOTOINT(type, value) static_cast<type>(NearestInt(value, 0))
     917
     918#define GALILEOADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \
     919                       |(GALILEOTOINT(long long,b)&((1LL<<a)-1)); \
     920                       numbits += (a); \
     921                       while(numbits >= 8) { \
     922                       buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}}
     923#define GALILEOADDBITSFLOAT(a,b,c) {long long i = GALILEOTOINT(long long,(b)/(c)); \
     924                             GALILEOADDBITS(a,i)};
    916925// build up RTCM3 for Galileo
    917926////////////////////////////////////////////////////////////////////////////
    918927int t_ephGal::RTCM3(unsigned char *buffer) {
    919 
    920   return 0;
    921 }
     928  int size = 0;
     929  int numbits = 0;
     930  long long bitbuffer = 0;
     931  unsigned char *startbuffer = buffer;
     932  buffer= buffer+3;
     933
     934  GALILEOADDBITS(12, /*inav ? 1046 :*/ 1045)
     935  GALILEOADDBITS(6, _prn.right((_prn.length()-1)).toInt())
     936  GALILEOADDBITS(12, _GPSweek)
     937  GALILEOADDBITS(10, _IODnav)
     938  GALILEOADDBITS(8, _SISA)
     939  GALILEOADDBITSFLOAT(14, _IDOT, PI/static_cast<double>(1<<30)
     940  /static_cast<double>(1<<13))
     941  GALILEOADDBITS(14, _TOC/60)
     942  GALILEOADDBITSFLOAT(6, _clock_driftrate, 1.0/static_cast<double>(1<<30)
     943  /static_cast<double>(1<<29))
     944  GALILEOADDBITSFLOAT(21, _clock_drift, 1.0/static_cast<double>(1<<30)
     945  /static_cast<double>(1<<16))
     946  GALILEOADDBITSFLOAT(31, _clock_bias, 1.0/static_cast<double>(1<<30)
     947  /static_cast<double>(1<<4))
     948  GALILEOADDBITSFLOAT(16, _Crs, 1.0/static_cast<double>(1<<5))
     949  GALILEOADDBITSFLOAT(16, _Delta_n, PI/static_cast<double>(1<<30)
     950  /static_cast<double>(1<<13))
     951  GALILEOADDBITSFLOAT(32, _M0, PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
     952  GALILEOADDBITSFLOAT(16, _Cuc, 1.0/static_cast<double>(1<<29))
     953  GALILEOADDBITSFLOAT(32, _e, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
     954  GALILEOADDBITSFLOAT(16, _Cus, 1.0/static_cast<double>(1<<29))
     955  GALILEOADDBITSFLOAT(32, _sqrt_A, 1.0/static_cast<double>(1<<19))
     956  GALILEOADDBITS(14, _TOE/60)
     957  GALILEOADDBITSFLOAT(16, _Cic, 1.0/static_cast<double>(1<<29))
     958  GALILEOADDBITSFLOAT(32, _OMEGA0, PI/static_cast<double>(1<<30)
     959  /static_cast<double>(1<<1))
     960  GALILEOADDBITSFLOAT(16, _Cis, 1.0/static_cast<double>(1<<29))
     961  GALILEOADDBITSFLOAT(32, _i0, PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
     962  GALILEOADDBITSFLOAT(16, _Crc, 1.0/static_cast<double>(1<<5))
     963  GALILEOADDBITSFLOAT(32, _omega, PI/static_cast<double>(1<<30)
     964  /static_cast<double>(1<<1))
     965  GALILEOADDBITSFLOAT(24, _OMEGADOT, PI/static_cast<double>(1<<30)
     966  /static_cast<double>(1<<13))
     967  GALILEOADDBITSFLOAT(10, _BGD_1_5A, 1.0/static_cast<double>(1<<30)
     968  /static_cast<double>(1<<2))
     969  /*if(inav)
     970  {
     971    GALILEOADDBITSFLOAT(10, _BGD_1_5B, 1.0/static_cast<double>(1<<30)
     972    /static_cast<double>(1<<2))
     973    GALILEOADDBITS(2, _E5bHS)
     974    GALILEOADDBITS(1, flags & MNFGALEPHF_E5BDINVALID)
     975  }
     976  else*/
     977  {
     978    GALILEOADDBITS(2, _E5aHS)
     979    GALILEOADDBITS(1, /*flags & MNFGALEPHF_E5ADINVALID*/0)
     980  }
     981  _TOE = 0.9999E9;
     982  GALILEOADDBITS(20, _TOE)
     983
     984  GALILEOADDBITS(/*inav ? 1 :*/ 3, 0) /* fill up */
     985
     986  startbuffer[0]=0xD3;
     987  startbuffer[1]=(size >> 8);
     988  startbuffer[2]=size;
     989  unsigned long i = CRC24(size+3, startbuffer);
     990  buffer[size++] = i >> 16;
     991  buffer[size++] = i >> 8;
     992  buffer[size++] = i;
     993  size += 3;
     994  return size;
     995}
Note: See TracChangeset for help on using the changeset viewer.