⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trans_process.lst

📁 通过车载终端采集GPS数据
💻 LST
📖 第 1 页 / 共 4 页
字号:
C51 COMPILER V7.09   TRANS_PROCESS                                                         09/16/2008 09:24:30 PAGE 1   


C51 COMPILER V7.09, COMPILATION OF MODULE TRANS_PROCESS
OBJECT MODULE PLACED IN .\output\Trans_process.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE gprs\Trans_process.c LARGE BROWSE INCDIR(audio\;eeprom\;extendUART\;flash\;
                    -gps\;inter\;key\;mcu\;menu\;usb\;gprs\;main\;1wire\) DEBUG OBJECTEXTEND PRINT(.\output\Trans_process.lst) OBJECT(.\outpu
                    -t\Trans_process.obj)

line level    source

   1          
   2          #include "typedef.h"
   3          #include "struct_def.h"
   4          #include "common_function.h"
   5          #include "gps.h"
   6          #include "Trans_process.h"
   7          #include "Rcv_process.h"
   8          #include "gprs.h"
   9          #include "string.h"
  10          #include "stdio.h"
  11          #include "global.h"
  12          #include "position.h"
  13          #include "24c512.h"
  14          #include "nvram.h"
  15          #include "updateprogram.h"
  16          #include "centerinterface.h"
  17          #include "commoninterface.h"
  18          #include "nf_file.h"
  19          #include "16c554.h"
  20          #include "photo.h"
  21          
  22          extern void get_gps_data(GPS_DATA **ptr);
  23          extern IP_INFO_STRUCT ipInfo;
  24          extern GPRS_INFO_STRUCT gprsInfo;
  25          Int32 mess_num_runmode = 0;   /*行驶状态消息序号*/
  26          Int16 gps_num = 0;            /*gps定位包计数器*/
  27          Uchar trans_num = 0;          /*重发计次器*/
  28          Int16 retry_num;              /*重发计数器*/
  29          Int16 heart_num = 0;          /*心跳包计数*/
  30          DWord serial_number = 0;      /*消息序号*/
  31          extern DWord gphoto_msgnumber;
  32          PROTOCOL_SEND_BUFFER sbuf;    /*消息缓存*/
  33          PROTOCOL_PHOTO_BUFFER sbufPhoto;/*传送照片缓存*/
  34          
  35          /*心跳包组包*/
  36          void make_heartbeat_message(void)
  37          {
  38   1          BUS_HEARTBEAT *gprs_info;
  39   1          serial_number++;
  40   1          gprs_info=(BUS_HEARTBEAT *) sbuf.buf[5];
  41   1          memcpy(gprs_info->mess_head.mess_sync,"NJPT",4);
  42   1          gprs_info->mess_head.mess_version = 2;
  43   1          gprs_info->mess_head.mess_reserve = 0;
  44   1          gprs_info->mess_head.mess_type = (Word)(HEART_BEAT);
  45   1          gprs_info->messageid = serial_number;
  46   1          get_device_id(gprs_info->terminal_id);
  47   1          get_bus_id(gprs_info->bus_id);
  48   1          gprs_info->mess_head.mess_length=14;                
  49   1          swap_uint((Uchar *)(&gprs_info->mess_head.mess_type));
  50   1          swap_uint((Uchar *)(&gprs_info->mess_head.mess_length));
  51   1      }
  52          
  53          /*定位信息组包*/
