📄 mt_nwk.s51
字号:
// 335 */
// 336 void nwk_MTCallbackSubDataConfirm(byte nsduHandle, ZStatus_t status )
// 337 {
// 338 byte buf[2];
// 339
// 340 buf[0] = nsduHandle;
// 341 buf[1] = (byte)status;
// 342
// 343 MT_BuildAndSendZToolCB( SPI_CB_NLDE_DATA_CNF, 2, buf );
// 344 }
// 345
// 346 /*********************************************************************
// 347 * @fn nwk_MTCallbackSubDataIndication
// 348 *
// 349 * @brief Process the callback subscription for NLDE-DATA.indication
// 350 *
// 351 * @param SrcAddress - 16 bit address
// 352 * @param nsduLength - Length of incoming data
// 353 * @param nsdu - Pointer to incoming data
// 354 * @param LinkQuality - Link quality measured during
// 355 * reception.
// 356 * @param SecuritySuite - Security Suite Applied
// 357 * @param SecurityStatus - MLDE_SUCCESS if security process
// 358 * successfull, MLDE_FAILURE if not.
// 359 *
// 360 * @return none
// 361 */
// 362 void nwk_MTCallbackSubDataIndication( uint16 SrcAddress, int16 nsduLength,
// 363 byte *nsdu, byte LinkQuality )
// 364 {
// 365 byte *msgPtr;
// 366 byte *msg;
// 367 byte msgLen;
// 368
// 369 msgLen = sizeof( uint16 ) + sizeof( uint8 ) + ZTEST_DEFAULT_DATA_LEN
// 370 + sizeof( byte);
// 371
// 372 msgPtr = osal_mem_alloc( msgLen );
// 373 if ( msgPtr )
// 374 {
// 375 //Fill up the data bytes
// 376 msg = msgPtr;
// 377
// 378 //First fill in details
// 379 *msg++ = HI_UINT16( SrcAddress );
// 380 *msg++ = LO_UINT16( SrcAddress );
// 381
// 382 //Since the max packet size is less than 255 bytes, a byte is enough
// 383 //to represent nsdu length
// 384 *msg++ = ( uint8 ) nsduLength;
// 385
// 386 osal_memset( msg, NULL, ZTEST_DEFAULT_DATA_LEN ); // Clear the mem
// 387 osal_memcpy( msg, nsdu, nsduLength );
// 388 msg += ZTEST_DEFAULT_DATA_LEN;
// 389
// 390 *msg++ = LinkQuality;
// 391
// 392 MT_BuildAndSendZToolCB( SPI_CB_NLDE_DATA_IND, msgLen, msgPtr );
// 393
// 394 osal_mem_free( msgPtr );
// 395 }
// 396 }
// 397
// 398 /*********************************************************************
// 399 * @fn nwk_MTCallbackSubInitCoordConfirm
// 400 *
// 401 * @brief Process the callback subscription for NLME-INIT-COORD.confirm
// 402 *
// 403 * @param Status - Result of NLME_InitCoordinatorRequest()
// 404 *
// 405 * @return none
// 406 */
// 407 void nwk_MTCallbackSubInitCoordConfirm( ZStatus_t Status )
// 408 {
// 409 #if defined( ZDO_COORDINATOR )
// 410 MT_BuildAndSendZToolCB( SPI_CB_NLME_INITCOORD_CNF,
// 411 sizeof( byte ), (byte*)&Status );
// 412 #endif // ZDO_COORDINATOR
// 413 }
// 414
// 415 /*********************************************************************
// 416 * @fn nwk_MTCallbackSubStartRouterConfirm
// 417 *
// 418 * @brief Process the callback subscription for NLME-START-ROUTER.confirm
// 419 *
// 420 * @param Status - Result of NLME_StartRouterRequest()
// 421 *
// 422 * @return none
// 423 */
// 424 void nwk_MTCallbackSubStartRouterConfirm( ZStatus_t Status )
// 425 {
// 426 MT_BuildAndSendZToolCB( SPI_CB_NLME_START_ROUTER_CNF,
// 427 sizeof( byte ), (byte*)&Status );
// 428 }
// 429
// 430 /*********************************************************************
// 431 * @fn nwk_MTCallbackSubJoinConfirm
// 432 *
// 433 * @brief Process the callback subscription for NLME-JOIN.confirm
// 434 *
// 435 * @param Status - Result of NLME_JoinRequest()
// 436 *
// 437 * @return none
// 438 */
// 439 void nwk_MTCallbackSubJoinConfirm( uint16 PanId, ZStatus_t Status )
// 440 {
// 441 byte msg[Z_EXTADDR_LEN + 3];
// 442
// 443 // This device's 64-bit address
// 444 ZMacGetReq( ZMacExtAddr, msg );
// 445 MT_ReverseBytes( msg, Z_EXTADDR_LEN );
// 446
// 447 msg[Z_EXTADDR_LEN + 0] = HI_UINT16( PanId );
// 448 msg[Z_EXTADDR_LEN + 1] = LO_UINT16( PanId );
// 449 msg[Z_EXTADDR_LEN + 2] = (byte)Status;
// 450
// 451 MT_BuildAndSendZToolCB( SPI_CB_NLME_JOIN_CNF, Z_EXTADDR_LEN + 3, msg );
// 452 }
// 453 /*********************************************************************
// 454 * @fn nwk_MTCallbackSubNetworkDiscoveryConfirm
// 455 *
// 456 * @brief Process the callback subscription for NLME-NWK_DISC.confirm
// 457 *
// 458 * @param ResultCount - number of networks discovered
// 459 * @param NetworkList - pointer to list of network descriptors
// 460 *
// 461 * @return void
// 462 */
// 463 void nwk_MTCallbackSubNetworkDiscoveryConfirm( byte ResultCount, networkDesc_t *NetworkList )
// 464 {
// 465 byte len;
// 466 byte *msgPtr;
// 467 byte *msg;
// 468 byte i;
// 469
// 470 // The message cannot be bigger then SPI_TX_BUFF_MAX. Reduce resultCount if necessary
// 471 if (ResultCount * sizeof(networkDesc_t) > SPI_TX_BUFF_MAX - (1 + SPI_0DATA_MSG_LEN))
// 472 {
// 473 ResultCount = (SPI_TX_BUFF_MAX - (1 + SPI_0DATA_MSG_LEN)) / sizeof(networkDesc_t);
// 474 }
// 475
// 476 len = 1 + ResultCount * sizeof(networkDesc_t);
// 477 msgPtr = osal_mem_alloc( len );
// 478 if ( msgPtr )
// 479 {
// 480 //Fill up the data bytes
// 481 msg = msgPtr;
// 482
// 483 *msg++ = ResultCount;
// 484
// 485 for ( i = 0; i < ResultCount; i++ )
// 486 {
// 487 *msg++ = HI_UINT16( NetworkList->panId );
// 488 *msg++ = LO_UINT16( NetworkList->panId );
// 489 *msg++ = NetworkList->logicalChannel;
// 490 *msg++ = NetworkList->beaconOrder;
// 491 *msg++ = NetworkList->superFrameOrder;
// 492 *msg++ = NetworkList->routerCapacity;
// 493 *msg++ = NetworkList->deviceCapacity;
// 494 *msg++ = NetworkList->version;
// 495 *msg++ = NetworkList->stackProfile;
// 496 //*msg++ = NetworkList->securityLevel;
// 497
// 498 NetworkList = (networkDesc_t*)NetworkList->nextDesc;
// 499 }
// 500
// 501 MT_BuildAndSendZToolCB( SPI_CB_NLME_NWK_DISC_CNF, len, msgPtr );
// 502
// 503 osal_mem_free( msgPtr );
// 504 }
// 505 }
// 506 /*********************************************************************
// 507 * @fn nwk_MTCallbackSubJoinIndication
// 508 *
// 509 * @brief Process the callback subscription for NLME-INIT-COORD.indication
// 510 *
// 511 * @param ShortAddress - 16-bit address
// 512 * @param ExtendedAddress - IEEE (64-bit) address
// 513 * @param CapabilityInformation - Association Capability Information
// 514 *
// 515 * @return ZStatus_t
// 516 */
// 517 void nwk_MTCallbackSubJoinIndication( uint16 ShortAddress, byte *ExtendedAddress,
// 518 byte CapabilityInformation )
// 519 {
// 520 byte *msgPtr;
// 521 byte *msg;
// 522 byte len;
// 523
// 524 len = sizeof( uint16 ) + Z_EXTADDR_LEN + sizeof( byte );
// 525 msgPtr = osal_mem_alloc( len );
// 526
// 527 if ( msgPtr )
// 528 {
// 529 //Fill up the data bytes
// 530 msg = msgPtr;
// 531
// 532 //First fill in details
// 533 *msg++ = HI_UINT16( ShortAddress );
// 534 *msg++ = LO_UINT16( ShortAddress );
// 535
// 536 osal_cpyExtAddr( msg, ExtendedAddress );
// 537 MT_ReverseBytes( msg, Z_EXTADDR_LEN );
// 538 msg += Z_EXTADDR_LEN;
// 539
// 540 *msg = CapabilityInformation;
// 541
// 542 MT_BuildAndSendZToolCB( SPI_CB_NLME_JOIN_IND, len, msgPtr );
// 543
// 544 osal_mem_free( msgPtr );
// 545 }
// 546 }
// 547
// 548 /*********************************************************************
// 549 * @fn nwk_MTCallbackSubLeaveConfirm
// 550 *
// 551 * @brief Process the callback subscription for NLME-LEAVE.confirm
// 552 *
// 553 * @param DeviceAddress - IEEE (64-bit) address
// 554 * @param Status - Result of NLME_LeaveRequest()
// 555 *
// 556 * @return none
// 557 */
// 558 void nwk_MTCallbackSubLeaveConfirm( byte *DeviceAddress, ZStatus_t Status )
// 559 {
// 560 byte *msgPtr;
// 561 byte *msg;
// 562
// 563 msgPtr = osal_mem_alloc( Z_EXTADDR_LEN + sizeof( byte ) );
// 564 if ( msgPtr )
// 565 {
// 566 //Fill up the data bytes
// 567 msg = msgPtr;
// 568
// 569 //First fill in details
// 570 osal_cpyExtAddr( msg, DeviceAddress );
// 571 MT_ReverseBytes( msg, Z_EXTADDR_LEN );
// 572 msg += Z_EXTADDR_LEN;
// 573
// 574 *msg = (byte)Status;
// 575
// 576 MT_BuildAndSendZToolCB( SPI_CB_NLME_LEAVE_CNF,
// 577 Z_EXTADDR_LEN + sizeof( byte ), msgPtr );
// 578
// 579 osal_mem_free( msgPtr );
// 580 }
// 581 }
// 582 /*********************************************************************
// 583 * @fn nwk_MTCallbackSubLeaveIndication
// 584 *
// 585 * @brief Process the callback subscription for NLME-LEAVE.indication
// 586 *
// 587 * @param DeviceAddress - IEEE (64-bit) address
// 588 *
// 589 * @return NULL
// 590 */
// 591 void nwk_MTCallbackSubLeaveIndication( byte *DeviceAddress )
// 592 {
// 593 byte msg[Z_EXTADDR_LEN+1];
// 594
// 595 //First fill in details
// 596 if ( DeviceAddress )
// 597 {
// 598 osal_cpyExtAddr( msg, DeviceAddress );
// 599 MT_ReverseBytes( msg, Z_EXTADDR_LEN );
// 600 }
// 601 else
// 602 osal_memset( msg, 0, Z_EXTADDR_LEN );
// 603 msg[Z_EXTADDR_LEN] = 0; // Status, assume good if we get this far
// 604
// 605 MT_BuildAndSendZToolCB( SPI_CB_NLME_LEAVE_IND, Z_EXTADDR_LEN+1, msg );
// 606 }
// 607 /*********************************************************************
// 608 * @fn nwk_MTCallbackSubSyncIndication
// 609 *
// 610 * @brief Process the callback subscription for NLME-SYNC.indication
// 611 *
// 612 * @param none
// 613 *
// 614 * @return none
// 615 */
// 616 void nwk_MTCallbackSubSyncIndication( void )
// 617 {
// 618 MT_BuildAndSendZToolCB( SPI_CB_NLME_SYNC_IND, 0, NULL );
// 619 }
// 620
// 621 /*********************************************************************
// 622 * @fn nwk_MTCallbackSubPollConfirm
// 623 *
// 624 * @brief Process the callback subscription for NLME-POLL.confirm
// 625 *
// 626 * @param status - status of the poll operation
// 627 *
// 628 * @return none
// 629 */
// 630 void nwk_MTCallbackSubPollConfirm( byte status )
// 631 {
// 632 byte msg = status;
// 633 MT_BuildAndSendZToolCB( SPI_CB_NLME_POLL_CNF, 1, &msg );
// 634 }
// 635
// 636 #endif /*NWK Callback commands*/
// 637
// 638 /*********************************************************************
// 639 *********************************************************************/
// 640
//
// 40 bytes in segment BANKED_CODE
// 2 bytes in segment XDATA_Z
//
// 40 bytes of CODE memory
// 2 bytes of XDATA memory
//
//Errors: none
//Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -