Beispiel #1
0
void DataTx(uint8_t *data,uint8_t len,uint8_t flag) {
    if(data[0]<2) {
        return;
    }
    uint8_t temp[szMax],i,j;
    temp[0]=0x7E;
    temp[1]=len+1;
    temp[2]=data[0]-1;
    temp[3]=DATA;
    j=1;
    for(i=4; i<len+3; i++) {
        temp[i]=data[j];
        j++;
    }
    temp[i]=CRC;
    i=4;
    while(temp[i] != MyOwnAddress) {
        i++;
    }
    for(j=0; j<MaxuIDTrack; j++) {
        if(ackTrackS[i]==0) {
            ackTrackS[i]=temp[i+1];
            break;
        }
    }
    TxQueueAdd(temp,len+4,temp[i+1],flag);
    return;
}
Beispiel #2
0
void DackTx(uint8_t dest) {
    uint8_t temp[szMax];
    temp[0] = 0x7E;
    temp[1] = 0x03;
    temp[2] = 0x01;
    temp[3] = DACK;
    temp[4] = MyOwnAddress;
    temp[5] = CRC;
    TxQueueAdd(temp,6,dest,1);
}
Beispiel #3
0
void RouteRequestTx(uint8_t *rreq,uint8_t len) {
    if(rreq[0]<2) {
        return;
    }
    uint8_t temp[szMax],i,j;
    temp[0]=0x7E;
    temp[1]=len+2;
    temp[2]=rreq[0]-1;
    temp[3]=RREQ;
    j=1;
    for(i=4; i<len+3; i++) {
        temp[i]=rreq[j];
        j++;
    }
    temp[i]=MyOwnAddress;
    i++;
    temp[i]=CRC;
    if(temp[1]==4)// own packet
        TxQueueAdd(temp,len+5,0xFF,0);
    else
        TxQueueAdd(temp,len+5,0xFF,1);
    return;
}
Beispiel #4
0
 void RouteRequestTx(uint8_t *rreq,uint8_t len){
	if(rreq[0]<2){return;}
	uint8_t temp[len+5],i,j;
	temp[0]=0x7E;
	temp[1]=len+2;
	temp[2]=rreq[0]-1;
	temp[3]=RREQ;
	j=1;
	for(i=4;i<len+3;i++){temp[i]=rreq[j];j++;}
	temp[j]=MyOwnAddress;
	j++;
	temp[j]=CRC;
	TxQueueAdd(temp,len+5,0xFF);
	return;
}
Beispiel #5
0
void RsalTx(uint8_t *rsal, uint8_t len, uint8_t flag) {
    if(rsal[0]<2) {
        return;
    }
    uint8_t temp[szMax],i,j;
    temp[0]=0x7E;
    temp[1]=len+1;
    temp[2]=rsal[0]-1;
    temp[3]=RSAL;
    j=1;
    for(i=4; i<len+3; i++) {
        temp[i]=rsal[j];
        j++;
    }
    temp[i]=CRC;
    TxQueueAdd(temp,len+4,0xFF, flag);
    return;
}
Beispiel #6
0
void RouteReplyTx(uint8_t *rrep,uint8_t len, uint8_t timeOff) {
    if(rrep[0]<2) {
        return;
    }
    uint8_t temp[szMax],i,j;
    temp[0]=0x7E;
    temp[1]=len;
    temp[2]=rrep[0]-1;
    temp[3]=RREP;
    j=2;
    for(i=4; i<len+2; i++) {
        temp[i]=rrep[j];
        j++;
    }
    temp[i]=CRC;
    i=4;
    while(temp[i] != MyOwnAddress) {
        i++;
    }
    TxQueueAdd(temp,len+3,temp[i-1],0);
    return;
}