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

📄 upubfun.pas

📁 a voice guide client ,it is the second part of voice guide center
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    gShowDacoityLog := iniFile.ReadBool('GpsView','ShowDacoityLog',False);
    gSixHoursLimit := iniFile.ReadBool('GpsView','SixHoursLimit',True);

    // gReplaceLeftLight := iniFile.ReadBool('GpsView','ReplaceLeftLight',False);
    TGPSClientProcessTrack.ConverterConfigRead(IniFile, 'GpsView');

    gShowCmdSend := iniFile.ReadBool('GpsView','ShowCmdSend',True);

    gTrackGenOper := iniFile.ReadBool('GpsView','TrackGenOper', True);

    gOverSpeedMax   := IniFile.ReadInteger('OverSpeed', 'Value', 170);

    gShowQryResultVehicleName := IniFile.ReadBool('GpsReply', 'ShowQryResultVehicleName', True);
    gShowQryResultTimeSect := IniFile.ReadBool('GpsReply', 'ShowQryResultTimeSect', True);
    gShowQryResultRecordCount := IniFile.ReadBool('GpsReply', 'ShowQryResultRecordCount', True);
    gShowQryResultMileage := IniFile.ReadBool('GpsReply', 'ShowQryResultMileage', True);
    gShowQryResultAverageSpeed := IniFile.ReadBool('GpsReply', 'ShowQryResultAverageSpeed', True);
    gShowQryResultOilCost := IniFile.ReadBool('GpsReply', 'ShowQryResultOilCost', True);
    gShowQryResultOilFee := IniFile.ReadBool('GpsReply', 'ShowQryResultVehicleName', True);
    gShowQryResultInvalidRate := IniFile.ReadBool('GpsReply', 'ShowQryResultOilFee', True);
    gShowQryResultValidRate := IniFile.ReadBool('GpsReply', 'ShowQryResultInvalidRate', True);
    gShowQryResultStirCan := IniFile.ReadBool('GpsReply', 'ShowQryResultStirCan', False);

    //Default Call Param
    gDefCallInterval:= IniFile.ReadInteger('System', 'DefCallInterval', 30);
    gDefCallTimes   := IniFile.ReadInteger('System', 'DefCallTimes', 10);
    gDefReplayInterval:= IniFile.ReadInteger('System', 'DefReplayInterval', 100);
    gPopOnEm:= IniFile.ReadBool('System', 'PopOnEm', True);
    gPopOnMsg:= IniFile.ReadBool('System', 'PopOnMsg', True);
    gSysAutoCall:= IniFile.ReadBool('System', 'AutoCall', True);
    gSysShieldNumber:= IniFile.ReadBool('System', 'ShieldNumber', True);
    gSysAutoCancelAlert := IniFile.ReadBool('System', 'AutoCancelAlert', True);
    gDeltaDistanceRatio := IniFile.ReadFloat('System','DeltaDistanceRatio', 1);
    gDeltaDistanceNOs   := IniFile.ReadString('System','DeltaDistanceNOs', '');

    //View
    frmMain.ReadInterfaceIni(IniFile);

    //超速报警、
    gEmSpeedOverEnable:= IniFile.ReadBool('EmSpeedOver', 'Enable', True);
    //低速报警、
    gEmSpeedSlowEnable:= IniFile.ReadBool('EmSpeedSlow', 'Enable', False);
    gEmSpeedSlow:= IniFile.ReadInteger('EmSpeedSlow', 'SpeedSlow', 20);
    //区域、迟到报警
    gEmAreaEnable:= IniFile.ReadBool('EmArea', 'Enable', False);
    gEmLaterEnable:= IniFile.ReadBool('EmLater', 'Enable', False);
    //中山伟明速度状态
    gZsSpeedState:= IniFile.ReadBool('System', 'ZsSpeedState', False);


    gMapCusLayerName := IniFile.ReadString('CustomLayer', 'Name','');

    gAntiZero := iniFile.ReadBool('AntiZero','Value',False);
    //是否显示亿程所要求的那六个字段信息.
    gShow6FieldInfo := iniFile.ReadBool('Show6FieldInfo','Value',False);
    gShow6FieldInfo := True;

    //车牌信息转发
    gTransCarCodeUDPIP    := iniFile.ReadString('TransCarCode','UDPIP','127.0.0.1');
    gTransCarCodeUDPPort  := iniFile.ReadInteger('TransCarCode','UDPPort',8000);
    gTransCarCodeEnable   := IniFile.ReadBool('TransCarCode','Enabled',False);
    //////////////////////////////////////////////////////////////
  finally
    IniFile.Free;
  end;
  gPlayAlarmSound := true;
