CHDK_DE Vorschauversion  Trunk Rev. 5836
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
gps.h-Dateireferenz
+ Dieser Graph zeigt, welche Datei direkt oder indirekt diese Datei enthält:

gehe zum Quellcode dieser Datei

Datenstrukturen

struct  tGPS
 
struct  gps_img_data
 

Funktionen

char * camera_jpeg_current_filename ()
 
char * camera_jpeg_current_gps ()
 
long get_target_file_num ()
 
long mkdir_if_not_exist ()
 
long kbd_get_pressed_key ()
 
void GPS_UpdateData ()
 
int init_gps_navigate_to_photo (int)
 
int init_gps_navigate_to_home (int)
 
void init_gps_compass_task (int)
 
void init_gps_logging_task (int)
 
void init_gps_startup (int)
 
void gps_write_home ()
 
void gps_write_timezone ()
 
void gps_waypoint ()
 

Variablen

int gps_key_trap
 

Dokumentation der Funktionen

char* camera_jpeg_current_filename ( )

Definiert in Zeile 14 der Datei gps_simulate.c.

14 { return (void*)gps_fakename; }
char* camera_jpeg_current_gps ( )

Definiert in Zeile 15 der Datei gps_simulate.c.

15 { return (void*)&gps_dummy_data; }
long get_target_file_num ( )

Definiert in Zeile 119 der Datei shooting.c.

119  {
120  long n;
121 
122  n = get_file_next_counter();
123  n = (n>>4)&0x3FFF;
124  return n;
125 }
void GPS_UpdateData ( )
void gps_waypoint ( )

Definiert in Zeile 1425 der Datei gps.c.

