anuyaprabha
13th February 2003, 12:01
Can BaaN Vc can be interfaced with PDAs? What is the Hardware/Software requirement for the same?

Is there any security mechanism (data encryption) while the BaaN Data is transferred over the WAN using BaaN sessions?

sandraedd
10th July 2008, 23:18
Idem, how i can do this???

sushil
10th September 2008, 07:27
hello,

i have had integrated baan IV c with PDT (poratble data terminal) using ascii file for transactions such as
1.MRN
2.RPL
3.EDI -PO
4.Inv adj
5.,locators (customization)
but extension as .dat so as user must not open (double click).

Regards,
Sushil kumar mudaliar

amealo
10th September 2008, 18:28
I know very good, but Baan has DDC Applications.

sushil
17th September 2008, 11:17
Hi amealo,

Yes, thats True Baan support C language - you can check the examples quoted in "BSE$\api\examples" .

You could give it a try - if you are a good c programmer for integrating with PDT's.

Regards,
Sushil Kumar Mudaliar

Andy..
7th October 2008, 13:01
its pretty difficult and very time consuming to make a robust solution for mobile devices. Better to pick something with off-the-shelf functionality that can be up and running in a few weeks, plenty of customers are using RF Gateway for Baan. Details at http://www.arcgateway.com

sushil
13th March 2009, 16:10
Hi,

Just PM me your mail id - i shall mail you the dotnet src code for PDA integration ??.

BR,
Sushil Kumar Mudaliar

sushil
26th March 2009, 11:11
Hi,

Please find the Source code in C for PDA's that i had developed for unitech PT-100 - Long back.

/*All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation.

Sushil DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS, IN NO EVENT SHALL Sushil BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
OR PERFORMANCE OF THIS SOFTWARE. */

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
#include<dos.h>
#include<ctype.h>
#include<malloc.h>
#include<io.h>
#include <fcntl.h>
#define CR 0x0D
#define LF 0x0A
#define ENTER 13
#define BELL 7
#define EXIT 0x84
#define F1 0x86 // F1 key
#define F2 0x87 // F2 key
#define F3 0x88 // F3 key
#define F4 0x89 // F4 key
#define SCAN_DISABLE 0
#define BS 8
#define AND &&
#define OR ||
union REGS inregs,outregs,regs;
struct SREGS segregs;

struct data
{
char binn[5];
char bagn[18];
char qty[5];
char d1;
char d2;
}da,cbw,*p,*q,*s;
struct temp
{
char tbi[5];
char tbg[18];
char tqty[5];
char d1;
char d2;
}tp,*z;
struct tt
{
int total;
char str[10];
char d1;
char d2;
}t,o,*e;

FILE *fp1,*fp2,*fp3,*fp4,*fp5,*fprecord;
char ttt[30],tmp[18],pmt[18],gg[18],b,tpm[18],temp[4],temp1[6],temp2[17],g,*ptr,*ptr1,*ptr2,gsstr[31],qtn1[3];
int col,row,offset,tot,tr,c,l,cnt,qtn;
cnt=4;
qtn=1;
tot=0;
tr=0;
l=0;
void quan(),add(),adau(),adau1(),abau(),add1(),power_save(),screen_size(),puts_RS232(),beep(),menumain(),dlb();
void ch(),dbc(),dbc1(),cou(),purge(),cls(),gotoxy(),buzzervol(),fm();
int check_after_write(),check_before_write(),noofrecords();
void disable_scanner(),enable_scanner(),enable_RS232(),disable_RS232(),backlight();
int time_delay(),chk_bar(),chk_keypad(),chk_keypad1(),chk_keypad2(),chk_keypad3(),chk_bar1();
int SCAN_ORIGIN,temp_row,temp_col;
char STR_INPUT[20]; // global variable for data input
void row_change();