end;


procedure WriteIni;
var
  IniFile       : TIniFile;
  sIniFileName  : string;
begin
  if gMtscHost='' then Exit;
  sIniFileName:= ChangeFileExt(Application.ExeName, '.ini');
  IniFile:= TIniFile.Create(sIniFileName);
  try
    IniFile.WriteString('Network', 'MtscHost', gMtscHost);
    IniFile.WriteString('Network', 'DataHost', gDataHost);
    IniFile.WriteString('Network', 'DataHostList', gDataHostList);
    IniFile.WriteBool('Network', 'IsUseDataHostList', gIsUseDataHostList);
    IniFile.WriteBool('Network', 'IsCacheLogon', gIsCacheLogon);
    IniFile.WriteInteger('Network', 'MtscPort', gMtscPort);
    IniFile.WriteInteger('Network', 'DataPort', gDataPort);
    IniFile.WriteInteger('Network', 'ReplayPort', gReplayPort);
    IniFile.WriteString('Network', 'ReplayDB', gReplayDB);
    IniFile.WriteString('Network', 'ZPDataHost', gZPDataHost);
    IniFile.WriteInteger('Network', 'ZPDataPort', gZPDataPort);
    IniFile.WriteString('Network', 'ETAGDispatchHost', gETAGDispatchHost);
    IniFile.WriteString('Network', 'ANADataHost', gANADataHost);
    IniFile.WriteString('Network', 'DistanceCalc', gDistanceCalcHost);
    IniFile.WriteInteger('Network', 'ANADataPort', gANADataPort);
    IniFile.WriteBool('Network', 'GpsOnLine', gGpsOnLine);
    IniFile.WriteBool('Network', 'LogonNOOP', gLogonNOOP);
    IniFile.WriteInteger('Network', 'NOOPInterval', gNOOPInterval);
    IniFile.WriteBool('Network', 'UseAuthServer', gUseAuthServer);
    IniFile.WriteBool('Network', 'UseNewDBServer', gUseNewDBServer);
    IniFile.WriteBool('Network', 'IsBaseDBAuth', GIsBaseDBAuth);
    IniFile.WriteBool('Network', 'IsLookOil', gLookOil);

    IniFile.WriteString('Network', 'AuthServerHost', gAuthServerHost);
    IniFile.WriteInteger('Network', 'AuthServerPort', gAuthServerPort);
    IniFile.WriteString('Network', 'UpgradeURL', gUpgradeURL);
    IniFile.WriteString('System', 'LogName', gLogName);
    IniFile.WriteString('System', 'LogName', gHistoryLogNames);

    //IniFile.WriteString('System', 'Password', gPassWd);
    IniFile.WriteInteger('System', 'LookAndFeel', Ord(gLookFeel));
    IniFile.WriteInteger('System', 'TargetHintShow', Integer(gTargetHintShow));
    IniFile.WriteInteger('System', 'NewWinDockType', gNewWinDockType);
    IniFile.WriteBool('System', 'TAXI', gTaxiOpened);
    //GpsView
    IniFile.WriteBool('GpsView', 'ShowGISClient', gShowGISClient);
    IniFile.WriteString('GpsView', 'ShowCarInfoType', gShowCarInfo);
    IniFile.WriteString('GpsView', 'ShowCarInfoTypeActive', gShowCarInfoActive);
    IniFile.WriteBool('GpsView','IsShowRoadName', gIsShowRoadName);
    IniFile.WriteString('GpsView', 'VersionName', gAppVersionName);

    IniFile.WriteInteger('GpsView', 'ShowTrackType', Ord(gShowTrackType));
    IniFile.WriteInteger('GpsView', 'TargetLabel', Ord(gShowTargetLabel));
    IniFile.WriteBool('GpsView', 'ShowCommPropertyEnable', gShowCommPropertyEnable);
    IniFile.WriteString('GpsView', 'ShowCommProperty', gShowCommProperty);
    IniFile.WriteBool('GpsView', 'ShowOilDebug', gShowOilDebug);
    IniFile.WriteBool('GpsView', 'ShowQryGetRoadName', gShowQryGetRoadName);
    IniFile.WriteBool('GpsView', 'IsShowStopSect', gIsShowStopSect);
    IniFile.WriteInteger('GpsView', 'MinStopMinute', gMinStopMinute);

    IniFile.WriteInteger('GpsView', 'ShowTrackPtCount', gTrackPtCount);
    IniFile.WriteBool('GpsView', 'AutoTrackNewData',gTrackNewData);
    IniFile.WriteBool('GpsView', 'AllGPSValid',gAllGpsValid);
    IniFile.WriteInteger('GpsView', 'VersionFlag', gVersionFlag);
    //IniFile.WriteBool('GpsView', 'PetroCarInfo', gPetroCarInfo);
    IniFile.WriteInteger('GpsView', 'TPFix', gTemperatureFix);
    IniFile.WriteInteger('GpsView', 'ZPStyle', gZPXPStyle);