1425  {
1426 
1427  char lat[40];
1428  char lon[40];
1429  char hei[40];
1430 
1431  char vBuf[512];
1432  char image_name[20];
1433  char wp_name[30];
1434  char gpx_name[30];
1435  char gpx_image_name[20];
1436 
1437  unsigned long t;
1438  static struct tm *ttm;
1439  t=time(NULL);
1440  ttm = localtime(&t);
1441 
1442  mkdir_if_not_exist("A/GPS");
1443  mkdir_if_not_exist("A/GPS/Tagging");
1444  sprintf(wp_name, "A/GPS/Tagging/%04d_%02d_%02d.wp", ttm->tm_year+1900, ttm->tm_mon+1, ttm->tm_mday);
1445  sprintf(gpx_name, "A/GPS/Tagging/%04d_%02d_%02d.gpx", ttm->tm_year+1900, ttm->tm_mon+1, ttm->tm_mday);
1446  sprintf(image_name, "IMG_%04d.JPG", get_target_file_num());
1447 
1448  lock(4);
1449  int l_stat = g_d_stat ;
1450  double l_lat = g_d_lat ;
1451  double l_lon = g_d_lon ;
1452  double l_hei = g_d_hei ;
1453  char l_tim[10];
1454  char l_dat[12];
1455  char l_tim_gps[10];
1456  char l_dat_gps[12];
1457  strncpy( l_tim , g_d_tim, 10 );
1458  strncpy( l_dat , g_d_dat, 12 );
1459  strncpy( l_tim_gps , g_d_tim_gps, 10 );
1460  strncpy( l_dat_gps , g_d_dat_gps, 12 );
1461  unlock(4);
1462 
1463  if ((l_stat >= ((int)conf.gps_2D_3D_fix)) || ((((int)conf.gps_2D_3D_fix) == 3) && (l_stat == 2)))
1464  {
1465  sprintf(vBuf, "%s;%s;%s;%s;%sT%sZ;%i\n",
1466  image_name,
1467  formatDouble (lat, l_lat, 0, 7),
1468  formatDouble (lon, l_lon, 0, 7),
1469  formatDouble (hei, l_hei, 0, 2),
1470  l_dat, l_tim,
1471  get_optical_temp());
1472 
1473  FILE* fp = fopen(wp_name, "a");
1474 
1475  if( fp )
1476  {
1477  fwrite(vBuf, strlen(vBuf), 1, fp);
1478  }
1479  fclose(fp);
1480 
1481  fp = fopen(gpx_name, "r");
1482  if( fp == NULL)
1483  {
1484  fp = fopen(gpx_name, "a");
1485  if( fp )
1486  {
1487  sprintf(vBuf, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
1488  fwrite(vBuf, strlen(vBuf), 1, fp);
1489  sprintf(vBuf, "<gpx xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" version=\"1.1\" creator=\"CHDK\" xmlns=\"http://www.topografix.com/GPX/1/1\">\n");
1490  fwrite(vBuf, strlen(vBuf), 1, fp);
1491  sprintf(vBuf, "</gpx>");
1492  fwrite(vBuf, strlen(vBuf), 1, fp);
1493  fclose(fp);
1494  }
1495  }
1496 
1497 
1498  sprintf(gpx_image_name, "IMG_%04d.JPG", get_target_file_num());
1499 
1500  fp = fopen(gpx_name, "a");
1501  if( fp )
1502  {
1503  fseek (fp, -6, SEEK_END);
1504 
1505  sprintf(vBuf, " <wpt lat=\"%s\" lon=\"%s\">\n",formatDouble (lat, l_lat, 0, 7), formatDouble (lon, l_lon, 0, 7));
1506  fwrite(vBuf, strlen(vBuf), 1, fp);
1507  sprintf(vBuf, " <ele>%s</ele>\n",formatDouble (hei, l_hei, 0, 2));
1508  fwrite(vBuf, strlen(vBuf), 1, fp);
1509  sprintf(vBuf, " <time>%sT%sZ</time>\n", l_dat, l_tim);
1510  fwrite(vBuf, strlen(vBuf), 1, fp);
1511  sprintf(vBuf, " <gpst>%sT%sZ</gpst>\n", l_dat_gps, l_tim_gps);
1512  fwrite(vBuf, strlen(vBuf), 1, fp);
1513  sprintf(vBuf, " <temp>%i</temp>\n", (int)get_optical_temp());
1514  fwrite(vBuf, strlen(vBuf), 1, fp);
1515  sprintf(vBuf, " <name>%s</name>\n", gpx_image_name);
1516  fwrite(vBuf, strlen(vBuf), 1, fp);
1517  sprintf(vBuf, " </wpt>\n");
1518  fwrite(vBuf, strlen(vBuf), 1, fp);
1519  sprintf(vBuf, "</gpx>");
1520  fwrite(vBuf, strlen(vBuf), 1, fp);
1521  }
1522  fclose(fp);
1523  }
1524  else
1525  {
1526  FILE* fp ;
1527 
1528  sprintf(vBuf, "%s %sT%sZ %i\n",
1529  image_name,
1530  l_dat, l_tim,
1531  get_optical_temp());
1532 
1533  if ( gps_nosignal_lock == 0 )
1534  {
1535  gps_nosignal_lock = 1 ;
1536  CreateTask("GPS_NOSIGNAL", 0x19, 0x1200, no_signal_task);
1537  fp = fopen("A/GPS/Tagging/wp.tmp", "w");
1538  }
1539  else
1540  {
1541  fp = fopen("A/GPS/Tagging/wp.tmp", "a");
1542  }
1543 
1544 
1545 
1546  if( fp )
1547  {
1548  fwrite(vBuf, strlen(vBuf), 1, fp);
1549  fclose(fp);
1550  }
1551 
1553  }
1554 
1555 }
void gps_write_home ( )

Definiert in Zeile 1592 der Datei gps.c.

1592  { // called from gui.c when "Set position as home location" is selected in the UI
1593 
1594  char vBuf[30];
1595  char home_name[30];
1596 
1597  lock(5); // note : kbd task lock = 5
1598  int l_stat = g_d_stat ;
1599  double l_lat = g_d_lat ;
1600  double l_lon = g_d_lon ;
1601  unlock(5);
1602 
1603 
1604  if (l_stat !=0)
1605  {
1606  mkdir_if_not_exist("A/GPS");
1607  mkdir_if_not_exist("A/GPS/Navigation");
1608  sprintf(home_name, "A/GPS/Navigation/Home.txt");
1609 
1610  FILE* fp = fopen(home_name, "w");
1611  if( fp )
1612  {
1613  sprintf(vBuf, "%i\n", (long)(l_lat*10000000));
1614  fwrite(vBuf, strlen(vBuf), 1, fp);
1615  sprintf(vBuf, "%i\n", (long)(l_lon*10000000));
1616  fwrite(vBuf, strlen(vBuf), 1, fp);
1617  }
1618  fclose(fp);
1619  }
1620  else
1621  {
1623  }
1624 }
void gps_write_timezone ( )

Definiert in Zeile 1559 der Datei gps.c.

1559  { // called from gui.c when "Set position as current timezone" is selected in the UI
1560 
1561  char vBuf[30];
1562  char timezone_name[30];
1563 
1564  lock(5); // note : kbd task lock = 5
1565  int l_stat = g_d_stat ;
1566  double l_lat = g_d_lat ;
1567  double l_lon = g_d_lon ;
1568  unlock(5);
1569 
1570  if (l_stat !=0)
1571  {
1572  mkdir_if_not_exist("A/GPS");
1573  mkdir_if_not_exist("A/GPS/Timezone");
1574  sprintf(timezone_name, "A/GPS/Timezone/Timezone.txt");
1575 
1576  FILE* fp = fopen(timezone_name, "w");
1577  if( fp )
1578  {
1579  sprintf(vBuf, "%i\n", (long)(l_lat*10000000));
1580  fwrite(vBuf, strlen(vBuf), 1, fp);
1581  sprintf(vBuf, "%i\n", (long)(l_lon*10000000));
1582  fwrite(vBuf, strlen(vBuf), 1, fp);
1583  }
1584  fclose(fp);
1585  }
1586  else
1587  {
1589  }
1590 }
void init_gps_compass_task ( int  )

Definiert in Zeile 1671 der Datei gps.c.

1671  { // called from gui.c to start the GUI compass display
1672 
1673  exit_compass_task = stop_request ;
1674  if ( stop_request == 0 )
1675  {
1676  run_compass_task(0);
1677  }
1678 }
void init_gps_logging_task ( int  )

Definiert in Zeile 1651 der Datei gps.c.

1651  { // called from gui.c to start the gpx logging
1652  exit_track_task = exit_record_task = stop_request ;
1653 
1654  if ( stop_request == 0 )
1655  {
1656  if (gps_record_lock == 0)
1657  {
1658  gps_record_lock = 1 ;
1659  CreateTask("GPS_RECORD", 0x19, 0x800, gps_logging_task);
1660  }
1661 
1662  if (((int)conf.gps_track_symbol==1) && (gps_track_lock == 0))
1663  {
1664  gps_track_lock = 1 ;
1665  CreateTask("GPS_TRACK", 0x19, 0x800, tracking_icon_task);
1666 
1667  }
1668  } ;
1669 }
int init_gps_navigate_to_home ( int  )

Definiert in Zeile 1681 der Datei gps.c.

1681  { // called from gui.c when navigate home selected from GUI
1682 
1683  exit_compass_task = stop_request ;
1684  if ( stop_request == 0 )
1685  {
1686  char text[2][30];
1687  char home_name[30];
1688  char * endptr;
1689 
1690  sprintf(home_name, "A/GPS/Navigation/Home.txt");
1691 
1692  FILE* fp = fopen(home_name, "r");
1693  if( fp )
1694  {
1695  fgets(text[1], 15, fp);
1696  fgets(text[2], 15, fp);
1697  }
1698  fclose(fp);
1699 
1700  g_d_lat_nav = (strtol (text[1], &endptr, 10 )) / 10000000.0;
1701  g_d_lon_nav = (strtol (text[2], &endptr, 10 )) / 10000000.0;
1702 
1703  if ((int)g_d_lat_nav != 0)
1704  {
1705  run_compass_task(2);
1706  return(1);
1707  }
1708  else
1709  {
1710  gui_mbox_init(LANG_ERROR, LANG_MENU_GPS_t_7, MBOX_BTN_OK|MBOX_TEXT_CENTER, NULL); //Navigation to Home Loc is not possible!
1711  navigation_mode=0;
1712  }
1713  }
1714  return(0);
1715 }
int init_gps_navigate_to_photo ( int  )

Definiert in Zeile 1717 der Datei gps.c.

1717  { // called from gui.c when show navi selected by GUI
1718 
1719  exit_compass_task = stop_request ;
1720 
1721  if (stop_request == 0)
1722  {
1724 
1725  g_d_lat_nav=0.0;
1726  g_d_lon_nav=0.0;
1727 
1728  char image[9];
1730  image[8] = '\0';
1731 
1732  if (igps->latitudeRef[0] && igps->longitudeRef[0])
1733  {
1734  g_d_lat_nav=(double)igps->latitude[0]/(double)igps->latitude[1]*1.0 +
1735  igps->latitude[2]/(igps->latitude[3]*60.0) +
1736  igps->latitude[4]/(igps->latitude[5]*3600.0);
1737  if (igps->latitudeRef[0] == 'S') g_d_lat_nav = -g_d_lat_nav;
1738  g_d_lon_nav=(double)igps->longitude[0]/(double)igps->longitude[1]*1.0 +
1739  igps->longitude[2]/(igps->longitude[3]*60.0) +
1740  igps->longitude[4]/(igps->longitude[5]*3600.0);
1741  if (igps->longitudeRef[0] == 'W') g_d_lon_nav = -g_d_lon_nav;
1742 
1743  run_compass_task(1);
1744  return(1);
1745  }
1746  else
1747  {
1748  char vBuf[256];
1749  sprintf(vBuf, lang_str(LANG_MENU_GPS_t_8), image); //"Cant navigate to photo: %s!"
1750  gui_mbox_init(LANG_ERROR, (int)vBuf, MBOX_BTN_OK|MBOX_TEXT_CENTER, NULL); //Cant navigate to photo: %s!
1751  navigation_mode=0;
1752  }
1753  }
1754  return(0) ;
1755 }
void init_gps_startup ( int  )

Definiert in Zeile 1626 der Datei gps.c.

1627 {
1628  if ( stop_request == 0 )
1629  {
1630  if ( gps_data_lock == 0)
1631  {
1632  exit_data_task = 0;
1633  gps_data_lock = 1 ;
1634  CreateTask("GPS_DATA", 0x19, 0x800, gps_data_task);
1635  }
1636  }
1637  else
1638  {
1639  if ( exit_data_task != 1)
1640  {
1641  exit_data_task =1;
1642  exit_show_task=1;
1643  exit_record_task=1;
1644  exit_track_task=1;
1646  exit_nosignal_task=1;
1647  }
1648  }
1649 }
long kbd_get_pressed_key ( )

Definiert in Zeile 393 der Datei kbd_common.c.

394 {
395  int i;
396  for (i=0;keymap[i].hackkey;i++){
397  if ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0){
398  return keymap[i].hackkey;
399  }
400  }
401  return 0;
402 }
long mkdir_if_not_exist ( )

Variablen-Dokumentation

int gps_key_trap

Definiert in Zeile 13 der Datei gps_simulate.c.