BOOL SetChanelValueFromPacket(BowlerPacket * Packet){
	BYTE pin = Packet->use.data[0];
	BYTE mode = GetChannelMode(pin);
	if(isStremChannelMode(mode)){
		if(setChanelValueHWPtr!=NULL)
			// Load the data directly into the packet as the buffer
			//Data pointer is offset by one to start after the pin index
			setChanelValueHWPtr(pin,
								Packet->use.head.DataLegnth-(4+1),
								(INT32 *)(Packet->use.data+1),
								(float)0);
			READY(Packet,1,3);
	}else{
		INT32 data = 0;
		INT32 time = 0;

		if(isSingleByteMode(mode)){
			data = Packet->use.data[1];
			if (Packet->use.head.DataLegnth>(4+2)){
				time = get16bit(Packet,2);
			}else{
				time=0;
			}
		}else if(isTwoByteMode(mode)){
			data=get16bit(Packet,1);
			if (Packet->use.head.DataLegnth>(4+3)){
				time= get32bit(Packet,3);
			}else{
				time=0;
			}
		}else{
			data=get32bit(Packet,1);
			if (Packet->use.head.DataLegnth>(4+5)){
				time= get32bit(Packet,5);
			}else{
				time=0;
			}
		}
		getBcsIoDataTable()[pin].PIN.currentValue = data;
		if(setChanelValueHWPtr!=NULL)
			setChanelValueHWPtr(pin,1,&data,(float)time);
		READY(Packet,2,3);
	}

	return TRUE;
}
boolean SetChanelValueFromPacket(BowlerPacket * Packet) {
    uint8_t pin = Packet->use.data[0];
    uint8_t mode = GetChannelMode(pin);

	int32_t data = 0;
	int32_t time = 0;

	data = get32bit(Packet, 1);

	time =  get32bit(Packet, 5);
	//println_W("Setting on pin=");p_int_W(pin); print_W(" value= ");p_int_W(data); print_W(" time= ");p_fl_W(time);
	if(mode == IS_SERVO)
		data = (data&0x000000ff) | (time<<16);

	if (setChanelValueHWPtr != NULL)
		setChanelValueHWPtr(pin, 1, &data, (float)time);

	//println_E(__FILE__);println_E("SetChanelValueFromPacket");
	setDataTableCurrentValue(pin,data);

    READY(Packet, 1, 3);
    return true;
}