//    IniFile.WriteBool('GpsView', 'ReplayDistanceCalc', gReplayDistanceCalc);
    IniFile.WriteBool('GpsView', 'ShowDacoityLog', gShowDacoityLog);
    IniFile.WriteBool('GpsView', 'FullExtentViewAll', gFullExtentViewAll);
    IniFile.WriteBool('GpsView', 'FullExtentSearch', gFullExtentSearch);
    IniFile.WriteBool('GpsView', 'IgnorCompensate', gIgnorCompensate);

    IniFile.WriteBool('GpsView','LowSpeedAlert', gLowSpeedAlert);

//    IniFile.WriteBool('GpsView','OverSpeedAlert',gOverSpeedAlert);
//    iniFile.WriteBool('GpsView','ShowMileageMessage', gShowMileageMessage);
    TGPSClientProcessOperation.OperationFilterConfigWrite(IniFile, 'GpsView');

    IniFile.WriteBool('GpsView','OverSpeedNormal',gOverSpeedNormal);

    IniFile.WriteBool('GpsView', 'DoorAlert', gDoorAlert);

    // IniFile.WriteBool('GpsView', 'BatteryAlert', gBatteryAlert);
    // iniFile.WriteBool('GpsView','ShowLeftLight',gShowLeftLight);
    // iniFile.WriteBool('GpsView','ShowRightLight',gShowRightLight);
    // iniFile.WriteBool('GpsView','ShowBrake',gShowBrake);
    // iniFile.WriteBool('GpsView','ShowAC',gShowAC);
    // iniFile.WriteBool('GpsView','ShowDoor',gShowDoor);
    // IniFile.WriteBool('GpsView','VehicleSpeedState',gVehicleSpeedState);
    // iniFile.WriteBool('GpsView','ShowACC',gShowACC);
    // iniFile.WriteBool('GpsView','ShowAlarm',gShowAlarm);
    // iniFile.WriteBool('GpsView','ShowOutAlarm',gShowOutAlarm);

    TGPSClientProcessUtils.GPSDescFilterConfigWrite(IniFile, 'GpsView');

    IniFile.WriteBool('GpsView', 'ShowDebugInfo', gShowDebugInfo);
    IniFile.WriteBool('GpsView', 'ShowDebugDB', gShowDebugDB);
    iniFile.WriteBool('GpsView','ShowDistanceCalc', gShowDistanceCalc);
    iniFile.WriteBool('GpsView','ShowMSCManage', gShowMSCManage);
    iniFile.WriteBool('GpsView','ShowOilLevel', gShowOilLevel);
    iniFile.WriteBool('GpsView','ShowGPSANA', gShowGPSANA);
    iniFile.WriteBool('GpsView','ShowCmdSend',gShowCmdSend);

    iniFile.WriteBool('GpsView','TrackGenOper', gTrackGenOper);

    TGPSClientProcessTrack.ConverterConfigWrite(IniFile, 'GpsView');

    IniFile.WriteBool('GpsReply', 'ShowQryResultVehicleName', gShowQryResultVehicleName);
    IniFile.WriteBool('GpsReply', 'ShowQryResultTimeSect', gShowQryResultTimeSect);
    IniFile.WriteBool('GpsReply', 'ShowQryResultRecordCount', gShowQryResultRecordCount);
    IniFile.WriteBool('GpsReply', 'ShowQryResultMileage', gShowQryResultMileage);
    IniFile.WriteBool('GpsReply', 'ShowQryResultAverageSpeed', gShowQryResultAverageSpeed);
    IniFile.WriteBool('GpsReply', 'ShowQryResultOilCost', gShowQryResultOilCost);
    IniFile.WriteBool('GpsReply', 'ShowQryResultOilFee', gShowQryResultOilFee);
    IniFile.WriteBool('GpsReply', 'ShowQryResultInvalidRate', gShowQryResultInvalidRate);
    IniFile.WriteBool('GpsReply', 'ShowQryResultValidRate', gShowQryResultValidRate);
    IniFile.WriteBool('GpsReply', 'ShowQryResultStirCan', gShowQryResultStirCan);

    IniFile.WriteInteger('OverSpeed', 'Value', gOverSpeedMax);

    //Default Call Param
    IniFile.WriteInteger('System', 'DefCallInterval', gDefCallInterval);
    IniFile.WriteInteger('System', 'DefCallTimes', gDefCallTimes);
    IniFile.WriteInteger('System', 'DefReplayInterval', gDefReplayInterval);
    IniFile.WriteBool('System', 'PopOnEm', gPopOnEm);
    IniFile.WriteBool('System', 'PopOnMsg', gPopOnMsg);
    IniFile.WriteBool('System', 'AutoCall', gSysAutoCall);
    IniFile.WriteBool('System', 'AutoCancelAlert', gSysAutoCancelAlert);
    IniFile.WriteInteger('System', 'TongDaClient', gTongDaClient);

    IniFile.WriteBool('System','CanEdit', gCanEditCarInfo);
    IniFile.WriteBool('System','CanEditADV', gCanEditAdvance);

    IniFile.WriteFloat('System', 'DeltaDistanceRatio', gDeltaDistanceRatio);
    IniFile.WriteString('System', 'DeltaDistanceNOs', gDeltaDistanceNOs);

    //View
    frmMain.SaveInterfaceIni(IniFile);

    //超速报警
    IniFile.WriteBool('EmSpeedOver', 'Enable', gEmSpeedOverEnable);
    //低速报警
    IniFile.WriteBool('EmSpeedSlow', 'Enable', gEmSpeedSlowEnable);
    IniFile.WriteInteger('EmSpeedSlow', 'SpeedSlow', gEmSpeedSlow);
    //区域、迟到报警
    IniFile.WriteBool('EmArea', 'Enable', gEmAreaEnable);
    IniFile.WriteBool('EmLater', 'Enable', gEmLaterEnable);
    //中山伟明速度状态
    IniFile.WriteBool('System', 'ZsSpeedState', gZsSpeedState);

    IniFile.WriteString('CustomLayer','Name', gMapCusLayerName );

    iniFile.WriteString('TransCarCode','UDPIP',gTransCarCodeUDPIP);
    iniFile.WriteInteger('TransCarCode','UDPPort',gTransCarCodeUDPPort);
    iniFile.WriteBool('TransCarCode','Enabled',gTransCarCodeEnable);

    IniFile.UpdateFile;
  finally
    IniFile.Free;
  end;