_setenvp() {} // disable Microsoft Enviornment
void power_save() // enter power saving mode
{
int86(0x22,&regs,&regs);
}
void cls() // clear screen
{
regs.h.ah=0;
int86(0x10,&regs,&regs);
}
int time_delay(int period) /* 10ms per unit */
{
union REGS regs;
long t_start,t_stop,td,i;
regs.h.ah = 0x2c;
intdos(&regs,&regs);
t_start = regs.h.dh * 100 + regs.h.dl;
do
{
regs.h.ah = 0x2c; intdos(&regs,&regs);
t_stop = regs.h.dh * 100 + regs.h.dl;
td = t_stop - t_start;
if (td < 0) td = 6000+td;
} while (td < period);
return(1);
}

void gotoxy(int col, int row) // move cursor
{ // col: 0-19, row:0-7
regs.h.ah=2;
regs.h.bh=0;
regs.h.dh=(unsigned char)row;
regs.h.dl=(unsigned char)col;
int86(0x10,&regs,&regs);
}

void enable_scanner(int setting) // set scanner port
{
inregs.h.ah=0x51;
inregs.h.al=setting;
intdos(&inregs, &outregs);
}

void disable_scanner() // set scanner port
{
inregs.h.ah=0x51;
inregs.h.al=0;
intdos(&inregs, &outregs);
}

void backlight(void)
{
regs.h.ah=0x1A;
regs.h.al=1; // 1 : ON, 0 : OFF
regs.h.bh=0;
int86(0x21,&regs,&regs);
}

void screen_size(void)
{
regs.h.ah=1; // 1 : 6x8 dot character font
int86(0x09,&regs,&regs);
}

void buzzervol(void)
{
regs.h.ah=0x1A;
regs.h.bh=1;
regs.h.al=1; // 1:ON, 0:OFF
int86(0x21,&regs,&regs);
regs.h.ah=0x1A;
regs.h.bh=3;
int86(0x21,&regs,&regs);

}

void beep(int frq, int dur)
{
regs.x.ax=(unsigned char)frq;
regs.x.bx=(unsigned char)dur;
int86(0x3F,&regs,&regs);
}
void main(void)
{
screen_size();
backlight();
buzzervol();
regs.h.ah=0x1B; // retrieve SCANNER TYPE
regs.h.bh=5;
intdos(&regs, &regs);
SCAN_ORIGIN=regs.h.al; // save in SCAN_ORIGIN
cou();
menumain();
}
void menumain()
{
while(1)
{
cls();
fclose(fp1);
qtn=1;
strcpy(qtn1,"1");
fp1=fopen("urfile.dat","a+");
printf("*RS Enterprises*");
printf("\n");
printf("1)Collect Data\n");
printf("2)Clear Datafile\n\n\n");
printf("TOTAL -%d",tot);
switch(getch())
{
case '1' : add();
break;
case '2' : purge();
break;
}
}
fclose(fp1);
fclose(fp2);
}

