RIL ERROR: LNK2019

Search This thread

ballrock2

Member
Jul 15, 2003
24
0
Hi,

I tried so compile the RIL-Sample in my vEmbeddedC++.
The Workspace is the original from this website, no modifications.
Every time i try to compile and send to my MDA i get the following error:

Linking...
tstril.obj : error LNK2019: unresolved external symbol RIL_Initialize referenced in function "unsigned long __cdecl DoRIL(void *)" (?DoRIL@@YAKPAX@Z)
ARMRel/tstril.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

tstril.exe - 2 error(s), 0 warning(s)

If I try other own projects, there is no problem to send and start to/on MDA. The compiled ARM-Release also works.

Would be great, if anyone of you has got a tip, where's my fault.

Greetings from hannovre,
Andreas
 

itsme

Retired Admin
Mar 17, 2003
655
9
delft 52'00N 4'22E
www.xs4all.nl
that is because there is no ril.lib, you will either have to create it your self,
or use another method to get pointers to the ril.dll.
I usually use something like this:
-------rillib.h
Code:
typedef HRESULT (*PFRIL_Initialize)(DWORD dwIndex, RILRESULTCALLBACK pfnResult, RILNOTIFYCALLBACK pfnNotify, 
									DWORD dwNotificationClasses, DWORD dwParam, HANDLE *phRil);
typedef HRESULT (*PFRIL_DeInitialize)(HANDLE hRil);
typedef HRESULT (*PFRIL_GetRegistrationStatus)(HANDLE hRil);
typedef HRESULT (*PFRIL_GetCellTowerInfo)(HANDLE hRil);
typedef HRESULT (*PFRIL_DevSpecific)(HANDLE hRil, BYTE*params, DWORD dwSize);

extern PFRIL_Initialize RIL_Initialize;
extern PFRIL_GetRegistrationStatus RIL_GetRegistrationStatus;
extern PFRIL_GetCellTowerInfo RIL_GetCellTowerInfo;
extern PFRIL_DevSpecific RIL_DevSpecific;
---------rillib.c
Code:
#include "rillib.h"

PFRIL_Initialize RIL_Initialize;
PFRIL_GetRegistrationStatus RIL_GetRegistrationStatus;
PFRIL_GetCellTowerInfo RIL_GetCellTowerInfo;
PFRIL_DevSpecific RIL_DevSpecific;
class RilLib {
public:
	RilLib()
	{
		m_hRilDll= LoadLibrary(L"ril.dll");

		RIL_Initialize= (PFRIL_Initialize)GetProcAddress(m_hRilDll, L"RIL_Initialize");
		RIL_GetRegistrationStatus= (PFRIL_GetRegistrationStatus)GetProcAddress(m_hRilDll, L"RIL_GetRegistrationStatus");
		RIL_GetCellTowerInfo= (PFRIL_GetCellTowerInfo)GetProcAddress(m_hRilDll, L"RIL_GetCellTowerInfo");
		RIL_DevSpecific= (PFRIL_DevSpecific)GetProcAddress(m_hRilDll, L"RIL_DevSpecific");
	}

	~RilLib()
	{
		RIL_Initialize= NULL;
		RIL_GetRegistrationStatus= NULL;
		RIL_GetCellTowerInfo= NULL;
		RIL_DevSpecific= NULL;
		FreeLibrary(m_hRilDll);
	}
private:
	HMODULE m_hRilDll;

};
static RilLib g_rillib;
 

W4XY

Senior Member
Jan 19, 2003
137
1
Earth... I think
XDA developer Itsme said:
that is because there is no ril.lib, you will either have to create it your self,
or use another method to get pointers to the ril.dll.

The ril.lib is in the tstril directory. you need to include it in the project. The Readme.txt describes how to create a ril.lib from any ril.dll
 

ballrock2

Member
Jul 15, 2003
24
0
Many thanks, I've included the RIL and now it seems to work.

A short question to the ExampleProgramm is left: In which format ist the SMS-Message? Hex? Exists a routine to decode the SMS to readable text?

Greetings,.
Andreas :eek:)
 

mjgermain

Member
Jan 20, 2003
18
0
Huddersfield UK
Hi ballrock2

This code will decipher the incoming byte stream. It's not particularly elegant but it seems to work, (I've not included error checking etc)

Code:
unsigned char byteflip(unsigned char inchar)
{
	unsigned char outchar;
	unsigned char tmp;
	int i;

	outchar = 0;
	for (i = 0; i < 8; i++)
	{
		tmp = inchar & 1;		// get lsb in tmp
		inchar >>= 1;			// shift right
		outchar = (outchar << 1)  | tmp;	
	}
	return outchar;
}