end;

function GetVersionFromFile( aFileName : string ): string;
type
  PVS_FIXEDFILEINFO = ^VS_FIXEDFILEINFO;
var
  h : Cardinal;
  nSize : Cardinal;
  pData : Pointer;
  pffiData : PVS_FIXEDFILEINFO;
  nffiSize : Cardinal;
  FMajor   : Integer;
  FMinor   : Integer;
//  FRelease : Integer;
  FBuild   : Integer;
begin
  FMajor   := 0;
  FMinor   := 0;
//  FRelease := 0;
  FBuild   := 0;
  if ( FileExists( aFileName ) ) then
    FBuild := 1;
  nSize := GetFileVersionInfoSize( PChar( aFileName ), h );
  if ( nSize = 0 ) then
    Exit;

  GetMem( pData, nSize );
  try
    GetFileVersionInfo( PChar( aFileName ), h, nSize, pData );
    if ( VerQueryValue( pData, '\', Pointer( pffiData ), nffiSize ) ) Then
    begin
      FMajor   := ( pffiData^.dwFileVersionMS ) shr 16;
      FMinor   := ( pffiData^.dwFileVersionMS ) and $FFFF;
//      FRelease := ( pffiData^.dwFileVersionLS ) shr 16;
      FBuild   := ( pffiData^.dwFileVersionLS ) and $FFFF;
    end;
  finally
    FreeMem( pData );
  end;

  Result := Format('Ver %d.%d  Build %d', [FMajor, FMinor, FBuild])
end;

{ TCarInfo }

procedure TCarInfo.AddEFense(EFense: TEfenceItem);
var
  pEFense: ^TEfenceItem;
begin
  New(pEFense);
  pEFense.id    := EFense.id;
  pEFense.CarId := EFense.CarId;
  pEFense.No    := EFense.No;
  pEFense.IsEFence:= EFense.IsEFence;
  pEFense.GpsRect:= EFense.GpsRect;
  pEFense.EnterTime:= EFense.EnterTime;
  pEFense.ExitTime:= EFense.ExitTime;
  EFenseList.Add(pEFense);
end;

procedure TCarInfo.Assign(ASource: TCarInfo);
var
  i       : Integer;
  p_field : PBaseDBFieldValue;
begin
  for i := 0 to ASource.CarinfoValueList.Count - 1 do
  begin
    p_field := PBaseDBFieldValue(ASource.CarinfoValueList.Items[i]);

    if Assigned(p_field) then
      TCarInfo.SetVarToFieldValue(Self, p_field^.FieldInfo^.FieldName,
        p_field^.Value);
  end;
//  TerminalType:= ASource.TerminalType;  //终端类型

  MileagePluseCount := ASource.MileagePluseCount;
//  GpsInfo           := ASource.GpsInfo;
//  TaskInfo          := ASource.TaskInfo;
  bz                := ASource.bz;
  IsOldDB           := ASource.IsOldDB;
  FieldList.Assign(ASource.FieldList);

  TeamId      := ASource.TeamId;        //(航线)任务状态ID
  TaskState   := ASource.TaskState;        //(航线)任务状态ID
  Ctrled      := ASource.Ctrled;              //现在是否监控?0:未知;1:监控;2:不监控
end;

constructor TCarInfo.Create;
begin
  inherited;

  // 是否使用旧的数据库定义
  IsOldDB           := not gUseNewDBServer;

  TaskState         := -1;
  GpsInfo           := TGpsInfo.Create;
  GpsInfoGenOper    := TGpsInfo.Create;

  InitEFenseList;
  MileagePluseCount := 0;
  CarinfoValueList  := nil;

  FieldList := THashedStringList.Create;

  // 初始化 车辆信息对象 的 信息字段列表
  InitialCarInfoFieldValueList(Self);
end;

class function TCarInfo.GetFieldValueStrByName(_car_info: TCarInfo; _field_name: string): string;
var
  i: Integer;
  p_field_value   : PBaseDBFieldValue;
begin
  Result := '';

  for i := 0 to _car_info.CarinfoValueList.Count - 1 do
  begin
    p_field_value := PBaseDBFieldValue(_car_info.CarinfoValueList.Items[i]);

    if p_field_value^.FieldInfo.FieldName = _field_name then
    begin
      if p_field_value^.Value <> Null then
        Result := Trim(p_field_value^.Value);

      if p_field_value^.FieldInfo^.FieldType = ftBoolean then
      begin
        if UpperCase(Result) = 'TRUE' then
          Result := '是'
        else if UpperCase(Result) = 'FALSE' then
          Result := '否';
      end;
      Break;
    end;
  end;
end;

class function TCarInfo.GetFieldValueIntByName(_car_info: TCarInfo; _field_name: string): Integer;
var
  i: Integer;
  p_field_value   : PBaseDBFieldValue;
begin
  Result := -1;

  for i := 0 to _car_info.CarinfoValueList.Count - 1 do
  begin
    p_field_value := PBaseDBFieldValue(_car_info.CarinfoValueList.Items[i]);

    if p_field_value^.FieldInfo.FieldName = _field_name then
    begin
      if p_field_value^.Value <> Null then
        Result := p_field_value^.Value;
      Break;
    end;
  end;
end;

class function TCarInfo.GetFieldValueBoolByName(_car_info: TCarInfo; _field_name: string): Boolean;
var
  i: Integer;
  p_field_value   : PBaseDBFieldValue;
begin
  result := False;

  for i := 0 to _car_info.CarinfoValueList.Count - 1 do

⌨️ 快捷键说明

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