void add()
{
char pp[11],b,t[11];
int i,len,l;
i=0;
l=0;
offset=0;
qtn=1;
st1:
regs.h.ah=0x1B; // retrieve SCANNER TYPE
regs.h.bh=5;
intdos(&regs, &regs);
SCAN_ORIGIN=regs.h.al; // save in SCAN_ORIGIN
STR_INPUT[0]='\0';
cls();
printf("LOC. NO. ____\n\n\n\n\n");
printf("\nF4)Main Menu");
gotoxy(9,0);
col=9;
row=0;
temp_row=0;
temp_col=col;
st9:
regs.h.ah=0x1B; // retrieve SCANNER TYPE
regs.h.bh=5;
intdos(&regs, &regs);
SCAN_ORIGIN=regs.h.al; // save in SCAN_ORIGIN
enable_scanner(SCAN_ORIGIN);
cnt=4;
while (!chk_bar1(cnt) && !chk_keypad1())
power_save();
switch(c)
{
case F2: cls();
gotoxy(1,3);
printf("INVALID KEY !!!\n");
beep(6,6);
time_delay(100);
goto st1;
case F1:cls();
gotoxy(1,3);
printf("INVALID KEY !!!\n");
beep(6,6);
time_delay(100);
goto st1;
case F4: break;
default: enable_scanner(SCAN_ORIGIN);
if(offset<4)
goto st9;
offset=0;
strcpy(da.binn,STR_INPUT);
l=strlen(da.binn);
if(l>4 || l<1)
{
cls();
gotoxy(0,3);
disable_scanner();
printf("REQUIRES MAXIMUM\n");
printf(" 4 DIGITS");
beep(6,6);
time_delay(100);
enable_scanner(SCAN_ORIGIN);
goto st1;
}
else
{
ptr=da.binn;
ptr1=da.binn;
beep(6,3); adau(); goto st1;
}
}
}
void adau()
{
char pp[7],b,t[7];
int k,a;
k=0;
offset=0;
qtn=1;
STR_INPUT[0]='\0';
st2:
regs.h.ah=0x1B; // retrieve SCANNER TYPE
regs.h.bh=5;
intdos(&regs, &regs);
SCAN_ORIGIN=regs.h.al; // save in SCAN_ORIGIN
STR_INPUT[0]='\0';
strcpy(tmp,da.binn);
strcpy(pmt,tmp);
strcpy(qtn1,"1");
cls();
printf("__________________\n");
printf("\nLOC. NO.-%s",pmt);
printf("\n\n");
printf("F2) New LOC\n");
printf("F1) Qty");
gotoxy(0,0);
col=0;
row=0;
temp_row=0;
temp_col=col;
st8:
enable_scanner(SCAN_ORIGIN);
cnt=18;
while (!chk_bar1(cnt) && !chk_keypad1())
power_save();
switch(c)
{
case F2: break;
case F1: cls();
quan();
disable_scanner();
enable_scanner(SCAN_ORIGIN);
cls();
goto st2;
case F4: cls();
gotoxy(1,3);
printf("INVALID KEY !!!\n");
disable_scanner();
enable_scanner(SCAN_ORIGIN);
beep(6,6);
time_delay(100);
goto st2;
default: enable_scanner(SCAN_ORIGIN);
if(offset!=cnt)
goto st8;
offset=0;
strcpy(da.bagn,STR_INPUT);
k=strlen(da.bagn);
if(k>cnt)
{
cls();
gotoxy(0,3);
disable_scanner();
printf(" WRONG BARCODE \n");
printf("MAX. 10 DIGITS REQUIRED ");
beep(6,6);
time_delay(50);
enable_scanner(SCAN_ORIGIN);
strcpy(STR_INPUT,NULL);
goto st2;
}
else
{
ch();
adau1();
}
}
}

void quan()
{
int i,len,l;
i=0;
l=0;
offset=0;
st21:
regs.h.ah=0x1B; // retrieve SCANNER TYPE
regs.h.bh=5;
intdos(&regs, &regs);
SCAN_ORIGIN=regs.h.al; // save in SCAN_ORIGIN
STR_INPUT[0]='\0';
cls();
printf("QUANTITY ____\n\n\n\n\n");
printf("F2)ITEM\n");
gotoxy(9,0);
col=9;
row=0;
temp_row=0;
temp_col=col;
st9:
regs.h.ah=0x1B; // retrieve SCANNER TYPE
regs.h.bh=5;
intdos(&regs, &regs);
SCAN_ORIGIN=regs.h.al; // save in SCAN_ORIGIN
disable_scanner();
cnt=4;
while (!chk_bar1(cnt) && !chk_keypad1())
power_save();
switch(c)
{
case F2: cls();
disable_scanner();
enable_scanner(SCAN_ORIGIN);
adau1();
break;
case F1:cls();
gotoxy(1,3);
printf("INVALID KEY !!!\n");
disable_scanner();
enable_scanner(SCAN_ORIGIN);
beep(6,6);
time_delay(100);
goto st21;
case F4: break;
default: enable_scanner(SCAN_ORIGIN);
if(offset<cnt)
goto st9;
offset=0;
strcpy(qtn1,STR_INPUT);
qtn=atoi(STR_INPUT);
if(qtn>0)
{
qtn--;
itoa(qtn,qtn1,10);
tot=tot+qtn;
tot--;
l=strlen(STR_INPUT);
if(l>cnt || l<1)
{
cls();
gotoxy(0,3);
disable_scanner();
printf("REQUIRES MAXIMUM\n");
printf("MAX. 4 DIGITS");
beep(6,6);
disable_scanner();
enable_scanner(SCAN_ORIGIN);
time_delay(100);
goto st21;
}
else
{
strcpy(da.bagn,tpm);
beep(6,3); ch(); adau1;
}
}
else
{
cls();
gotoxy(0,3);
disable_scanner();
printf("0 not allowed\n");
beep(6,6);
disable_scanner();
enable_scanner(SCAN_ORIGIN);
time_delay(100);
goto st21;
}
}
}