TCHAR *msgdecipher(unsigned char *data, int n)
{
	unsigned char ybuf[1000];	// buffer of byteflipped data
	unsigned char tmp;			// temporary character
    static TCHAR xbuf[1000];	// output unicode buffer
	int i;						// index into inconimg and output character stream
	int j;						// index into flipped bytestream
	int k;						// counter for each bit in 7 bit character
	int l;						// counter to know when to increment j
	int escape;					// set true when esc (1b) encountered in output stream

    TCHAR *p;					// pointer to output buffer
    
	
	p=xbuf;


	// byteflip each input char and store in ybuf

	for (i = 0; i < n; i++)
	{
		ybuf[i] = byteflip(data[i]);
	}

	
	// read each 7 bits from ybuf, create a character and re-flip

	j = 0;
	k = 0;
	l = 0;
	
	escape = 0;

	for (i = 0; i < n; i++)		// loop for each output character
	{
		tmp = 0;
		for (k = 0; k < 7; k++)
		{
			tmp <<= 1;
			if (ybuf[j] & 128)
			{
				tmp |= 1;;
			}
			ybuf[j] <<= 1;
			l++;
			if (l == 8)			// when 8 bits read, go onto next char in bytestream
			{
				j++;
				l = 0;
			}
		}

		// shift left, so that when re-flipped, msb is zero

		tmp = byteflip(tmp<<1);


		// handle special and accented characters

		// normal ascii drops straight through


		if (tmp == 27)
		{
			escape = 1;		// set flag and get next character
		}
		else
		{
			if (escape)
			{
				escape = 0;
				switch (tmp)
				{
				case 20:
					tmp = '^';
					break;
				case 40:
					tmp = '{';
					break;
				case 41:
					tmp = '}';
					break;
				case 47:
					tmp = '\\';
					break;
				case 60:
					tmp = '[';
					break;
				case 61:
					tmp = '~';
					break;
				case 62:
					tmp = ']';
					break;
				case 64:
					tmp = '|';
					break;
				}
			}
			else
			{

				switch (tmp)
				{
				case 0:
					tmp = '@';
					break;
				case 1:
					tmp = '£';
					break;
				case 2:
					tmp = '$';
					break;
				case 3:
					tmp = '¥';
					break;
				case 4:
					tmp = 'ê';
					break;
				case 5:
					tmp = 'é';
					break;
				case 6:
					tmp = 'ù';
					break;
				case 7:
					tmp = 'ì';
					break;
				case 8:
					tmp = 'ò';
					break;
				case 9:
					tmp = 'ç';
					break;
				case 11:
					tmp = 'Ø';
					break;
				case 12:
					tmp = 'ø';
					break;
				case 14:
					tmp = 'Å';
					break;
				case 15:
					tmp = 'å';
					break;
				case 17:
					tmp = '_';
					break;
				case 28:
					tmp = 'Æ';
					break;
				case 29:
					tmp = 'æ';
					break;
				case 30:
					tmp = 'ß';
					break;
				case 31:
					tmp = 'É';
					break;
				case 64:
					tmp = '¡';
					break;
				case 91:
					tmp = 'Ä';
					break;
				case 92:
					tmp = 'Ö';
					break;
				case 93:
					tmp = 'Ñ';
					break;
				case 94:
					tmp = 'Ü';
					break;
				case 95:
					tmp = '§';
					break;
				case 96:
					tmp = '¿';
					break;
				case 123:
					tmp = 'ä';
					break;
				case 124:
					tmp = 'ö';
					break;
				case 125:
					tmp = 'ñ';
					break;
				case 126:
					tmp = 'ü';
					break;
				case 127:
					tmp = 'à';
					break;
				}

			}
			
			p += _sntprintf(p, 2, TEXT("%c"),tmp);
			

		}



	}




    return xbuf;
}
 

ballrock2

Member
Jul 15, 2003
24
0
Many many thanks!!! :eek:)

It works! ;o) If someone would like to get the project (Receiving SMS in "readbable" format), pse mail me.

I'm now searching for a way to send SMS ;o)
 

mjgermain

Member
Jan 20, 2003
18
0
Huddersfield UK
Sending is even easier

Look at SmsOpen SmsSendMessage and SmsClose in the documentation



Code:
#include <sms.h>

long fnSendSMS(LPCTSTR inaddr,LPCTSTR inmsg)
{
HRESULT res, res2;
LPCTSTR  ptsMessageProtocol;
SMS_HANDLE  psmshHandle;
SMS_ADDRESS  psmsaDestinationAddress;
TEXT_PROVIDER_SPECIFIC_DATA tpsd;
SMS_MESSAGE_ID msgid;


    ptsMessageProtocol = _T("Microsoft Text SMS Protocol");
	res = SmsOpen(ptsMessageProtocol,SMS_MODE_SEND, &psmshHandle,NULL);

		psmsaDestinationAddress.smsatAddressType = SMSAT_INTERNATIONAL;
		wcscpy(psmsaDestinationAddress.ptsAddress ,inaddr);
		tpsd.dwMessageOptions = PS_MESSAGE_OPTION_NONE;
		tpsd.psMessageClass = PS_MESSAGE_CLASS1;
		tpsd.psReplaceOption = PSRO_NONE;

	res = SmsSendMessage(
		 psmshHandle,
		 NULL,
		 &psmsaDestinationAddress,
		 NULL,
		 (BYTE *)inmsg,
		 wcslen(inmsg) * 2,
		 (unsigned char *)&tpsd,
		 sizeof(tpsd),
		 SMSDE_OPTIMAL,
		 SMS_OPTION_DELIVERY_NONE,
		 &msgid);

	
	res2 = SmsClose(psmshHandle);
	return long(res);
}
 

Jeronimo

New member
Jul 12, 2003
4
0
Is there a way to send PDU data instead of TEXT data.

I would like to send EMS messages (text + picture) using RIL.

EMS is like SMS but with specific data header (TP-UDH) and content (TP-UD).

I need to send a complete PDU packet (as with AT+CMGF=0 when using a GSM modem).

For ptsMessageProtocol what are all supported values ?

That could be possible, because EzWap 2.5 is able to send MMS messages with XDA (need to send PDU data by SMS too).

Any idea ?

Thanks,