ir_rawIR

Mock Jutsu HOW-TO | UK

The ir_raw function within the mock-jutsu library serves as a sophisticated tool for developers needing to simulate infrared signal transmissions. In the evolving landscape of IoT and consumer electronics, generating high-quality test data is essential for verifying how hardware interfaces and software drivers interpret physical light signals. By providing a structured representation of raw pulse and space timings, this function allows engineers to mimic real-world remote control commands without requiring physical IR hardware during the initial stages of development or within automated environments.

When invoked, the ir_raw utility produces a structured object featuring a carrier frequency, measured in Hertz, alongside a sequence of alternating pulse and space durations. This format aligns with industry standards such as the LIRC specification, ensuring that the generated mock data remains compatible with existing signal processing libraries. The underlying algorithm simulates the modulation patterns typical of common protocols like NEC or Sony, synthesising realistic timing sequences that account for the slight jitter and variance often encountered when capturing data from physical sensors.

Integrating this capability into a modern development workflow is seamless across various platforms. Developers can quickly produce samples via the command line using the mockjutsu generate ir_raw command or incorporate it directly into Python-based test suites with the jutsu.generate('ir_raw') method. For performance testers, the library also supports JMeter through the ${__mockjutsu(ir_raw,)} syntax. This versatility ensures that whether you are unit testing a driver or load testing a cloud-based IoT gateway, the mock-jutsu framework provides consistent and reproducible results across the entire stack.

Utilising ir_raw offers significant benefits, particularly when testing complex scenarios such as signal degradation or non-standard carrier frequencies. It eliminates the logistical overhead of managing physical infrared emitters and receivers, allowing for comprehensive regression testing in CI/CD pipelines. By leveraging this precise test data, engineering teams can accelerate their development cycles and ensure their systems are resilient to a wide array of infrared communication patterns before the software ever interacts with a physical microcontroller or smart home hub.

CLI Usage
mockjutsu generate ir_rawmockjutsu bulk ir_raw --count 10mockjutsu export ir_raw --count 10 --format jsonmockjutsu export ir_raw --count 10 --format csvmockjutsu export ir_raw --count 10 --format sql
Python API
from mockjutsu import jutsujutsu.generate('ir_raw')jutsu.bulk('ir_raw', count=10)jutsu.template(['ir_raw'], count=5)
JMeter
${__mockjutsu_iot(ir_raw)}# JMeter Function: __mockjutsu_iot# Parameter 1: ir_raw# Parameter 2: (not required for this function)
REST API
GET /generate/ir_raw# → {"type":"ir_raw","result":"...","status":"ok"}GET /bulk/ir_raw?count=10POST /template {"types":["ir_raw"],"count":1}

Other Languages