rawmsg.m

来自「这是无线传感器网络用的操作系统tinyos-1.1.0,未来的世界将是它呵」· M 代码 · 共 24 行

M
24
字号
function msg = rawMsg( am, data_bytes )%RAWMSG  Create a TOSMsg with the given AM and data_bytes as body%%   msg = rawMsg( am, data_bytes );%%   Example: Create message to turn on motes:%      msg = rawMsg( 249, [1 0] );%%   Example: Oh, you want to haul off and send it, do you? fine:%      msg = send( 65535, rawMsg( 249, [1 0] ), 'localhost:9000' );if nargin ~= 2  error 'wrong number of arguments. usage: rawMsg(am,bytes)';enddata_bytes = min( data_bytes, 255 );data_bytes(data_bytes>127) = data_bytes(data_bytes>127) - 256;msg = net.tinyos.message.TOSMsg;msg.set_type( am );msg.set_data( int8(data_bytes) );msg.set_length( length(data_bytes) );

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?