diff --git a/examples/wifi_csma.grc b/examples/wifi_csma.grc
new file mode 100644
index 0000000..2a52771
--- /dev/null
+++ b/examples/wifi_csma.grc
@@ -0,0 +1,1436 @@
+
+
+ Thu May 8 14:28:40 2014
+
+ options
+
+ id
+ wifi_csma
+
+
+ _enabled
+ True
+
+
+ title
+
+
+
+ author
+
+
+
+ description
+
+
+
+ window_size
+ 1280, 1024
+
+
+ generate_options
+ wx_gui
+
+
+ category
+ Custom
+
+
+ run_options
+ run
+
+
+ run
+ True
+
+
+ max_nouts
+ 0
+
+
+ realtime_scheduling
+
+
+
+ _coordinate
+ (56, 8)
+
+
+ _rotation
+ 0
+
+
+
+ variable_slider
+
+ id
+ gain
+
+
+ _enabled
+ True
+
+
+ label
+
+
+
+ value
+ 25
+
+
+ min
+ 0
+
+
+ max
+ 100
+
+
+ num_steps
+ 100
+
+
+ style
+ wx.SL_HORIZONTAL
+
+
+ converver
+ float_converter
+
+
+ grid_pos
+
+
+
+ notebook
+
+
+
+ _coordinate
+ (291, 12)
+
+
+ _rotation
+ 0
+
+
+
+ variable_chooser
+
+ id
+ encoding
+
+
+ _enabled
+ True
+
+
+ label
+ Encoding
+
+
+ value
+ 0
+
+
+ choices
+ [0,1,2,3,4,5,6,7]
+
+
+ labels
+ ["BPSK 1/2", "BPSK 3/4", "QPSK 1/2", "QPSK 3/4", "16QAM 1/2", "16QAM 3/4", "64QAM 2/3", "64QAM 3/4"]
+
+
+ type
+ radio_buttons
+
+
+ style
+ wx.RA_HORIZONTAL
+
+
+ grid_pos
+
+
+
+ notebook
+
+
+
+ _coordinate
+ (780, 17)
+
+
+ _rotation
+ 0
+
+
+
+ variable_chooser
+
+ id
+ lo_offset
+
+
+ _enabled
+ True
+
+
+ label
+ LO Offset
+
+
+ value
+ 6e9
+
+
+ choices
+ [0, 6e9, 11e9]
+
+
+ labels
+ ['0 MHz', '6 MHz', '11 MHz']
+
+
+ type
+ drop_down
+
+
+ style
+ wx.RA_HORIZONTAL
+
+
+ grid_pos
+
+
+
+ notebook
+
+
+
+ _coordinate
+ (697, 165)
+
+
+ _rotation
+ 0
+
+
+
+ variable_chooser
+
+ id
+ freq
+
+
+ _enabled
+ True
+
+
+ label
+ Channel
+
+
+ value
+ 5.89e9
+
+
+ choices
+ [2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0, 2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0, 2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0, 2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0, 5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0, 5230000000.0, 5240000000.0, 5260000000.0, 5280000000.0, 5300000000.0, 5320000000.0, 5500000000.0, 5520000000.0, 5540000000.0, 5560000000.0, 5580000000.0, 5600000000.0, 5620000000.0, 5640000000.0, 5660000000.0, 5680000000.0, 5700000000.0, 5745000000.0, 5765000000.0, 5785000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0]
+
+
+ labels
+ [' 1 | 2412.0 | 11g', ' 2 | 2417.0 | 11g', ' 3 | 2422.0 | 11g', ' 4 | 2427.0 | 11g', ' 5 | 2432.0 | 11g', ' 6 | 2437.0 | 11g', ' 7 | 2442.0 | 11g', ' 8 | 2447.0 | 11g', ' 9 | 2452.0 | 11g', ' 10 | 2457.0 | 11g', ' 11 | 2462.0 | 11g', ' 12 | 2467.0 | 11g', ' 13 | 2472.0 | 11g', ' 14 | 2484.0 | 11g', ' 34 | 5170.0 | 11a', ' 36 | 5180.0 | 11a', ' 38 | 5190.0 | 11a', ' 40 | 5200.0 | 11a', ' 42 | 5210.0 | 11a', ' 44 | 5220.0 | 11a', ' 46 | 5230.0 | 11a', ' 48 | 5240.0 | 11a', ' 52 | 5260.0 | 11a', ' 56 | 5280.0 | 11a', ' 58 | 5300.0 | 11a', ' 60 | 5320.0 | 11a', '100 | 5500.0 | 11a', '104 | 5520.0 | 11a', '108 | 5540.0 | 11a', '112 | 5560.0 | 11a', '116 | 5580.0 | 11a', '120 | 5600.0 | 11a', '124 | 5620.0 | 11a', '128 | 5640.0 | 11a', '132 | 5660.0 | 11a', '136 | 5680.0 | 11a', '140 | 5700.0 | 11a', '149 | 5745.0 | 11a', '153 | 5765.0 | 11a', '157 | 5785.0 | 11a', '161 | 5805.0 | 11a', '165 | 5825.0 | 11a', '172 | 5860.0 | 11p', '174 | 5870.0 | 11p', '176 | 5880.0 | 11p', '178 | 5890.0 | 11p', '180 | 5900.0 | 11p', '182 | 5910.0 | 11p', '184 | 5920.0 | 11p']
+
+
+ type
+ drop_down
+
+
+ style
+ wx.RA_HORIZONTAL
+
+
+ grid_pos
+
+
+
+ notebook
+
+
+
+ _coordinate
+ (419, 11)
+
+
+ _rotation
+ 0
+
+
+
+ variable_slider
+
+ id
+ mult
+
+
+ _enabled
+ True
+
+
+ label
+
+
+
+ value
+ .38
+
+
+ min
+ 0
+
+
+ max
+ 2
+
+
+ num_steps
+ 100
+
+
+ style
+ wx.SL_HORIZONTAL
+
+
+ converver
+ float_converter
+
+
+ grid_pos
+
+
+
+ notebook
+
+
+
+ _coordinate
+ (979, 10)
+
+
+ _rotation
+ 0
+
+
+
+ variable_chooser
+
+ id
+ samp_rate
+
+
+ _enabled
+ True
+
+
+ label
+ Sample Rate
+
+
+ value
+ 10e6
+
+
+ choices
+ [10e6, 20e6]
+
+
+ labels
+ ["10 Mhz", "20 Mhz"]
+
+
+ type
+ radio_buttons
+
+
+ style
+ wx.RA_HORIZONTAL
+
+
+ grid_pos
+
+
+
+ notebook
+
+
+
+ _coordinate
+ (629, 14)
+
+
+ _rotation
+ 0
+
+
+
+ uhd_usrp_sink
+
+ id
+ uhd_usrp_sink_0
+
+
+ _enabled
+ True
+
+
+ type
+ fc32
+
+
+ otw
+
+
+
+ stream_args
+
+
+
+ stream_chans
+ []
+
+
+ dev_addr
+
+
+
+ sync
+ pc_clock
+
+
+ clock_rate
+ 0.0
+
+
+ num_mboards
+ 1
+
+
+ clock_source0
+
+
+
+ time_source0
+
+
+
+ sd_spec0
+
+
+
+ clock_source1
+
+
+
+ time_source1
+
+
+
+ sd_spec1
+
+
+
+ clock_source2
+
+
+
+ time_source2
+
+
+
+ sd_spec2
+
+
+
+ clock_source3
+
+
+
+ time_source3
+
+
+
+ sd_spec3
+
+
+
+ clock_source4
+
+
+
+ time_source4
+
+
+
+ sd_spec4
+
+
+
+ clock_source5
+
+
+
+ time_source5
+
+
+
+ sd_spec5
+
+
+
+ clock_source6
+
+
+
+ time_source6
+
+
+
+ sd_spec6
+
+
+
+ clock_source7
+
+
+
+ time_source7
+
+
+
+ sd_spec7
+
+
+
+ nchan
+ 1
+
+
+ samp_rate
+ samp_rate
+
+
+ center_freq0
+ uhd.tune_request(freq - lo_offset, lo_offset)
+
+
+ gain0
+ gain
+
+
+ ant0
+
+
+
+ bw0
+ 0
+
+
+ center_freq1
+ 0
+
+
+ gain1
+ 0
+
+
+ ant1
+
+
+
+ bw1
+ 0
+
+
+ center_freq2
+ 0
+
+
+ gain2
+ 0
+
+
+ ant2
+
+
+
+ bw2
+ 0
+
+
+ center_freq3
+ 0
+
+
+ gain3
+ 0
+
+
+ ant3
+
+
+
+ bw3
+ 0
+
+
+ center_freq4
+ 0
+
+
+ gain4
+ 0
+
+
+ ant4
+
+
+
+ bw4
+ 0
+
+
+ center_freq5
+ 0
+
+
+ gain5
+ 0
+
+
+ ant5
+
+
+
+ bw5
+ 0
+
+
+ center_freq6
+ 0
+
+
+ gain6
+ 0
+
+
+ ant6
+
+
+
+ bw6
+ 0
+
+
+ center_freq7
+ 0
+
+
+ gain7
+ 0
+
+
+ ant7
+
+
+
+ bw7
+ 0
+
+
+ center_freq8
+ 0
+
+
+ gain8
+ 0
+
+
+ ant8
+
+
+
+ bw8
+ 0
+
+
+ center_freq9
+ 0
+
+
+ gain9
+ 0
+
+
+ ant9
+
+
+
+ bw9
+ 0
+
+
+ center_freq10
+ 0
+
+
+ gain10
+ 0
+
+
+ ant10
+
+
+
+ bw10
+ 0
+
+
+ center_freq11
+ 0
+
+
+ gain11
+ 0
+
+
+ ant11
+
+
+
+ bw11
+ 0
+
+
+ center_freq12
+ 0
+
+
+ gain12
+ 0
+
+
+ ant12
+
+
+
+ bw12
+ 0
+
+
+ center_freq13
+ 0
+
+
+ gain13
+ 0
+
+
+ ant13
+
+
+
+ bw13
+ 0
+
+
+ center_freq14
+ 0
+
+
+ gain14
+ 0
+
+
+ ant14
+
+
+
+ bw14
+ 0
+
+
+ center_freq15
+ 0
+
+
+ gain15
+ 0
+
+
+ ant15
+
+
+
+ bw15
+ 0
+
+
+ center_freq16
+ 0
+
+
+ gain16
+ 0
+
+
+ ant16
+
+
+
+ bw16
+ 0
+
+
+ center_freq17
+ 0
+
+
+ gain17
+ 0
+
+
+ ant17
+
+
+
+ bw17
+ 0
+
+
+ center_freq18
+ 0
+
+
+ gain18
+ 0
+
+
+ ant18
+
+
+
+ bw18
+ 0
+
+
+ center_freq19
+ 0
+
+
+ gain19
+ 0
+
+
+ ant19
+
+
+
+ bw19
+ 0
+
+
+ center_freq20
+ 0
+
+
+ gain20
+ 0
+
+
+ ant20
+
+
+
+ bw20
+ 0
+
+
+ center_freq21
+ 0
+
+
+ gain21
+ 0
+
+
+ ant21
+
+
+
+ bw21
+ 0
+
+
+ center_freq22
+ 0
+
+
+ gain22
+ 0
+
+
+ ant22
+
+
+
+ bw22
+ 0
+
+
+ center_freq23
+ 0
+
+
+ gain23
+ 0
+
+
+ ant23
+
+
+
+ bw23
+ 0
+
+
+ center_freq24
+ 0
+
+
+ gain24
+ 0
+
+
+ ant24
+
+
+
+ bw24
+ 0
+
+
+ center_freq25
+ 0
+
+
+ gain25
+ 0
+
+
+ ant25
+
+
+
+ bw25
+ 0
+
+
+ center_freq26
+ 0
+
+
+ gain26
+ 0
+
+
+ ant26
+
+
+
+ bw26
+ 0
+
+
+ center_freq27
+ 0
+
+
+ gain27
+ 0
+
+
+ ant27
+
+
+
+ bw27
+ 0
+
+
+ center_freq28
+ 0
+
+
+ gain28
+ 0
+
+
+ ant28
+
+
+
+ bw28
+ 0
+
+
+ center_freq29
+ 0
+
+
+ gain29
+ 0
+
+
+ ant29
+
+
+
+ bw29
+ 0
+
+
+ center_freq30
+ 0
+
+
+ gain30
+ 0
+
+
+ ant30
+
+
+
+ bw30
+ 0
+
+
+ center_freq31
+ 0
+
+
+ gain31
+ 0
+
+
+ ant31
+
+
+
+ bw31
+ 0
+
+
+ len_tag_name
+
+
+
+ affinity
+
+
+
+ _coordinate
+ (274, 420)
+
+
+ _rotation
+ 0
+
+
+
+ foo_packet_pad2
+
+ id
+ foo_packet_pad2_0
+
+
+ _enabled
+ True
+
+
+ debug
+ False
+
+
+ delay
+ False
+
+
+ delay_sec
+ 0.01
+
+
+ pad_front
+ 0
+
+
+ pad_tail
+ 10000
+
+
+ affinity
+
+
+
+ minoutbuf
+ 100000
+
+
+ maxoutbuf
+ 0
+
+
+ _coordinate
+ (85, 420)
+
+
+ _rotation
+ 0
+
+
+
+ wifi_phy_hier
+
+ id
+ wifi_phy_hier_0
+
+
+ _enabled
+ True
+
+
+ encoding
+ encoding
+
+
+ affinity
+
+
+
+ minoutbuf
+ 0
+
+
+ maxoutbuf
+ 0
+
+
+ _coordinate
+ (461, 299)
+
+
+ _rotation
+ 180
+
+
+
+ blocks_null_source
+
+ id
+ blocks_null_source_0
+
+
+ _enabled
+ True
+
+
+ type
+ complex
+
+
+ vlen
+ 1
+
+
+ num_outputs
+ 1
+
+
+ bus_conns
+ [[0,],]
+
+
+ affinity
+
+
+
+ minoutbuf
+ 0
+
+
+ maxoutbuf
+ 0
+
+
+ _coordinate
+ (668, 333)
+
+
+ _rotation
+ 180
+
+
+
+ blocks_multiply_const_vxx
+
+ id
+ blocks_multiply_const_vxx_0
+
+
+ _enabled
+ True
+
+
+ type
+ complex
+
+
+ const
+ mult
+
+
+ vlen
+ 1
+
+
+ affinity
+
+
+
+ minoutbuf
+ 0
+
+
+ maxoutbuf
+ 0
+
+
+ _coordinate
+ (231, 329)
+
+
+ _rotation
+ 180
+
+
+
+ blocks_socket_pdu
+
+ id
+ blocks_socket_pdu_0
+
+
+ _enabled
+ True
+
+
+ type
+ "UDP_SERVER"
+
+
+ host
+
+
+
+ port
+ 52001
+
+
+ mtu
+ 10000
+
+
+ tcp_no_delay
+ False
+
+
+ affinity
+
+
+
+ minoutbuf
+ 0
+
+
+ maxoutbuf
+ 0
+
+
+ _coordinate
+ (151, 227)
+
+
+ _rotation
+ 0
+
+
+
+ ieee802_11_ofdm_mac
+
+ id
+ ieee802_11_ofdm_mac_0
+
+
+ _enabled
+ True
+
+
+ affinity
+
+
+
+ minoutbuf
+ 0
+
+
+ maxoutbuf
+ 0
+
+
+ _coordinate
+ (465, 191)
+
+
+ _rotation
+ 0
+
+
+
+ blocks_message_strobe
+
+ id
+ blocks_message_strobe_0
+
+
+ _enabled
+ True
+
+
+ msg
+ pmt.intern(" Hello World")
+
+
+ period
+ 300
+
+
+ affinity
+
+
+
+ minoutbuf
+ 0
+
+
+ maxoutbuf
+ 0
+
+
+ _coordinate
+ (17, 147)
+
+
+ _rotation
+ 0
+
+
+
+ ieee802_11_wifi_edca
+
+ id
+ ieee802_11_wifi_edca_0
+
+
+ _enabled
+ True
+
+
+ cw_min
+ [15, 15, 7, 3]
+
+
+ aifsn
+ [9, 6, 3, 2]
+
+
+ affinity
+
+
+
+ minoutbuf
+ 0
+
+
+ maxoutbuf
+ 0
+
+
+ _coordinate
+ (229, 87)
+
+
+ _rotation
+ 0
+
+
+
+ foo_packet_pad2_0
+ uhd_usrp_sink_0
+ 0
+ 0
+
+
+ wifi_phy_hier_0
+ blocks_multiply_const_vxx_0
+ 0
+ 0
+
+
+ blocks_multiply_const_vxx_0
+ foo_packet_pad2_0
+ 0
+ 0
+
+
+ ieee802_11_ofdm_mac_0
+ wifi_phy_hier_0
+ phy out
+ mac_in
+
+
+ wifi_phy_hier_0
+ ieee802_11_ofdm_mac_0
+ mac_out
+ phy in
+
+
+ blocks_null_source_0
+ wifi_phy_hier_0
+ 0
+ 0
+
+
+ ieee802_11_wifi_edca_0
+ ieee802_11_ofdm_mac_0
+ mac out
+ app in
+
+
+ blocks_message_strobe_0
+ ieee802_11_wifi_edca_0
+ strobe
+ ac in1
+
+
diff --git a/grc/ieee802_11_wifi_edca.xml b/grc/ieee802_11_wifi_edca.xml
new file mode 100644
index 0000000..6f8c47a
--- /dev/null
+++ b/grc/ieee802_11_wifi_edca.xml
@@ -0,0 +1,37 @@
+
+
+
+ WiFi EDCA
+ ieee802_11_wifi_edca
+ IEEE802.11
+ import ieee802_11
+ ieee802_11.wifi_edca($cw_min, $aifsn)
+
+
+ CW min
+ cw_min
+ [15, 15, 7, 3]
+ int_vector
+
+
+
+ AIFSN [slots]
+ aifsn
+ [9, 6, 3, 2]
+ int_vector
+
+
+ len($cw_min) == len($aifsn)
+
+
+ ac in
+ message
+ len($cw_min)
+ 1
+
+
+
+ mac out
+ message
+
+
diff --git a/include/ieee802-11/CMakeLists.txt b/include/ieee802-11/CMakeLists.txt
index f4492dd..02a70c7 100644
--- a/include/ieee802-11/CMakeLists.txt
+++ b/include/ieee802-11/CMakeLists.txt
@@ -81,6 +81,7 @@ list(APPEND include_sources
ofdm_preamble.h
ofdm_sync_long.h
ofdm_sync_short.h
+ wifi_edca.h
wifi_signal_field.h
)
diff --git a/include/ieee802-11/wifi_edca.h b/include/ieee802-11/wifi_edca.h
new file mode 100644
index 0000000..0d32844
--- /dev/null
+++ b/include/ieee802-11/wifi_edca.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 Bastian Bloessl
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+#ifndef INCLUDED_IEEE802_11_WIFI_EDCA_H
+#define INCLUDED_IEEE802_11_WIFI_EDCA_H
+
+#include
+#include
+
+namespace gr {
+namespace ieee802_11 {
+
+class IEEE802_11_API wifi_edca : virtual public block
+{
+public:
+
+ typedef boost::shared_ptr sptr;
+ static sptr make(std::vectorcw_min, std::vectoraifsn);
+};
+
+} // namespace ieee802_11
+} // namespace gr
+
+#endif /* INCLUDED_IEEE802_11_WIFI_EDCA_H */
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index e3781c4..f093028 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -107,6 +107,7 @@ list(APPEND gr_ieee802_11_sources
ofdm_sync_long.cc
ofdm_sync_short.cc
utils.cc
+ wifi_edca.cc
wifi_signal_field_impl.cc
)
diff --git a/lib/wifi_edca.cc b/lib/wifi_edca.cc
new file mode 100644
index 0000000..0ca774a
--- /dev/null
+++ b/lib/wifi_edca.cc
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2014 Bastian Bloessl
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+#include
+
+#include
+#include
+
+#include "utils.h"
+
+#include
+#include
+#include
+
+using namespace gr::ieee802_11;
+
+class wifi_edca_impl : public wifi_edca {
+
+public:
+
+wifi_edca_impl(std::vector cw_min, std::vectoraifsn) :
+ block("wifi_edca",
+ gr::io_signature::make(0, 0, 0),
+ gr::io_signature::make(0, 0, 0)),
+ m_cw_min(cw_min), m_aifsn(aifsn)
+ {
+
+ assert(cw_min.size() == aifsn.size());
+
+ message_port_register_out(pmt::mp("mac out"));
+
+ for(int i = 0; i < cw_min.size(); i++) {
+ std::stringstream sstm;
+ sstm << "ac in" << i;
+ message_port_register_in(pmt::mp(sstm.str()));
+ set_msg_handler(pmt::mp(sstm.str()), boost::bind(&wifi_edca_impl::ac_in, this, _1, i));
+ }
+
+}
+
+void ac_in (pmt::pmt_t msg, int i) {
+ std::cout << "ac " << i << std::endl;
+ message_port_pub(pmt::mp("mac out"), msg);
+}
+
+private:
+ std::vectorm_cw_min;
+ std::vectorm_aifsn;
+};
+
+wifi_edca::sptr
+wifi_edca::make(std::vectorcw_min, std::vector aifsn) {
+ return gnuradio::get_initial_sptr(new wifi_edca_impl(cw_min, aifsn));
+}
+
diff --git a/swig/ieee802_11_swig.i b/swig/ieee802_11_swig.i
index 4fb6f7e..90df87a 100644
--- a/swig/ieee802_11_swig.i
+++ b/swig/ieee802_11_swig.i
@@ -38,6 +38,7 @@
#include "ieee802-11/ofdm_preamble.h"
#include "ieee802-11/ofdm_sync_long.h"
#include "ieee802-11/ofdm_sync_short.h"
+#include "ieee802-11/wifi_edca.h"
#include "ieee802-11/wifi_signal_field.h"
%}
@@ -57,6 +58,7 @@
%include "ieee802-11/ofdm_preamble.h"
%include "ieee802-11/ofdm_sync_long.h"
%include "ieee802-11/ofdm_sync_short.h"
+%include "ieee802-11/wifi_edca.h"
%include "ieee802-11/wifi_signal_field.h"
GR_SWIG_BLOCK_MAGIC2(ieee802_11, chunks_to_symbols);
@@ -73,6 +75,7 @@ GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_parse_mac);
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_preamble);
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_sync_long);
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_sync_short);
+GR_SWIG_BLOCK_MAGIC2(ieee802_11, wifi_edca);
%template(wifi_signal_field_sptr) boost::shared_ptr;
%pythoncode %{