[Pkg-running-devel] [antpm] 02/48: antfs: more work on 405 dialect

Kristof Ralovich ralovich-guest at moszumanska.debian.org
Mon Aug 11 10:10:30 UTC 2014


This is an automated email from the git hooks/post-receive script.

ralovich-guest pushed a commit to branch upstream
in repository antpm.

commit c8b930e39a54fbe9b4a3ad111aaec77d76ae489a
Author: RALOVICH, Kristof <tade60 at freemail.hu>
Date:   Sun Mar 2 20:39:23 2014 +0100

    antfs: more work on 405 dialect
---
 src/AntFr310XT.cpp       | 46 ++++++++++++++++++++++++++++++++++++++++++----
 src/AntFr405.cpp         |  7 ++++---
 src/AntMessenger.cpp     |  4 +++-
 src/AntMessenger.hpp     |  2 +-
 src/antpm-downloader.cpp |  3 +--
 src/common.cpp           | 11 ++++++++++-
 src/common.hpp           |  3 +++
 7 files changed, 64 insertions(+), 12 deletions(-)

diff --git a/src/AntFr310XT.cpp b/src/AntFr310XT.cpp
index 566f224..aa9ef99 100644
--- a/src/AntFr310XT.cpp
+++ b/src/AntFr310XT.cpp
@@ -472,7 +472,7 @@ AntFr310XT::handleEvents()
     // channel status <>
     CHECK_RETURN_FALSE_LOG_OK_DBG2(m_antMessenger->ANT_RequestMessage(chan, MESG_CHANNEL_STATUS_ID));
 
-    if(clientDevName=="Forerunner 405")
+    if(clientDevName=="Forerunner 405" || isAntpm405Override())
       changeStateSafe(ST_ANTFS_GINTF_DL_CAPS);
     else if(mode==MD_DOWNLOAD_ALL || mode==MD_DIRECTORY_LISTING)
       changeStateSafe(ST_ANTFS_DL_DIRECTORY);
@@ -697,12 +697,50 @@ AntFr310XT::handleEvents()
     //R   1.546 MESG_BROADCAST_DATA_ID chan=0x00 ANTFS_BEACON(0x43) Beacon=1Hz, pairing=disabled, upload=disabled, dataAvail=no, State=Transport, Auth=PasskeyAndPairingOnly
     //S   2.477 MESG_BURST_DATA_ID chan=0x00, seq=1, last=yes fe00000000000000 ........
 
-    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(0xfe00000000000000)));
+    CHECK_RETURN_FALSE(createDownloadFolder());
+
+    vector<uint8_t> data;
+    uint64_t code = 0xfe00000000000000;
+    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(code), data));
+    {AntFsFile file0; file0.bytes=data; file0.saveToFile((folder+toString(code, 16, '0')+".bin").c_str());}
 
-    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(0x06000200ff000000)));
+    code = 0x06000200ff000000;
+    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(code), data));
+    {AntFsFile file0; file0.bytes=data; file0.saveToFile((folder+toString(code, 16, '0')+".bin").c_str());}
 
     // 06000200f8000000
-    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(0x06000200f8000000)));
+    code = 0x06000200f8000000;
+    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(code), data));
+    {AntFsFile file0; file0.bytes=data; file0.saveToFile((folder+toString(code, 16, '0')+".bin").c_str());}
+
+    // 0x060002001b000000 pid=0x001b=27 L001_Pid_Records
+    code = 0x060002001b000000;
+    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(code), data));
+    {AntFsFile file0; file0.bytes=data; file0.saveToFile((folder+toString(code, 16, '0')+".bin").c_str());}
+
+    // 0x06000200de030000 pid=0x03de=990 L001_Pid_Run
+    code = 0x06000200de030000;
+    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(code), data));
+    {AntFsFile file0; file0.bytes=data; file0.saveToFile((folder+toString(code, 16, '0')+".bin").c_str());}
+
+
+    // 0x0600020095000000 pid=0x0095=149 L001_Pid_Lap
+    code = 0x0600020095000000;
+    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(code), data));
+    {AntFsFile file0; file0.bytes=data; file0.saveToFile((folder+toString(code, 16, '0')+".bin").c_str());}
+
+
+    // 0x0600020063000000 pid=0x0063=99 L001_Pid_Trk_Hdr
+    code = 0x0600020063000000;
+    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(code), data));
+    {AntFsFile file0; file0.bytes=data; file0.saveToFile((folder+toString(code, 16, '0')+".bin").c_str());}
+
+
+    // 0x06000200e6050000 pid=0x05e6=1510 ????_Pid_Unknown
+    code = 0x06000200e6050000;
+    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(code), data));
+    {AntFsFile file0; file0.bytes=data; file0.saveToFile((folder+toString(code, 16, '0')+".bin").c_str());}
+
 
     // just exit
     changeStateSafe(ST_ANTFS_LAST);
