<commit_before>using System;
using System.IO.Ports;
using System.Collections.Generic;

namespace uploader
{
	public class Uploader
	{		
		public event LogEventHandler LogEvent;
		public event ProgressEventHandler ProgressEvent;
		
		private	int bytes_to_process;
		private int bytes_processed;
		private SerialPort port;
		
		private enum Code : byte
		{
			// response codes
			OK				= 0x10,
			FAILED			= 0x11,
			INSYNC			= 0x12,
			
			// protocol commands
			EOC				= 0x20,
			GET_SYNC		= 0x21,
			GET_DEVICE		= 0x22,	// returns DEVICE_ID and FREQ bytes
			CHIP_ERASE		= 0x23,
			LOAD_ADDRESS	= 0x24,
			PROG_FLASH		= 0x25,
			READ_FLASH		= 0x26,
			PROG_MULTI		= 0x27,
			READ_MULTI		= 0x28,
			REBOOT			= 0x30,
			
			// protocol constants
			PROG_MULTI_MAX	= 64,	// maximum number of bytes in a PROG_MULTI command
			READ_MULTI_MAX	= 255,	// largest read that can be requested
			
			// device IDs XXX should come with the firmware image...
			DEVICE_ID_RF50	= 0x4d,
			DEVICE_ID_HM_TRP= 0x4e,
			
			// frequency code bytes XXX should come with the firmware image...
			FREQ_NONE		= 0,
			FREQ_433		= 1,
			FREQ_470		= 2,
			FREQ_868		= 3,
			FREQ_915		= 4,
		};
		
		public Uploader ()
		{
		}
		
	
		/// <summary>
		/// Upload the specified image_data.<commit_msg>Fix the frequency codes.<commit_after>using System;
using System.IO.Ports;
using System.Collections.Generic;

namespace uploader
{
	public class Uploader
	{		
		public event LogEventHandler LogEvent;
		public event ProgressEventHandler ProgressEvent;
		
		private	int bytes_to_process;
		private int bytes_processed;
		private SerialPort port;
		
		private enum Code : byte
		{
			// response codes
			OK				= 0x10,
			FAILED			= 0x11,
			INSYNC			= 0x12,
			
			// protocol commands
			EOC				= 0x20,
			GET_SYNC		= 0x21,
			GET_DEVICE		= 0x22,	// returns DEVICE_ID and FREQ bytes
			CHIP_ERASE		= 0x23,
			LOAD_ADDRESS	= 0x24,
			PROG_FLASH		= 0x25,
			READ_FLASH		= 0x26,
			PROG_MULTI		= 0x27,
			READ_MULTI		= 0x28,
			REBOOT			= 0x30,
			
			// protocol constants
			PROG_MULTI_MAX	= 64,	// maximum number of bytes in a PROG_MULTI command
			READ_MULTI_MAX	= 255,	// largest read that can be requested
			
			// device IDs XXX should come with the firmware image...
			DEVICE_ID_RF50	= 0x4d,
			DEVICE_ID_HM_TRP= 0x4e,
			
			// frequency code bytes XXX should come with the firmware image...
			FREQ_NONE		= 0xf0,
			FREQ_433		= 0x43,
			FREQ_470		= 0x47,
			FREQ_868		= 0x86,
			FREQ_915		= 0x91,
		};
		
		public Uploader ()
		{
		}
		
	
		/// <summary>
		/// Upload the specified image_data.
{'fraction_non_alphanumeric': 0.07802795031055901, 'fraction_numerical': 0.05551242236024845, 'mean_word_length': 2.5156889495225103, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6415948', 'n_tokens_mistral': 1283, 'n_tokens_neox': 986, 'n_words': 256}