CHDK_DE Vorschauversion  Trunk Rev. 5218
 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 1428 der Datei gps.c.

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

Definiert in Zeile 1595 der Datei gps.c.

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

Definiert in Zeile 1562 der Datei gps.c.

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

Definiert in Zeile 1674 der Datei gps.c.

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

Definiert in Zeile 1654 der Datei gps.c.

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

Definiert in Zeile 1684 der Datei gps.c.

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

Definiert in Zeile 1720 der Datei gps.c.

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

Definiert in Zeile 1629 der Datei gps.c.

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

Definiert in Zeile 301 der Datei kbd_common.c.

302 {
303  int i;
304  for (i=0;keymap[i].hackkey;i++){
305  if ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0){
306  return keymap[i].hackkey;
307  }
308  }
309  return 0;
310 }
long mkdir_if_not_exist ( )

Variablen-Dokumentation

int gps_key_trap

Definiert in Zeile 13 der Datei gps_simulate.c.