Myaddr

package com.demo.beans;

public class Myaddr {               //该类包含所有变量的属性(对应于数据库表的字段),和这些属性的set和get方法。
 private Integer id;            
 private String firstName;
 private String lastName;
 private String jobTitle;
 private String department;
 private Integer offph;
 private Integer mobile;
 private String email; 
 //以下分别是每个属性的set和get方法
 public String getDepartment() {
  return department;
 }
 public void setDepartment(String department) {
  this.department = department;
 }
 public String getEmail() {
  return email;
 }
 public void setEmail(String email) {
  this.email = email;
 }
 public String getFirstName() {
  return firstName;
 }
 public void setFirstName(String firstName) {
  this.firstName = firstName;
 }
 public Integer getId() {
  return id;
 }
 public void setId(Integer id) {
  this.id = id;
 }
 public String getJobTitle() {
  return jobTitle;
 }
 public void setJobTitle(String jobTitle) {
  this.jobTitle = jobTitle;
 }
 public String getLastName() {
  return lastName;
 }
 public void setLastName(String lastName) {
  this.lastName = lastName;
 }
 public Integer getMobile() {
  return mobile;
 }
 public void setMobile(Integer mobile) {
  this.mobile = mobile;
 }
 public Integer getOffph() {
  return offph;
 }
 public void setOffph(Integer offph) {
  this.offph = offph;
 }


 
 

}
 

