📄 almanac.c
字号:
/*************************************************************************** almanac.c - almanac stuff ------------------- begin : So M鋜 21 17:50:31 CET 2004 copyright : (C) 2004 by Dennis Real email : dev-null@users.sourceforge.net ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#include <stdio.h>#include "def.h"#include "llayer.h"#include "convert.h"#include "datatypes.h"D501_Almanac_Type getAlmanacD501(char *gcommand, int s){ D501_Almanac_Type singlesat; singlesat.wn=0; singlesat.toa=0; singlesat.af0=0; singlesat.af1=0; singlesat.e=0; singlesat.sqrta=0; singlesat.m0=0; singlesat.w=0; singlesat.omg0=0; singlesat.odot=0; singlesat.i=0; singlesat.hlth=0; if ( (s==48) && (((unsigned char)gcommand[1]+2)==s) && (gcommand[0]==31) ) { singlesat.wn=(int)((BYTE)(gcommand[2])+((BYTE)(gcommand[3])*256)); singlesat.toa=char2float(&gcommand[4]); singlesat.af0=char2float(&gcommand[8]); singlesat.af1=char2float(&gcommand[12]); singlesat.e=char2float(&gcommand[16]); singlesat.sqrta=char2float(&gcommand[20]); singlesat.m0=char2float(&gcommand[24]); singlesat.w=char2float(&gcommand[28]); singlesat.omg0=char2float(&gcommand[32]); singlesat.odot=char2float(&gcommand[36]); singlesat.i=char2float(&gcommand[40]); singlesat.hlth=(BYTE)gcommand[44]; } return singlesat;}/* get infos for each satellite and store in global satinfo[n] */void getAllAlmanac(int tty){ unsigned int s; // t=0; char *gcommand; int z=0, anz; D501_Almanac_Type singlesat; extern Almanac_Type satinfo[]; /* abort current transfer */ SendCommand(tty, "\x0a\x02\x00\x00", 4); gcommand=GetCommand(tty, &s); /* start transfer */ SendCommand(tty, "\x0a\x02\x01\x00", 4); gcommand=GetCommand(tty, &s); //ack if ( gcommand==NULL ) { return; } gcommand=GetCommand(tty, &s); //27 pid records anz=gcommand[2]; while( (z<anz) && (z<ANZSAT) ) { ACKCommand(tty, gcommand, s); gcommand=GetCommand(tty, &s); singlesat=getAlmanacD501(gcommand, s); satinfo[z].wn=singlesat.wn; satinfo[z].toa=singlesat.toa; satinfo[z].af0=singlesat.af0; satinfo[z].af1=singlesat.af1; satinfo[z].e=singlesat.e; satinfo[z].sqrta=singlesat.sqrta; satinfo[z].m0=singlesat.m0; satinfo[z].w=singlesat.w; satinfo[z].omg0=singlesat.omg0; satinfo[z].odot=singlesat.odot; satinfo[z].wn=singlesat.wn; satinfo[z].i=singlesat.i; satinfo[z].hlth=singlesat.hlth;/*#ifdef DEBUG fprintf(stderr, "%d %f %f %f %f %f %f %f %f %f %f %d", singlesat.wn, singlesat.toa, singlesat.af0, singlesat.af1, singlesat.e=0, singlesat.sqrta, singlesat.m0, singlesat.w, singlesat.omg0, singlesat.odot, singlesat.i, singlesat.hlth);#endif*/ z++; } ACKCommand(tty, gcommand, s); gcommand=GetCommand(tty, &s); //12 xfer cmpl }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -