ir_rawIR

Mock Jutsu HOW-TO | EN

The ir_raw function within the mock-jutsu library serves as a specialized generator for infrared signaling data, specifically designed for developers working on IoT, hardware abstraction layers, and signal processing applications. This function produces high-fidelity test data that mimics the raw pulse and space timings characteristic of infrared communication. By generating a structured object containing a carrier frequency in Hertz and an array of pulse durations, ir_raw allows engineers to simulate complex IR sequences without the need for physical emitters or logic analyzers. This capability is essential for building robust software that must interact with consumer electronics, climate control systems, or proprietary remote-controlled devices.

When generating mock data with ir_raw, the library utilizes algorithms that reflect industry-standard protocols such as NEC, Sony SIRC, and Philips RC5/RC6. The generated sequences oscillate between "mark" and "space" intervals, typically measured in microseconds, providing a realistic representation of how a physical IR receiver would perceive a signal. This level of detail is critical for testing the edge cases of signal decoding algorithms, where slight variations in timing can lead to checksum errors or command misinterpretation. Whether you are using the CLI command "mockjutsu generate ir_raw" for quick prototyping or integrating jutsu.generate('ir_raw') into a Python-based CI/CD pipeline, the consistency of the output ensures that your validation logic remains sound across different environments.

Beyond unit testing, ir_raw is a powerful tool for performance and integration testing. In JMeter environments, developers can utilize the ${__mockjutsu(ir_raw,)} syntax to inject dynamic infrared payloads into high-throughput messaging brokers or database ingestion streams. This enables teams to verify how their backend infrastructure handles high volumes of sensor data or telemetry before deploying to production. The primary benefit of using mock-jutsu for these scenarios is the reduction of hardware dependency; developers can iterate on their codebases faster and with greater confidence. By providing a reliable source of test data, ir_raw bridges the gap between low-level hardware interactions and high-level software development, making it an indispensable asset for modern embedded systems engineering.

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