Generating heterogeneous codes for IoT systems based on CAPS