void ch()
{
int i,j,tot;
char te[4];
cls();
tot=j=0;
fclose(fp1);
fp1=fopen("urfile.dat","a+");
da.d1='\r';
da.d2='\n';
tpm[0]='\0';
strcpy(tpm,da.bagn);dbc();
strcpy(qtn1,"1");
qtn=1;
}
void adau1()
{
char pp[7],b,t[6];
int l;
STR_INPUT[0]='\0';
qtn=1;
strcpy(qtn1,"1");
l=0;
offset=0;
regs.h.ah=0x1B; // retrieve SCANNER TYPE
regs.h.bh=5;
intdos(&regs, &regs);
SCAN_ORIGIN=regs.h.al; // save in SCAN_ORIGIN
st3:
STR_INPUT[0]='\0';
cls();
printf("__________________\n");
printf("LOC.: %s\n",pmt);
printf("ITEM:%s\n",tpm);
printf("TOT.ITEMS:%d\n\n",tot);
printf("F1) QTY, F2) Loc");
gotoxy(0,0);
col=0;
row=0;
temp_row=0;
temp_col=col;
st11:
enable_scanner(SCAN_ORIGIN);
cnt=18;
while (!chk_bar1(cnt) && !chk_keypad1())
power_save();
switch(c)
{
case F1: cls();
quan();
disable_scanner();
enable_scanner(SCAN_ORIGIN);
cls();
goto st3;
case F4: cls();
gotoxy(1,3);
printf("INVALID KEY !!!\n");
disable_scanner();
enable_scanner(SCAN_ORIGIN);
beep(6,6);
time_delay(100);
goto st3;
case F2: break;
default: enable_scanner(SCAN_ORIGIN);
if(offset!=cnt)
goto st11;
offset=0;
strcpy(da.bagn,STR_INPUT);
disable_scanner();
l=strlen(da.bagn);
if(l>cnt)
{
cls();
gotoxy(0,3);
printf(" ");
gotoxy(0,3);
printf(" WRONG BARCODE \n");
printf("MAX 10 DIGITS REQUIRED ");
beep(6,6);
time_delay(75);
strcpy(tpm,da.bagn);
enable_scanner(SCAN_ORIGIN);
strcpy(STR_INPUT,NULL);
goto st3;
}
else
{
ch();
goto st3;
}
}
}