C51 COMPILER V7.09   TRANS_PROCESS                                                         09/16/2008 09:24:30 PAGE 2   

  54          void make_gps_message(void)
  55          {
  56   1          GPS_DATA gpsinfo;
  57   1          GPS_DATA *pgps;
  58   1          Uchar  cur_station;
  59   1          Uchar  station_unm;
  60   1          BUS_POSITION *gprs_info;
  61   1          pgps = &gpsinfo;
  62   1          gprs_info = (BUS_POSITION *) sbuf.buf[4];  
  63   1          memcpy(gprs_info->mess_head.mess_sync,"NJPT",4);
  64   1          gprs_info->mess_head.mess_version = 2;
  65   1          gprs_info->mess_head.mess_reserve = 0;
  66   1          gprs_info->mess_head.mess_type = (Word)(GPSINFO);
  67   1          get_line_id(gprs_info->line_id);
  68   1          get_bus_id(gprs_info->bus_id);
  69   1          get_cur_tranStation(&cur_station);
  70   1          station_unm = cur_station;
  71   1          get_station_id(station_unm,gprs_info->station_id);
  72   1          gprs_info->tag = 0x10;
  73   1          get_device_id(gprs_info->terminalid);
  74   1          
  75   1          gprs_info->renew = 0xff; 
  76   1          get_gps_data(&pgps);
  77   1       //   siob_send(gprs_info->terminalid, 10);//for debug
  78   1          if (pgps->valid == 0)
  79   1          {
  80   2              pgps->valid = 'V';
  81   2          }
  82   1          else
  83   1          {
  84   2              pgps->valid = 'A';
  85   2          }
  86   1          gprs_info->gps_flag = pgps->valid;
  87   1          memcpy(&(gprs_info->longitude), &(pgps->longitude),4);
  88   1          memcpy(&(gprs_info->latitude), &(pgps->latitude),4);
  89   1          get_term_data(gprs_info->date);
  90   1          get_term_time(gprs_info->time);
  91   1          gprs_info->speed = pgps->speed;
  92   1          gprs_info->direction = (Int32)((pgps->direction) * 10);
  93   1          gprs_info->mess_head.mess_length = 41;
  94   1          swap_uint((Uchar *)(&gprs_info->mess_head.mess_type));
  95   1          swap_uint((Uchar *)(&gprs_info->mess_head.mess_length));
  96   1          swap_ulong((Uchar *)(&gprs_info->longitude));
  97   1          swap_ulong((Uchar *)(&gprs_info->latitude));
  98   1          swap_uint((Uchar *)(&gprs_info->speed));
  99   1          swap_ulong((Uchar *)(&gprs_info->direction));               
 100   1      }
 101          
 102          /*行驶状态(到/出站)消息组包*/
 103          void make_runmode_message(Uchar action, Uchar p_value)
 104          {
 105   1          Uchar  sta_type;
 106   1          Uchar  station_unm;
 107   1          BUS_RUNMODE *gprs_info;
 108   1          gprs_info = (BUS_RUNMODE *) sbuf.buf[2];
 109   1          serial_number++;
 110   1          memcpy(gprs_info->mess_head.mess_sync, "NJPT", 4);
 111   1          gprs_info->mess_head.mess_version = 2;
 112   1          gprs_info->mess_head.mess_reserve = 0;
 113   1          gprs_info->mess_head.mess_type = (Word)(RUNMODE);
 114   1          gprs_info->messageid = serial_number;
 115   1          get_line_id(gprs_info->line_id);
C51 COMPILER V7.09   TRANS_PROCESS                                                         09/16/2008 09:24:30 PAGE 3   

 116   1          get_bus_id(gprs_info->bus_id);
 117   1          station_unm = p_value & 0x3F;
 118   1          gprs_info->station_num = station_unm;
 119   1          get_station_id(p_value,gprs_info->station_id);
 120   1          get_cur_direction(&(gprs_info->rundir));
 121   1          if(gprs_info->rundir == 0)
 122   1          {
 123   2              gprs_info->rundir = 0x01;
 124   2          }
 125   1          else
 126   1          {
 127   2              gprs_info->rundir = 0x02;
 128   2          }
 129   1          sta_type = first_last_station(station_unm);
 130   1          if(sta_type == 0)
 131   1          {
 132   2              gprs_info->messmode = 201;
 133   2          }
 134   1          else if(sta_type == 1)
 135   1          {
 136   2              gprs_info->messmode = 101;
 137   2          }
 138   1          else if( action == 0 ) /*0:进站,1:出站,3溜站*/
 139   1          {
 140   2              gprs_info->messmode = 102;
 141   2          }
 142   1          else if( action == 1 )
 143   1          {
 144   2              gprs_info->messmode = 202;
 145   2          }
 146   1          else if( action == 3)
 147   1          {
 148   2              gprs_info->messmode = 240;
 149   2          }
 150   1          gprs_info->mess_head.mess_length = 22;
 151   1          swap_uint((Uchar *)(&gprs_info->mess_head.mess_type));
 152   1          swap_uint((Uchar *)(&gprs_info->mess_head.mess_length));
 153   1          sbuf.valid[2]=1;   
 154   1      }
 155          
 156          /*按键消息组包*/
 157          void make_press_message(Uchar press)
 158          {
 159   1          Uchar  station_unm;
 160   1          BUS_RUNMODE *gprs_info;
 161   1          gprs_info = (BUS_RUNMODE *) sbuf.buf[2];
 162   1          serial_number++;
 163   1          memcpy(gprs_info->mess_head.mess_sync, "NJPT", 4);
 164   1          gprs_info->mess_head.mess_version = 2;
 165   1          gprs_info->mess_head.mess_reserve = 0;
 166   1          gprs_info->mess_head.mess_type = (Word)(RUNMODE);
 167   1          gprs_info->messageid = serial_number;
 168   1          get_line_id(&(gprs_info->line_id));
 169   1          get_bus_id(&(gprs_info->bus_id));
 170   1          get_cur_tranStation(&station_unm);
 171   1          gprs_info->station_num = station_unm;
 172   1          get_station_id(station_unm,gprs_info->station_id);
 173   1          get_cur_direction(&(gprs_info->rundir));
 174   1          gprs_info->messmode = press;
 175   1          if(gprs_info->rundir == 0)
 176   1          {
 177   2              gprs_info->rundir = 0x01;
C51 COMPILER V7.09   TRANS_PROCESS                                                         09/16/2008 09:24:30 PAGE 4   

 178   2          }
 179   1          else
 180   1          {
 181   2              gprs_info->rundir = 0x02;
 182   2          }
 183   1          gprs_info->mess_head.mess_length = 22;
 184   1          swap_uint((Uchar *)(&gprs_info->mess_head.mess_type));
 185   1          swap_uint((Uchar *)(&gprs_info->mess_head.mess_length));
 186   1          sbuf.valid[2] = 1;
 187   1      }
 188          
 189          /*确认消息组包*/
 190          void make_ack_message(char idPtr[4])
 191          {
 192   1          ACK_MESSAGE_FRAME *gprs_info;
 193   1          
 194   1          gprs_info = (ACK_MESSAGE_FRAME *) sbuf.buf[2];
 195   1          serial_number++;
 196   1          memcpy(gprs_info->mess_head.mess_sync, "NJPT", 4);
 197   1          gprs_info->mess_head.mess_version = 2;
 198   1          gprs_info->mess_head.mess_reserve = 0;
 199   1          gprs_info->mess_head.mess_type = (Word)(ACK_MESSAGE);
 200   1          
 201   1          gprs_info->messageid = serial_number;
 202   1          get_line_id(&(gprs_info->line_id));
 203   1          get_bus_id(&(gprs_info->bus_id));
 204   1      
 205   1          get_term_data(gprs_info->date);
 206   1          get_term_time(gprs_info->time);
 207   1      
 208   1          memcpy(gprs_info->message_id, idPtr, 4);
 209   1      
 210   1          gprs_info->mess_head.mess_length = 25;
 211   1          swap_uint((Uchar *)(&gprs_info->mess_head.mess_type));
 212   1          swap_uint((Uchar *)(&gprs_info->mess_head.mess_length));
 213   1          sbuf.valid[2] = 1;
 214   1      }
 215          
 216          
 217          /*客流采集消息组包*/
 218          void make_passenger_message(Uchar up_num, Uchar down_num, Int16 on_num)
 219          {
 220   1          Uchar  station_unm;
 221   1          BUS_PASSENGER *gprs_info;
 222   1          gprs_info = (BUS_PASSENGER *) sbuf.buf[2];
 223   1          serial_number++;
 224   1          memcpy(gprs_info->mess_head.mess_sync, "NJPT", 4);
 225   1          gprs_info->mess_head.mess_version = 4;
 226   1          gprs_info->mess_head.mess_reserve = 0;
 227   1          gprs_info->mess_head.mess_type = (Word)(PASSENGER);
 228   1          gprs_info->messageid=serial_number;
 229   1          get_line_id(gprs_info->line_id);
 230   1          get_bus_id(gprs_info->bus_id);
 231   1          get_cur_tranStation(&station_unm);
 232   1          gprs_info->station_num = station_unm;
 233   1          get_station_id(gprs_info->station_num,gprs_info->station_id);  
 234   1          get_cur_direction(&(gprs_info->rundir));
 235   1          if(gprs_info->rundir == 0)
 236   1          {
 237   2              gprs_info->rundir = 0x01;
 238   2          }
 239   1          else
C51 COMPILER V7.09   TRANS_PROCESS                                                         09/16/2008 09:24:30 PAGE 5   

 240   1          {
 241   2              gprs_info->rundir = 0x02;
 242   2          }
 243   1          gprs_info->messmode = 0x77;
 244   1          
 245   1          gprs_info->upnumber = up_num;
 246   1          gprs_info->downnumber = down_num;
 247   1          gprs_info->number = on_num;
 248   1          get_term_data(gprs_info->gpsTime);
 249   1          get_term_time(gprs_info->gpsTime+3);
 250   1          gprs_info->mess_head.mess_length = 35;
 251   1          swap_uint((Uchar *)(&gprs_info->mess_head.mess_type));
 252   1          swap_uint((Uchar *)(&gprs_info->mess_head.mess_length));
 253   1          swap_uint((Uchar *)(&gprs_info->number));   
 254   1          sbuf.valid[2] = 1;     
 255   1      }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -