<commit_before>#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <time.h>
#include <arpa/inet.h>
#include <errno.h> // Error Checking
#include <string.h> // Required for strerror()
#include "json.h"

#include "crc.h"

#include "CPFrames.h"

#define SERIAL_DEVICE "/dev/serial0"
#define RESEND_TIME 5
#define RX_PROTOCOL_VERSION CPV01_VERSION
#define RX_PROTOCOL_SIZE CPV01_SIZE
#define TX_PROTOCOL_VERSION CPV02_VERSION
#define TX_PROTOCOL_SIZE CPV02_SIZE

#define JITTER 0
#define HOLDING 1

const char *form_update_os_payload(int frame_number, CPFrameVersion02 *frame){
  /*Creating a json object*/
  json_object * jobj = json_object_new_object();

  /*Creating a json integer*/
  json_object *jfrm = json_object_new_int(frame_number);
  json_object *jtheta1 = json_object_new_int(frame->THETA2);
  json_object *jtheta2 = json_object_new_int(frame->THETA1);
  json_object *jd3 = json_object_new_int(frame->D3);

  /*Form the json object*/
  /*Each of these is like a key value pair*/
  json_object_object_add(jobj,"frame", jfrm);
  json_object_object_add(jobj,"theta1", jtheta1);
  json_object_object_add(jobj,"theta2", jtheta2);
  json_object_object_add(jobj,"d3", jd3);

  /*Now printing the json object*/
  return json_object_to_json_string(jobj);
}

int main(int argc, char** argv)
{
  srand(time(NULL));   // should only be called once

  if (argc != 2)<commit_msg>Created Message Notification Payload Helper Function<commit_after>#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <time.h>
#include <arpa/inet.h>
#include <errno.h> // Error Checking
#include <string.h> // Required for strerror()
#include "json.h"

#include "crc.h"

#include "CPFrames.h"

#define SERIAL_DEVICE "/dev/serial0"
#define RESEND_TIME 5
#define RX_PROTOCOL_VERSION CPV01_VERSION
#define RX_PROTOCOL_SIZE CPV01_SIZE
#define TX_PROTOCOL_VERSION CPV02_VERSION
#define TX_PROTOCOL_SIZE CPV02_SIZE

#define JITTER 0
#define HOLDING 1

const char *form_update_os_payload(int frame_number, CPFrameVersion02 *frame){
  /*Creating a json object*/
  json_object * jobj = json_object_new_object();

  /*Creating a json integer*/
  json_object *jfrm = json_object_new_int(frame_number);
  json_object *jtheta1 = json_object_new_int(frame->THETA2);
  json_object *jtheta2 = json_object_new_int(frame->THETA1);
  json_object *jd3 = json_object_new_int(frame->D3);

  /*Form the json object*/
  /*Each of these is like a key value pair*/
  json_object_object_add(jobj,"frame", jfrm);
  json_object_object_add(jobj,"theta1", jtheta1);
  json_object_object_add(jobj,"theta2", jtheta2);
  json_object_object_add(jobj,"d3", jd3);

  /*Now printing the json object*/
  return json_object_to_json_string(jobj);
}

const char *form_message_payload(const char *title, const char *type, const char *footnote){
  /*Creating a json object*/
  json_object * jobj = json_object_new_object();

  /*Creating a json string*/
  json_object *jtitle = json_object_new_string(title);
  json_object *jtype = json_object_new_string(type);
  json_object *jfootnote = json_object_new_string(footnote);

  /*Form the json object*/
  /*Each of these is like a key value pair*/
  json_object_object_add(jobj,"title", jtitle);
  json_object_object_add(jobj,"type", jtype);
  json_object_object_add(jobj,"footnote", jfootnote);

  /*Now printing the json object*/
  return json_object_to_json_string(jobj);
}

int main(int argc, char** argv)
{
  srand(time(NULL));   // should only be called once

  if (argc != 2)
{'fraction_non_alphanumeric': 0.11926091825307951, 'fraction_numerical': 0.015117581187010079, 'mean_word_length': 5.628942486085343, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6581363', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1303, 'n_words': 309}