예제 #1
0
/**
 * @brief Wrapper function for messages of type mlme_reset_conf_t
 *
 * This function is a callback for mlme reset confirm.
 *
 * @param m Pointer to message structure
 */
void mlme_reset_conf(uint8_t *m)
{
	mlme_reset_conf_t *pmsg;

	/* Get the buffer body from buffer header */
	pmsg = (mlme_reset_conf_t *)BMM_BUFFER_POINTER(((buffer_t *)m));

	usr_mlme_reset_conf(pmsg->status);

	/* Free the buffer */
	bmm_buffer_free((buffer_t *)m);
}
예제 #2
0
void handle_rx_frame(void)
{
	switch (*(rcv_frame_ptr + 1))  /* message type */
    {
        case MCPS_DATA_CONFIRM:
#if defined(ENABLE_TSTAMP)
			usr_mcps_data_conf(*(rcv_frame_ptr + 2), *(rcv_frame_ptr + 3),
							   *((uint32_t*)(rcv_frame_ptr + 4)));
#else
			usr_mcps_data_conf(*(rcv_frame_ptr + 2), *(rcv_frame_ptr + 3));
#endif  /* ENABLE_TSTAMP */
				break;

		case MCPS_DATA_INDICATION:
			usr_mcps_data_ind((wpan_addr_spec_t*)(rcv_frame_ptr + 2),
							  (wpan_addr_spec_t*)(rcv_frame_ptr + 2 + sizeof(wpan_addr_spec_t)),
							  *(rcv_frame_ptr + 8 + sizeof(wpan_addr_spec_t) + sizeof(wpan_addr_spec_t)),
							  (rcv_frame_ptr + 10 + sizeof(wpan_addr_spec_t) + sizeof(wpan_addr_spec_t)),
							  *(rcv_frame_ptr + 2 + sizeof(wpan_addr_spec_t) + sizeof(wpan_addr_spec_t)),
    #ifdef ENABLE_TSTAMP
							  *(rcv_frame_ptr + 3 + sizeof(wpan_addr_spec_t) + sizeof(wpan_addr_spec_t)),
							  *((uint32_t *)(rcv_frame_ptr + 4 + sizeof(wpan_addr_spec_t) + sizeof(wpan_addr_spec_t)))
    #else
							  *(rcv_frame_ptr + 3 + sizeof(wpan_addr_spec_t) + sizeof(wpan_addr_spec_t))
    #endif  /* ENABLE_TSTAMP */
                            );
				break;

        case MCPS_PURGE_CONFIRM:
#if ((MAC_PURGE_REQUEST_CONFIRM == 1) && (MAC_INDIRECT_DATA_BASIC == 1))
			usr_mcps_purge_conf(*(rcv_frame_ptr + 2), *(rcv_frame_ptr + 3));
#endif  /* ((MAC_PURGE_REQUEST_CONFIRM == 1) && (MAC_INDIRECT_DATA_BASIC == 1)) */
			break;

        case MLME_ASSOCIATE_INDICATION:
#if (MAC_ASSOCIATION_INDICATION_RESPONSE == 1)
			{
				uint64_t temp_var;
				memcpy(&temp_var, rcv_frame_ptr + 2, 8);
				usr_mlme_associate_ind(temp_var,
									   *(rcv_frame_ptr + 2 + sizeof(uint64_t)));
			}
#endif  /* (MAC_ASSOCIATION_INDICATION_RESPONSE == 1) */
			break;

        case MLME_ASSOCIATE_CONFIRM:
#if (MAC_ASSOCIATION_REQUEST_CONFIRM == 1)
			usr_mlme_associate_conf(*((uint16_t *)(rcv_frame_ptr + 2)),
									*(rcv_frame_ptr + 2 + sizeof(uint16_t)));
#endif  /* (MAC_ASSOCIATION_REQUEST_CONFIRM == 1) */
			break;

        case MLME_DISASSOCIATE_INDICATION:
#if (MAC_DISASSOCIATION_BASIC_SUPPORT == 1)
			{
				uint64_t temp_var;
				memcpy(&temp_var, rcv_frame_ptr + 2, 8);
				usr_mlme_disassociate_ind(temp_var,
										  *(rcv_frame_ptr + 2 + sizeof(uint64_t)));
			}
#endif  /* (MAC_DISASSOCIATION_BASIC_SUPPORT == 1) */
			break;

        case MLME_DISASSOCIATE_CONFIRM:
#if (MAC_DISASSOCIATION_BASIC_SUPPORT == 1)
			usr_mlme_disassociate_conf(*(rcv_frame_ptr + 2),
									  (wpan_addr_spec_t *)(rcv_frame_ptr + 3));
#endif /* (MAC_DISASSOCIATION_BASIC_SUPPORT == 1) */
			break;

        case MLME_BEACON_NOTIFY_INDICATION:
#if (MAC_BEACON_NOTIFY_INDICATION == 1)
			usr_mlme_beacon_notify_ind(*(rcv_frame_ptr + 2),
									   (wpan_pandescriptor_t *)(rcv_frame_ptr + 3),
									   *(rcv_frame_ptr + 3 + WPAN_DESCRIPTOR_LEN),
									   (rcv_frame_ptr + 4 + WPAN_DESCRIPTOR_LEN),
									   *(rcv_frame_ptr + 4 + WPAN_DESCRIPTOR_LEN),
									   (rcv_frame_ptr + 5 + WPAN_DESCRIPTOR_LEN));
#endif  /* (MAC_BEACON_NOTIFY_INDICATION == 1) */
			break;

        case MLME_ORPHAN_INDICATION:
#if (MAC_ORPHAN_INDICATION_RESPONSE == 1)
			{
				uint64_t temp_var;
				memcpy(&temp_var, rcv_frame_ptr + 2, 8);
				usr_mlme_orphan_ind(temp_var);
			}
#endif  /* (MAC_ORPHAN_INDICATION_RESPONSE == 1) */
			break;

        case MLME_SCAN_CONFIRM:
#if ((MAC_SCAN_ED_REQUEST_CONFIRM == 1)      || \
     (MAC_SCAN_ACTIVE_REQUEST_CONFIRM == 1)  || \
     (MAC_SCAN_PASSIVE_REQUEST_CONFIRM == 1) || \
     (MAC_SCAN_ORPHAN_REQUEST_CONFIRM == 1))
			usr_mlme_scan_conf(*(rcv_frame_ptr + 2),
                        *(rcv_frame_ptr + 3),
                        *(rcv_frame_ptr + 4),
                        *((uint32_t *)(rcv_frame_ptr + 5)),
                        *(rcv_frame_ptr + 5 + sizeof(uint32_t)),
                        (void *)((rcv_frame_ptr + 7 + sizeof(uint32_t))));
#endif
			break;

        case MLME_COMM_STATUS_INDICATION:
#if ((MAC_ORPHAN_INDICATION_RESPONSE == 1) || (MAC_ASSOCIATION_INDICATION_RESPONSE == 1))
			{
				wpan_addr_spec_t SrcAddrSpec;
				wpan_addr_spec_t DstAddrSpec;

				SrcAddrSpec.AddrMode = *(rcv_frame_ptr + 4);
				SrcAddrSpec.PANId = *(uint16_t *)(rcv_frame_ptr + 2);
				memcpy(&SrcAddrSpec.Addr, rcv_frame_ptr + 5, sizeof(address_field_t));

				DstAddrSpec.AddrMode = *(rcv_frame_ptr + 13);
				memcpy(&DstAddrSpec.Addr, rcv_frame_ptr + 14, sizeof(address_field_t));

				usr_mlme_comm_status_ind(&SrcAddrSpec, &DstAddrSpec,
								  *(rcv_frame_ptr + 22));
			}
#endif  /* ((MAC_ORPHAN_INDICATION_RESPONSE == 1) || (MAC_ASSOCIATION_INDICATION_RESPONSE == 1)) */
			break;

        case MLME_SYNC_LOSS_INDICATION:
			usr_mlme_sync_loss_ind(*(rcv_frame_ptr + 2),
                            *((uint16_t *)(rcv_frame_ptr + 3)),
                            *(rcv_frame_ptr + 3 + sizeof(uint16_t)),
                            *(rcv_frame_ptr + 4 + sizeof(uint16_t)));
			break;

        case MLME_GET_CONFIRM:
#if (MAC_GET_SUPPORT == 1)
			usr_mlme_get_conf(*(rcv_frame_ptr + 2),
							  *(rcv_frame_ptr + 3),
	                         (rcv_frame_ptr + 5));
#endif  /* (MAC_GET_SUPPORT == 1) */
			break;

        case MLME_SET_CONFIRM:
			usr_mlme_set_conf(*(rcv_frame_ptr + 2),
							  *(rcv_frame_ptr + 3));
			break;

        case MLME_RESET_CONFIRM:
			usr_mlme_reset_conf(*(rcv_frame_ptr + 2));
			break;

        case MLME_RX_ENABLE_CONFIRM:
#if (MAC_RX_ENABLE_SUPPORT == 1)
			usr_mlme_rx_enable_conf(*(rcv_frame_ptr + 2));
#endif  /* (MAC_RX_ENABLE_SUPPORT == 1) */
			break;

        case MLME_START_CONFIRM:
#if (MAC_START_REQUEST_CONFIRM == 1)
			usr_mlme_start_conf(*(rcv_frame_ptr + 2));
#endif  /* (MAC_START_REQUEST_CONFIRM == 1) */
			break;

        case MLME_POLL_CONFIRM:
#if (MAC_INDIRECT_DATA_BASIC == 1)
			usr_mlme_poll_conf(*(rcv_frame_ptr + 2));
#endif  /* (MAC_INDIRECT_DATA_BASIC == 1) */
			break;

		default:
		
			break;
	}
}