diff --git a/src/AntFr405.cpp b/src/AntFr405.cpp
index 598bb66..0db264a 100644
--- a/src/AntFr405.cpp
+++ b/src/AntFr405.cpp
@@ -458,12 +458,13 @@ AntFr405::handleEvents()
     //R   1.546 MESG_BROADCAST_DATA_ID chan=0x00 ANTFS_BEACON(0x43) Beacon=1Hz, pairing=disabled, upload=disabled, dataAvail=no, State=Transport, Auth=PasskeyAndPairingOnly
     //S   2.477 MESG_BURST_DATA_ID chan=0x00, seq=1, last=yes fe00000000000000 ........
 
-    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(0xfe00000000000000)));
+    vector<uint8_t> dummy;
+    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(0xfe00000000000000), dummy));
 
-    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(0x06000200ff000000)));
+    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(0x06000200ff000000), dummy));
 
     // 06000200f8000000
-    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(0x06000200f8000000)));
+    CHECK_RETURN_FALSE_LOG_OK(m_antMessenger->ANTFS_Direct(chan, SwapDWord(0x06000200f8000000), dummy));
 
     // just exit
     changeStateSafe(ST_ANTFS_LAST);
diff --git a/src/AntMessenger.cpp b/src/AntMessenger.cpp
index c6dc20e..3e7482c 100644
--- a/src/AntMessenger.cpp
+++ b/src/AntMessenger.cpp
@@ -783,7 +783,7 @@ AntMessenger::ANTFS_RequestClientDeviceSerialNumber(const uchar chan, const uint
 
 
 bool
-AntMessenger::ANTFS_Direct(const uchar chan, const uint64_t code)
+AntMessenger::ANTFS_Direct(const uchar chan, const uint64_t code, std::vector<uint8_t>& bytes)
 {
   M_ANTFS_Command_Direct cmd;
   cmd.commandId = ANTFS_CommandResponseId;
@@ -840,6 +840,8 @@ AntMessenger::ANTFS_Direct(const uchar chan, const uint64_t code)
 
   logger() << "got back = \"" << burstData.size() << "\" bytes\n";
 
+  bytes = burstData;
+
   CHECK_RETURN_FALSE_LOG_OK(burstData.size()==size_t((2+resp->detail.directResponse.data)*8));
 
   CHECK_RETURN_FALSE_LOG_OK(ANT_RequestMessage(chan, MESG_CHANNEL_STATUS_ID));
diff --git a/src/AntMessenger.hpp b/src/AntMessenger.hpp
index d315e39..2bc9fab 100644
--- a/src/AntMessenger.hpp
+++ b/src/AntMessenger.hpp
@@ -143,7 +143,7 @@ public:
   bool ANTFS_Erase(const uchar chan, const ushort file);
   bool ANTFS_RequestClientDeviceSerialNumber(const uchar chan, const uint hostSN, uint& sn, std::string& devName);
 
-  bool ANTFS_Direct(const uchar chan, const uint64_t code);
+  bool ANTFS_Direct(const uchar chan, const uint64_t code, std::vector<uint8_t> &bytes);
 
   void eventLoop();
   void kill();
diff --git a/src/antpm-downloader.cpp b/src/antpm-downloader.cpp
index 2d1b1dd..867b751 100644
--- a/src/antpm-downloader.cpp
+++ b/src/antpm-downloader.cpp
@@ -214,8 +214,7 @@ main(int argc, char** argv)
     LOG(antpm::LOG_DBG2) << "\targv[" << i << "]\t\"" << argv[i] << "\"" << endl;
   }
 
-  char* ANTPM_405 = getenv("ANTPM_405");
-  if(ANTPM_405!=NULL && strncmp("1",ANTPM_405,1)==0)
+  if(false && isAntpm405Override())
   {
     logger() << "\n\nApplying ANTPM_405 override mode!\n\n\n";
     AntFr405 watch2(false);
diff --git a/src/common.cpp b/src/common.cpp
index d72636d..ea1d5ad 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -329,6 +329,16 @@ getVersionString()
 }
 
 
+bool
+isAntpm405Override()
+{
+  char* ANTPM_405 = getenv("ANTPM_405");
+  if(ANTPM_405!=NULL && strncmp("1",ANTPM_405,1)==0)
+  {
+    return true;
+  }
+  return false;
+}
 
 
 
@@ -362,7 +372,6 @@ template const std::string toStringDec(const double& val, const int width, const
 template const std::string toStringDec(const unsigned int& val, const int width, const char fill);
 
 
-
 #ifdef _WIN64
 template const std::string toStringDec(const uint64_t& val, const int width, const char fill);
 #endif
diff --git a/src/common.hpp b/src/common.hpp
index 48912dc..38820c0 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -117,4 +117,7 @@ enum
 # define ANTPM_SERIAL_IMPL SerialUsb
 #endif
 
+bool
+isAntpm405Override();
+
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-running/antpm.git



More information about the Pkg-running-devel mailing list