Example #1
0
    static void readSZLAll(libno.daveConnection dc)
    {
        byte[] d=new byte[1000];
        int res, SZLid, indx, SZcount, SZlen,i,j, rid, rind;

        res=dc.readSZL(0,0, d);
        Console.WriteLine(" "+res+" "+dc.getAnswLen());
        if ((dc.getAnswLen())>=4) {
        SZLid=dc.getU16();
        indx=dc.getU16();
        Console.WriteLine(String.Format("result SZL ID {0:X04} index {1:X02}",SZLid,indx));
        if ((dc.getAnswLen())>=8) {
                SZlen=0x100*d[4]+d[5];
            SZcount=0x100*d[6]+d[7];
        Console.WriteLine("%d elements of %d bytes\n",SZcount,SZlen);
        for (i=0;i<SZcount;i++){
            rid=libno.daveGetU16from(d,i*SZlen+8);
            rind=0;
            Console.WriteLine(String.Format("\nID:{0:X04} index {1:X02}",rid,rind));
            readSZL(dc, rid, rind);
        }
        }
        }
        Console.WriteLine("\n");
Example #2
0
    static void readSZL(libno.daveConnection dc, int id, int index)
    {
        int res, SZLid, indx, SZcount, SZlen,i,j,len;
        byte[] ddd=new byte[3000];
        Console.WriteLine(String.Format("Trying to read SZL-ID {0:X04}, index {1:X02}",id,index));
        res=dc.readSZL(id,index, ddd);
        Console.WriteLine("Function result: "+res+" "+libno.daveStrerror(res)+" len:"+dc.getAnswLen());

        if (dc.getAnswLen()>=4) {
        len=dc.getAnswLen()-8;
        SZLid=libno.daveGetU16from(ddd,0);
        indx=libno.daveGetU16from(ddd,2);
        Console.WriteLine(String.Format("result SZL ID {0:X04}, index {1:X02}",SZLid,indx));
        int d=8;
        if (dc.getAnswLen()>=8) {
            SZlen=libno.daveGetU16from(ddd,4);
            SZcount=libno.daveGetU16from(ddd,6);
        Console.WriteLine(" "+SZcount+" elements of "+SZlen+" bytes");
        if(len>0){
            for (i=0;i<SZcount;i++){
            if(len>0){
                for (j=0; j<SZlen; j++){
                if(len>0){
                    Console.Write(String.Format("{0:X02},",ddd[d]));
                    d++;
                }
                len--;
                }
                Console.WriteLine(" ");
            }
            }
        }
        }
        }
        Console.WriteLine(" ");