boolean GetChanelValueFromPacket(BowlerPacket * Packet) {
    uint8_t pin = Packet->use.data[0];
    uint8_t mode = GetChannelMode(pin);
    uint8_t numValues = 1;
    int32_t data;


	if (getChanelValueHWPtr != NULL) {
		getChanelValueHWPtr(pin,
				&numValues,
				&data);
	} else {
		return false;
	}
	if(isOutputMode(GetChannelMode(pin))==false ){
		setDataTableCurrentValue(pin,data);
	}else{
		if(mode== IS_UART_RX){
			setDataTableCurrentValue(pin,data);
		}else{
			data = getBcsIoDataTable(pin)->PIN.currentValue;
		}
	}

	set32bit(Packet, data, 1);
	numValues = 4;

    Packet->use.head.DataLegnth = 4 + 1 + numValues;
    FixPacket(Packet);
    return true;
}
BOOL GetChanelValueFromPacket(BowlerPacket * Packet){
	BYTE pin = Packet->use.data[0];
	BYTE mode = GetChannelMode(pin);
	BYTE numValues;
	if(isStremChannelMode(mode)){

		if(getChanelValueHWPtr!=NULL){
			// Load the data directly into the packet as the buffer
			//Data pointer is offset by one to start after the pin index
			getChanelValueHWPtr(pin,
								&numValues,
								(INT32 *)(Packet->use.data+1));
		}else{
			return FALSE;
		}
	}else{
		INT32 data;
		if(getChanelValueHWPtr!=NULL){
			getChanelValueHWPtr(pin,
								&numValues,
								&data);
		}else{
			return FALSE;
		}
		if(isSingleByteMode(mode)){
			set8bit(Packet,data, 1);
			numValues=1;
		}else if(isTwoByteMode(mode)){
			set16bit(Packet,data, 1);
			numValues=2;
		}else{
			set32bit(Packet,data, 1);
			numValues=4;
		}

	}
	Packet->use.head.DataLegnth = 4+1+numValues;
	FixPacket(Packet);
	return TRUE;
}