Automating DWLWin

Hi,

I am trying to Automate DWLWin by following the user manual. Has anybody had any success in this area? I have been working on it for a while without much luck. I can connect to my device but just long enough for it to disconnect again and fail with a code 154 error.

My code is below.

int main(int argc, char **argv)
{
dwlwin::IDwlwinPtr pDWLWin;

CoInitialize(NULL);
if (pDWLWin.CreateInstance("dwlwin.application") != NOERROR)
{
	printf("Cannot launch DWLWin server\n");
	
	return -1;
}

_bstr_t bsVersion = pDWLWin->getVersion(); 
printf("DWLWin Version = %s\n", (LPCTSTR)bsVersion); 

// setup the download options

pDWLWin->setDownloadOptions( 
	11,				        // target is COM11 
	460800,				// 460800 bps 
	"C:\\firmware\\",	        // working directory 
	"tiwipro.r74.18001.wpb|R74_00-cus-wmp-05.wpk|",	// download package file name (plus a pipe) 
	"",					// no eeprom files 
	"",					// no customization files 
	0,					// do not erase objects 
	1,					// do not erase customization files 
	0,					// do not erase the Open AT application 
	0,					// do erase the whole flash memory 
	0,					// do not reset the firmware after download 
	0,					// installation address = don't care 
	7,					// autodetection 
	0,					// no security plugin 
	"");				// no path to security plugin 

// start the download on COM11 
pDWLWin->start(11); 
// Wait (download initialization delay) 
Sleep(500); 
printf("Starting up\n");	
// wait during the download 
bool bConnected = false;

while (! pDWLWin->isDownloadOver(11)) 
{ 
	::Sleep(500); 
	if (! bConnected && pDWLWin->isBootOk(11)) 
	{ 
		printf("DWLWin is connected\n");
		bConnected = true; 
	} 

} 

// Display the exit message 
int nExitCode = pDWLWin->getErrorCode(11); 
_bstr_t bsMessage = pDWLWin->translateErrCode(nExitCode); 
printf("Exit message = %s (code %d)\n", (LPCTSTR)bsMessage, nExitCode);
system("pause");

return 0; 

}

Thanks in advance for your help,

Keyvan

Hi,

Did your code work?

I’m also interested to automate the DWLwin operation and download firmware+ application.

Did you look at this topic?

https://forum.sierrawireless.com/t/is-it-possible-to-embed-an-application-dwl-to-the-wpk-file/4859/9

I don’t know if the problem could be related to the sequence of the file in the setDownloadOptions function.
Try to revert “tiwipro.r74.18001.wpb|R74_00-cus-wmp-05.wpk|” in “R74_00-cus-wmp-05.wpk|tiwipro.r74.18001.wpb|”

Regards,