Skip to content

Commit

Permalink
Adding <device> and some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalm committed Apr 7, 2011
1 parent 40932b4 commit cf0e072
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 16 deletions.
Binary file modified COMputer/COMputer.sdf
Binary file not shown.
Binary file modified COMputer/COMputer.suo
Binary file not shown.
Binary file modified libdivecomputer/libdivecomputer.sdf
Binary file not shown.
Binary file modified libdivecomputer/libdivecomputer.suo
Binary file not shown.
4 changes: 2 additions & 2 deletions projects/DiveBoard/ComputerFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ ComputerFactory::ComputerFactory(void)
recognisedPorts["LDC vtpro"].push_back("XXXXXXXXXXXXXX");
recognisedPorts["LDC veo250"].push_back("XXXXXXXXXXXXXX");
recognisedPorts["LDC atom2"].push_back("XXXXXXXXXXXXXX");
recognisedPorts["Mares M2"].push_back("XXXXXXXXXXXXXX");
recognisedPorts["LDC nemo"].push_back("XXXXXXXXXXXXXX");
recognisedPorts["Mares M2"].push_back("Silicon Labs CP210x USB to UART Bridge");
recognisedPorts["LDC nemo"].push_back("Silicon Labs CP210x USB to UART Bridge");
recognisedPorts["LDC puck"].push_back("XXXXXXXXXXXXXX");
recognisedPorts["LDC ostc"].push_back("XXXXXXXXXXXXXX");
recognisedPorts["LDC edy"].push_back("XXXXXXXXXXXXXX");
Expand Down
18 changes: 12 additions & 6 deletions projects/DiveBoard/ComputerLibdc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ LIBTYPE openDLLLibrary()
dll += DLL_PATH;