void dbc()
{
char *mn;
long int ra = -14L;
fpos_t recpos;
int i,l,k,len1,len2,len3;
fclose(fp1);
tr=1;
fclose(fp1);
fp1=fopen("urfile.dat","a+");
if(c != ' ')
{
gg[0]='*';
gg[1]='\0';
}
else
{
gg[0]=' ';
gg[1]='\0';
}
strcpy(da.binn,pmt);
len1=strlen(da.binn);
len2=strlen(da.bagn);
len3=strlen(qtn1);
for(k=0,i=0;i!=4;i++)
{
ttt[k++]=da.binn[i];
}
ttt[k++]=',';
for(i=0;i!=len2;i++)
{
ttt[k++]=da.bagn[i];
}
ttt[k++]=',';

for(i=0;i!=len3;i++)
{
ttt[k++]=qtn1[i];
}
l=4+len2+len3;
for(;l!=27;l++)
{
ttt[k++]=' ';
}
ttt[k++]='\n';
ttt[k++]='\0';
fwrite(ttt,1,sizeof(*p),fp1);
tot++;
fclose(fp1);
strcpy(STR_INPUT,NULL);
fgetpos( fp1,&recpos );
recpos =(fpos_t)(recpos - 16);
t.total=tot;
t.d1='\r';
t.d2='\n';
strcpy(t.str,"TOTAL");
fp4=fopen("TOT.DAT","w+");
rewind(fp4);
fwrite(&t,1,sizeof(*e),fp4);
fclose(fp4);
strcpy(da.binn," ");
strcpy(da.bagn," ");
// }
}

void cou()
{
int recpos;
fp4=fopen("TOT.DAT","r+");
rewind(fp4);
if((fread(&t,1,sizeof(*e),fp4)) != 1)
{
tot=t.total;
}
else
{
tot=0;
recpos = (noofrecords());
}
fclose(fp4);
}
void purge(void)
{
unsigned char select=' ';
cls();
gotoxy(0,2);
printf("Delete Data File");
printf("\n");
printf(" 1) Yes \n");
printf("\n 2) No ");
while((select != '1') && (select != '2'))
{
select=getch();
if(select == '1')
{
cls();
gotoxy(1,3);
remove("urfile.dat");
remove("TOT.DAT");
strcpy(tp.tbg," ");
strcpy(tp.tbi," ");
printf("Deleting..!!!");
beep(6,7);
tot=0;
}
}
}
void dlb()
{
char v,lb[11];
long int ra=-17L;
if(tr == 0)
{
cls();
gotoxy(0,2);
printf("NO TRANSACTION\n");
printf("\nCAN'T DEL LAST BAG");
beep(6,6);
time_delay(150);
}
else
{
fclose(fp1);
fp1=fopen("urfile.dat","r+");
rewind(fp1);
while(feof(fp1) == 0)
{
fread(&tp,1,sizeof(*z),fp1);
}
if((strcmp(tp.tbg," ") == 0))
{
cls();
gotoxy(0,3);
printf("ALREADY DELETED \n");
beep(6,6);
time_delay(150);
fclose(fp1);
}
else
{
cls();
printf("Delete Last ITEM");
printf("\nLS ITEM:-%s \n",tp.tbg);
printf("Delete.. Sure ?\n");
printf(" 1) Yes\n");
printf(" 2) No ");
printf("\n*-KBD ENTRY");
switch(getch())
{
case '1':
strcpy(da.binn," ");
strcpy(da.bagn," ");
fseek(fp1,ra,1);
fwrite(&da,1,sizeof(*p),fp1);
strcpy(lb," ");
tot--;
cls();
printf("\n\n\n");
printf("TOTAL BAGS-%d",tot);
time_delay(150);
fclose(fp1);
t.total=tot;
t.d1='\r';
t.d2='\n';
strcpy(t.str,"TOTAL");
fp4=fopen("TOT.DAT","w+");
rewind(fp4);
fwrite(&t,1,sizeof(*e),fp4);
fclose(fp4);
fm();
break;
case '2' :
fclose(fp1);
break;
}
}
}
}
int chk_keypad1()
{
int COMPLETE=0,l=0;

if (kbhit()==0) // check first key pressing
return(0);
while (!COMPLETE)
{
switch(c=getch())
{
case BS:if (offset==0) // back space
putchar(BELL);
else
{
offset--;
if (row<=temp_row)
{
if (col>temp_col)
{
col--;
}
}
else
{ col--;}
row_change(2);
gotoxy(col,row);
putchar('_');
gotoxy(col,row);
COMPLETE=1;
}
break;
case ENTER: COMPLETE=1;
offset=cnt;
break;
case F3 : COMPLETE=1;
break;
case F1 : COMPLETE=1;
break;
case F4 : COMPLETE=1;
break;
case F2 : COMPLETE=1;
break;
default : if ( (c>='0' && c<='9') ||
(c>='A' && c<='Z') ||
(c>='a' && c<='z') )
{
STR_INPUT[offset]=c;
gotoxy(col,row);
putchar(c);
offset++;
col++;
row_change(1);
enable_scanner(SCAN_ORIGIN);
COMPLETE=1;
}
else
putchar(BELL);
break;
} // switch (c=getch())
} // while (!COMPLETE)
STR_INPUT[offset]='\0'; // string delimiter
return(1);
}
int chk_bar1(int len_limit)
{
char str_bar[32];
inregs.x.dx=(int)str_bar; // get barcode data from scanner port
segread(&segregs);
inregs.h.ah=0x50;
intdosx(&inregs,&outregs,&segregs);
if (outregs.h.al==0)
{
if(strlen(str_bar)>len_limit)
putchar(BELL);
else
{
strcpy(STR_INPUT,str_bar);
enable_scanner(SCAN_ORIGIN);
gotoxy(col,row);
printf("%s",STR_INPUT);
c=' ';
offset=cnt;
return(1);
}
}
return(0);
}
void fm()
{
char empstr[5];
strcpy(empstr," ");
fp1=fopen("urfile.dat","r");
rewind(fp1);
fp5=fopen("tr.dat","w+");
fclose(fp5);
while(feof(fp1) == 0)
{
fread(&tp,1,sizeof(*z),fp1);
if((strcmp(tp.tbi,empstr) != 0))
{
if (feof(fp1)!=0)
{
break;
}
fp5=fopen("tr.dat","a+");
fwrite(&tp,1,sizeof(*z),fp5);
fclose(fp5);
}
}
fclose(fp1);
remove("urfile.dat");
rename("tr.dat","urfile.dat");
}
int check_after_write(fpos_t recpos)
{
char *l_str;
int check_flag = 0;
if((fprecord = fopen("urfile.dat","r+"))!=NULL)
{
fsetpos(fprecord,&recpos);
fread(&cbw,1,sizeof(*z),fprecord);
if (check_before_read(cbw.binn) == 0)
{
l_str = cbw.bagn;
l_str++;
if (check_before_read(l_str)==0)
check_flag = 0;
else
check_flag = 1;
}
else
check_flag = 1;
}
else
check_flag = 1;

fclose(fprecord);
if (check_flag == 1)
return 1;
else
return 0;
}

