# A Low-Cost Remotely Configurable Electronic Trap for Insect Pest Dataset Generation
## 2 Materials and Methods
### Design and Architecture
#### 2.2.2 Device-Server Communication
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Parameter** & **Range Values** & **Description** \\
**(Type)** & **(Default Value)** & \\ \hline  & & 0: 96X96; 1: QQVGA; 2: QCIF; 3: \\  & & HQVGA; 4: 240X240; 5: QVGA; 6: Cl; 7: \\  & & HVGA; 8: VGA; 9: SVGA; 10: XGA; 11: \\ framesize \{uint8\_t\} & 0-22 \{11\} & HD; 12: SXGA; 13: UXGA; 14: FHD; 15: \\  & & P\_HD; 16: P\_3 MP; 17: QXGA; 18: QHD; \\  & & 19: WQXGA; 20: P\_FHD; 21: QSXGA; 22: \\  & & INVALID. \\ \hline scale \{bool\} & \{0\} & Image scaling. \\ \hline binning \{bool\} & \{0\} & Grouping of px. \\ \hline quality \{uint8\_t\} & 0-63 \{5\} & Overall excellence or level of perfection. \\ \hline brightness \{int8\_t\} & \(-\)2-2 \{0\} & Overall lightness or darkness. \\ \hline contrast \{int8\_t\} & \(-\)2-2 \{0\} & Difference in brightness or color intensity \\  & & between different parts of an image. \\ \hline saturation \{int8\_t\} & \(-\)2-2 \{0\} & Intensity or purity of colors. \\ \hline sharpness \{int8\_t\} & \(-\)2-2 \{0\} & Quantitative measure of the clarity. \\ \hline denoise \{uint8\_t\} & 0-8 \{0\} & Reducing or eliminating unwanted noise. \\ \hline  & & 0: No\_Effect; 1: Negative; 2: Gray\_Scale; \\ special\_effect \{uint8\_t\} & 0-6 \{0\} & 3: Red\_Tint; 4: Green\_Tint; 5: Blue\_Tint; \\  & & 6: Sepia. \\ \hline wb\_mode \{uint8\_t\} & 0-4 \{0\} & Overall excellence or level of perfection. \\ \hline awb \{uint8\_t\} & 0-4 \{0\} & Automatic White Balance. \\ \hline aec \{uint8\_t\} & 0-4 \{0\} & Auto Exposure Compensation. \\ \hline ae\_level \{int8\_t\} & \(-\)2-2 \{0\} & Compensation to be applied to the \\  & & exposure. \\ \hline aec\_value \{uint16\_t\} & 0-1200 \{0\} & Specific value used to set automatic \\  & & exposure compensation. \\ \hline agc\_gain \{uint8\_t\} & 0-30 \{0\} & Automatic Gain Control. \\ \hline gainceiling \{uint8\_t\} & 0-511 \{248\} & Maximum gain level. \\ \hline bpc \{bool\} & \{1\} & Black Point Compensation. \\ \hline wpc \{bool\} & \{1\} & White Point Correction. \\ \hline lenc \{bool\} & \{1\} & Line Length Compression. \\ \hline hmirror \{bool\} & \{0\} & Horizontal image mirror. \\ \hline vflip \{bool\} & \{0\} & Vertical image flip. \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Parameters that can be modified in Testing and WebServer states. of the Camera Task (\(T\)), which is responsible for capturing images and transmitting them to the server via POST at the endpoint _/api/Image/UploadImage/id_. In the Monitoring state, the transmitted images are stored in the repository, associating them with the originating device in the database. This association enables the retrieval of the upload timestamp, along with all the characteristics inherited from the device configuration that impact the image (latitude, longitude, brightness, contrast, saturation, sharpness, etc.). The Testing Camera mode has a communication sequence analogous to the Monitoring mode, with two differences: (a) the image upload is performed with a POST request to the endpoint _/api/Image/UploadImageTest/id_ and (b) the \(T\) and _Tconf_ periods are significantly shortened to allow the user to quickly make changes to fine-tune the configuration for the desired outcome. To serve this purpose, images in this mode are not stored in the final repository but directed to temporary storage. In Figure 9, the sequence diagram of communications for the _WebServer_ mode is depicted. In this mode, the Configuration Task initiates the _WebServer Task_ in the operating system (if necessary, it would stop the others). This task deploys a web server that accepts a single client connection and serves a real-time configuration page with interactive controls  
Figure 8: Sequence diagram for user–trap interaction via the server API in Monitoring mode.The sequence diagram illustrates the interaction between the user and the trap through the server API in Monitoring mode. It shows the chronological sequence of data transmission and reception events from top to bottom, along with the computational load triggered at the receiving end.