#include <ioCC2530.h> #include <stdint.h> #include <stdio.h> #include <stdbool.h> // 定义引脚 #define D4 P1_0 #define D3 P1_2 #define D2 P1_1 // 定义常量 #define SUCCESS 1 #define FAILED 0 #define PAN_ID 0xABCD #define RF_CHANNEL 11 #define SECURITY_CCM 1 #define NODE_TYPE 1 // 1 表示发送节点,0 表示接收节点 #define SEND_ADDR 0x1234 #define RECV_ADDR 0x5678 #define key {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10} // 模拟库函数实现 void basicRfReceiveOff() { // 模拟关闭 RF 接收 } uint8_t basicRfSendPacket(uint16_t addr, uint8_t *data, uint8_t len) { // 模拟发送数据包 return SUCCESS; } void hal_led_on(uint8_t led) { // 模拟点亮 LED } void halMcuWaitMs(uint16_t ms) { // 模拟延时 } void hal_led_off(uint8_t led) { // 模拟熄灭 LED } void basicRfReceiveOn() { // 模拟打开 RF 接收器 } bool basicRfPacketIsReady() { // 模拟判断是否有数据包准备好 return true; } int basicRfReceive(uint8_t *data, uint8_t len, uint8_t *rssi) { // 模拟接收数据包 return 10; } void halMcuInit() { // 模拟 MCU 初始化 } void hal_led_init() { // 模拟 LED 初始化 } void hal_uart_init() { // 模拟 UART 初始化 } uint8_t halRfInit() { // 模拟 RF 初始化 return SUCCESS; } uint8_t basicRfInit(void *config) { // 模拟 RF 配置初始化 return SUCCESS; } void HAL_ASSERT(bool condition) { if (!condition) { // 模拟错误处理 } } void rfSendData(void) { uint8_t pTxData[] = {'H', 'e', 'l', 'l', 'o', ' ', 'c', 'c', '2', '5', '3', '0', '\r', '\n'}; uint8_t ret; basicRfReceiveOff(); // 关 RF 接收 while(1) { /*发送广播数据*/ printf("Send: %s", pTxData); ret = basicRfSendPacket(0xffff, pTxData, sizeof pTxData); /*如果发送成功,LED 亮 100ms,灭 900ms*/ if(ret == SUCCESS) { hal_led_on(1); halMcuWaitMs(100); hal_led_off(1); halMcuWaitMs(900); } /*如果发送失败,LED 亮 1s 后熄灭*/ else { hal_led_on(1); halMcuWaitMs(1000); hal_led_off(1); } } } void rfRecvData(void) { uint8_t pRxData[128]; // 定义接收数据缓冲区 int rlen; // 定义接收数据量变量 basicRfReceiveOn(); // 开 RF 接收器 while(1) { while(!basicRfPacketIsReady()); // 等待 RF 接收 rlen = basicRfReceive(pRxData, sizeof pRxData, NULL); // 开始 RF 接收 if(rlen > 0) // 输出接收信息 { pRxData[rlen] = 0; printf("My Address %u , recv:", RECV_ADDR); printf((char *)pRxData); } } } void main(void) { halMcuInit(); // MCU 初始化 hal_led_init(); // LED 初始化 hal_uart_init(); // Uart 初始化 if(FAILED == halRfInit()) // RF 初始化 { HAL_ASSERT(FALSE); // 错处处理 } /*RF 配置过程*/ struct { uint16_t panId; uint8_t channel; bool ackRequest; uint8_t securityKey[16]; uint16_t myAddr; } basicRfConfig; basicRfConfig.panId = PAN_ID; // 网络号 basicRfConfig.channel = RF_CHANNEL; // 信道值 basicRfConfig.ackRequest = true; // 应答位 #ifdef SECURITY_CCM // 安全密钥 for (int i = 0; i < 16; i++) { basicRfConfig.securityKey[i] = key[i]; } #endif #if NODE_TYPE // 根据节点类型确定节点地址 basicRfConfig.myAddr = SEND_ADDR; // 发送地址 #else basicRfConfig.myAddr = RECV_ADDR; // 接收地址 #endif if(basicRfInit(&basicRfConfig)==FAILED) // 写入 RF 配置 { HAL_ASSERT(FALSE); } #if NODE_TYPE // 根据节点类型收/发数据 rfSendData(); #else rfRecvData(); #endif }这段代码有什么现象
最新发布
09-18
#include <ioCC2530.h> #define D4 P1_0 #define D3 P1_2 #define D2 P1_1 #include <stdint.h> #include <stdio.h> #include <stdbool.h> void rfSendData(void) { uint8_t pTxData[] = {'H', 'e', 'l', 'l', 'o', ' ', 'c', 'c', '2', '5', '3', '0', '\r', '\n'}; uint8_t ret; basicRfReceiveOff(); // 关 RF 接收 while(1) { /*发送广播数据*/ printf("Send: %s", pTxData); ret = basicRfSendPacket(0xffff, pTxData, sizeof pTxData); /*如果发送成功,LED 亮 100ms,灭 900ms*/ if(ret == SUCCESS) { hal_led_on(1); halMcuWaitMs(100); hal_led_off(1); halMcuWaitMs(900); } /*如果发送失败,LED 亮 1s 后熄灭*/ else { hal_led_on(1); halMcuWaitMs(1000); hal_led_off(1); } } } void rfRecvData(void) { uint8_t pRxData[128]; // 定义接收数据缓冲区 int rlen; // 定义接收数据量变量 basicRfReceiveOn(); // 开 RF 接收器 while(1) { while(!basicRfPacketIsReady()); // 等待 RF 接收 rlen = basicRfReceive(pRxData, sizeof pRxData, NULL); // 开始 RF 接收 if(rlen > 0) // 输出接收信息 { pRxData[rlen] = 0; printf("My Address %u , recv:", RECV_ADDR); printf((char *)pRxData); } } void main(void) { halMcuInit(); // MCU 初始化 hal_led_init(); // LED 初始化 hal_uart_init(); // Uart 初始化 if(FAILED == halRfInit()) // RF 初始化 { HAL_ASSERT(FALSE); // 错处处理 } /*RF 配置过程*/ basicRfConfig.panId = PAN_ID; // 网络号 basicRfConfig.channel = RF_CHANNEL; // 信道值 basicRfConfig.ackRequest = TRUE; // 应答位 #ifdef SECURITY_CCM // 安全密钥 basicRfConfig.securityKey = key; #endif #if NODE_TYPE // 根据节点类型确定节点地址 basicRfConfig.myAddr = SEND_ADDR; // 发送地址 #else basicRfConfig.myAddr = RECV_ADDR; // 接收地址 #endif if(basicRfInit(&basicRfConfig)==FAILED) // 写入 RF 配置 { HAL_ASSERT(FALSE); } #if NODE_TYPE // 根据节点类型收/发数据 rfSendData(); #else rfRecvData(); #endif }这段代码缺少很多定义和库函数,给予补充
09-18
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值