LOGINFO("Searching DLL at %s", dll.c_str());
HINSTANCE libdc = LoadLibrary(TEXT("J:\\Dev\\DB_plugin\\libdivecomputer\\Debug\\libdivecomputer.dll"));
HINSTANCE libdc = LoadLibrary(dll.c_str());
if (!libdc)
{
LPVOID lpMsgBuf;
Expand Down Expand Up @@ -363,6 +363,7 @@ sample_cb (parser_sample_type_t type, parser_sample_value_t value, void *userdat
//sample_data_t *sampledata = (sample_data_t *) userdata;
unsigned int nsamples = 0;
struct sample_cb_data *data = (struct sample_cb_data *) userdata;
std::string vendor;

LOGDEBUG("Parsing element of type '%d'", type);

Expand Down Expand Up @@ -400,10 +401,11 @@ sample_cb (parser_sample_type_t type, parser_sample_value_t value, void *userdat
data->sampleXML += str(boost::format("<bearing>%u</bearing>") % value.bearing);
break;
case SAMPLE_TYPE_VENDOR:
data->sampleXML += str(boost::format("<vendor type=\"%u\" size=\"%u\">") % value.vendor.type % value.vendor.size);
vendor += str(boost::format("vendor type=\"%u\" size=\"%u\"") % value.vendor.type % value.vendor.size);
for (unsigned int i = 0; i < value.vendor.size; ++i)
data->sampleXML += str(boost::format("%02X") % (((unsigned char *) value.vendor.data)[i]));
data->sampleXML += "</vendor>";
vendor += str(boost::format("%02X") % (((unsigned char *) value.vendor.data)[i]));

LOGINFO(vendor);
break;
default:
LOGWARNING("Received an element of unknown type '%d'", type);
Expand Down Expand Up @@ -630,7 +632,7 @@ static void event_cb (device_t *device, device_event_t event, const void *data,

device_data_t *devdata = evdata->devdata;

LOGDEBUG("Received event of tyep '%d'", event);
LOGDEBUG("Received event of type '%d'", event);

switch (event) {
case DEVICE_EVENT_WAITING:
Expand Down Expand Up @@ -675,6 +677,8 @@ static void event_cb (device_t *device, device_event_t event, const void *data,
break;
}

LOGDEBUG("End of event handling");

} catch(std::exception &e) {
LOGWARNING("Caught Exception : %s",e.what());
throw;
Expand Down Expand Up @@ -930,7 +934,9 @@ void ComputerLibdc::dowork (device_type_t &backend, const std::string &devname,
divedata.status = &status;
divedata.computer = this;

diveXML.append("<profile udcf='1'><REPGROUP>");
diveXML.append("<profile udcf='1'><device><model>");
diveXML.append(lookup_name(backend));
diveXML.append("</model></device><REPGROUP>");

// Download the dives.
LOGINFO("Downloading the dives.");
Expand Down
2 changes: 1 addition & 1 deletion projects/DiveBoard/ComputerMares.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ int ComputerMares::list_dives(std::vector<DiveData> &dives)

void ComputerMares::format_dives(std::vector<DiveData> dives, std::string &xml)
{
xml += "<profile udcf='1'><REPGROUP>";
xml += "<profile udcf='1'><device><vendor>Mares</vendor><model>M2</model><REPGROUP>";
for (unsigned int i=0; i<dives.size();i++)
{
xml += "<DIVE>";
Expand Down
2 changes: 1 addition & 1 deletion projects/DiveBoard/ComputerSuunto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ int ComputerSuunto::_get_all_dives(std::string &xml)

status.state = COMPUTER_RUNNING;

xml += "<profile udcf='1'><REPGROUP>";
xml += "<profile udcf='1'><device><vendor>Suunto</vendor><model>Vyper</model></device><REPGROUP>";

while (true)
{
Expand Down
5 changes: 3 additions & 2 deletions projects/DiveBoard/DeviceMares.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

DeviceMares::DeviceMares(std::string name)
{
LOGDEBUG("Creating DeviceMares on %s", name.c_str());
filename = name;
hCom = NULL;
open();
Expand All @@ -48,10 +49,10 @@ int DeviceMares::open()
bool fSuccess;
DCB dcb;

LOGINFO("Opening %s", filename);
LOGINFO("Opening %s", filename.c_str());

//todo fix unicode
hCom = CreateFile((LPCWSTR)filename.c_str(),
hCom = CreateFile(s2ws(filename).c_str(),
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
Expand Down
2 changes: 1 addition & 1 deletion projects/DiveBoard/DiveBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ bool DiveBoard::onMouseMove(FB::MouseMoveEvent *evt, FB::PluginWindow *)
//printf("Mouse move at: %d, %d\n", evt->m_x, evt->m_y);
return false;
}
bool DiveBoard::onWindowAttached(FB::AttachedEvent *evt, FB::PluginWindow *)
bool DiveBoard::onWindowAttached(FB::AttachedEvent *evt, FB::PluginWindow *w)
{
// The window is attached; act appropriately
return false;
Expand Down
6 changes: 3 additions & 3 deletions projects/DiveBoard/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Section "FTDI" Driver1
SetOutPath $TEMP\DB_FTDI
File /r "..\..\drivers\ftdi_win"
ExecWait 'rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 "$TEMP\DB_FTDI\ftdi_win\ftdibus.inf"' $0
MessageBox MB_OK "FTDI Driver installed. Installer returned $0.\n $TEMP" IDOK 0
# MessageBox MB_OK "FTDI Driver installed. Installer returned $0.\n $TEMP" IDOK 0

Delete "$TEMP\DB_FTDI"
SectionEnd
Expand All @@ -134,7 +134,7 @@ Section "SiliconLabs CP210x" Driver2
File /r "..\..\drivers\Silabs_windows"
ExecWait '"$TEMP\DB_SILABS\Silabs_windows\CP210x_VCP_Win2K.exe"' $0

MessageBox MB_OK "SiliconLabs CP210x Driver installed. Installer returned $0.\n $TEMP" IDOK 0
# MessageBox MB_OK "SiliconLabs CP210x Driver installed. Installer returned $0.\n $TEMP" IDOK 0

Delete "$TEMP\DB_SILABS"
SectionEnd
Expand All @@ -144,7 +144,7 @@ Section "Prolific" Driver3
File /r "..\..\drivers\prolific_win"
ExecWait '"$TEMP\DB_PROLIFIC\prolific_win\PL2303_Prolific_DriverInstaller_v130.exe"' $0

MessageBox MB_OK "Prolific Driver installed. Installer returned $0 \n $TEMP" IDOK 0
# MessageBox MB_OK "Prolific Driver installed. Installer returned $0 \n $TEMP" IDOK 0

Delete "$TEMP\DB_PROLIFIC"
SectionEnd
Expand Down

0 comments on commit cf0e072

Please sign in to comment.