コード例 #1
0
ファイル: datalink.c プロジェクト: TemcoEvan/T3-Modules
void datalink_get_my_address ( BACNET_ADDRESS * my_address,uint8_t protocal)
{
	if(protocal == BAC_MSTP || protocal == BAC_PTP)
	{
		dlmstp_get_my_address(my_address);
	}
//	else if((protocal == BAC_IP) ||(protocal == BAC_GSM))
//	{
//		bip_get_my_address(my_address);
//	}
	

	
}
コード例 #2
0
ファイル: dlmstp.c プロジェクト: Jongil-Park/Lin_PRJ
/* returns number of bytes sent on success, zero on failure */
int dlmstp_send_pdu(
    BACNET_ADDRESS * dest,      /* destination address */
    BACNET_NPDU_DATA * npdu_data,       /* network information */
    uint8_t * pdu,      /* any data to be sent - may be null */
    unsigned pdu_len)
{       /* number of bytes of data */
    int bytes_sent = 0;
    unsigned npdu_len = 0;
    uint8_t frame_type = 0;
    uint8_t destination = 0;    /* destination address */
    BACNET_ADDRESS src;
    unsigned i = 0;     /* loop counter */

    if (MSTP_Port.TxReady == false) {
        if (npdu_data->data_expecting_reply)
            MSTP_Port.TxFrameType = FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY;
        else
            MSTP_Port.TxFrameType = FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY;

        /* load destination MAC address */
        if (dest && dest->mac_len == 1) {
            destination = dest->mac[0];
        } else {
            return -2;
        }
        dlmstp_get_my_address(&src);
        if ((MAX_HEADER + pdu_len) > MAX_MPDU) {
            return -4;
        }
        bytes_sent =
            MSTP_Create_Frame((uint8_t *) & MSTP_Port.TxBuffer[0],
            sizeof(MSTP_Port.TxBuffer), MSTP_Port.TxFrameType, destination,
            MSTP_Port.This_Station, pdu, pdu_len);
        MSTP_Port.TxLength = bytes_sent;
        MSTP_Port.TxReady = true;
        MSTP_Packets++;
    }

    return bytes_sent;
}