int check_before_read(char *pstr)
{
int lctr;
char *ptr;
for(ptr = pstr;*ptr;ptr++)
{
if ((*ptr >= 'A'AND *ptr <= 'Z') OR (*ptr >= 'a' AND *ptr <= 'z') OR (*ptr >= '0'AND *ptr <= '9') OR (*ptr == ' ') OR (*ptr == '*'));

else
break;
}

if (*ptr == '\0')
return 0;
else
return 1;
}
int noofrecords()
{
long recpos;
int handle,newrec = 1;
size_t recsize = sizeof( tp );
char *ptr,*mn;
if ( (handle = _open( "urfile.dat", _O_BINARY | _O_RDONLY )) == -1 )
return 0;
recpos = (_filelength(handle));
_close(handle);
newrec = (recpos / 17);
return newrec;
}


void row_change(int l_sign)
{
// parameter is l_sign if it is 1 then to add
// if it is 2 then to substract */
if (l_sign==1)
{
if (col>15)
{
row=row+1;
col=0;
}
}
else if (l_sign==2)
{
if (col<0)
{
if (row>temp_row)
{
row=row-1;
col=15;
}
}
}
}


/*

ฺฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฤฟ
ณ END of program ณ
ภ
*/


BR,
Sushil Kumar Mudaliar