Skip to content

Commit

Permalink
🔥 Some shx8800pro works
Browse files Browse the repository at this point in the history
  • Loading branch information
SydneyOwl committed Aug 11, 2024
1 parent 7848ab0 commit f4fd034
Show file tree
Hide file tree
Showing 21 changed files with 1,619 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea
/bin
/obj
/obj
*.user
.vscode
2 changes: 2 additions & 0 deletions App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:behaviors="clr-namespace:SenhaixFreqWriter.Behaviors"
xmlns:m="clr-namespace:SenhaixFreqWriter.DataModels.Shx8x00"
xmlns:mgt12="clr-namespace:SenhaixFreqWriter.DataModels.Gt12"
xmlns:mShx8800Pro="clr-namespace:SenhaixFreqWriter.DataModels.Shx8800Pro"
x:Class="SenhaixFreqWriter.App"
RequestedThemeVariant="Default">
<NativeMenu.Menu>
Expand Down Expand Up @@ -66,5 +67,6 @@
</ResourceDictionary>
<behaviors:DataGridDnd x:Key="DataGridDndBfNamedId" x:TypeArguments="m:ChannelData" />
<behaviors:DataGridDnd x:Key="DataGridDndGt12" x:TypeArguments="mgt12:Channel" />
<behaviors:DataGridDnd x:Key="DataGridDndShx8800Pro" x:TypeArguments="mShx8800Pro:Channel" />
</Application.Resources>
</Application>
1 change: 1 addition & 0 deletions Constants/Common/SHX_DEVICE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
public enum SHX_DEVICE
{
SHX8800,
SHX8800PRO,
SHX8600,
SHX8600PRO,
GT12
Expand Down
68 changes: 68 additions & 0 deletions Constants/Shx8800Pro/CHAN_CHOICE.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System.Collections.ObjectModel;

namespace SenhaixFreqWriter.Constants.Shx8800Pro;

public class ChanChoice
{
public static ObservableCollection<string> Power = new()
{
"高", "中", "低"
};

public static ObservableCollection<string> Bandwidth = new()
{
"宽", "窄"
};

public static ObservableCollection<string> Scanadd = new()
{
"删除", "添加"
};

public static ObservableCollection<string> BusyLock = new()
{
"关", "开"
};

public static ObservableCollection<string> Pttid = new()
{
"无", "按下PTT", "松开PTT", "按下和松开PTT"
};

public static ObservableCollection<string> SigGrp = new()
{
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13",
"14", "15"
};

public static ObservableCollection<string> Qtdqt = new()
{
"OFF", "67.0", "69.3", "71.9", "74.4", "77.0", "79.7", "82.5", "85.4", "88.5",
"91.5", "94.8", "97.4", "100.0", "103.5", "107.2", "110.9", "114.8", "118.8", "123.0",
"127.3", "131.8", "136.5", "141.3", "146.2", "151.4", "156.7", "159.8", "162.2", "165.5",
"167.9", "171.3", "173.8", "177.3", "179.9", "183.5", "186.2", "189.9", "192.8", "196.6",
"199.5", "203.5", "206.5", "210.7", "218.1", "225.7", "229.1", "233.6", "241.8", "250.3",
"254.1", "D023N", "D025N", "D026N", "D031N", "D032N", "D036N", "D043N", "D047N", "D051N",
"D053N", "D054N", "D065N", "D071N", "D072N", "D073N", "D074N", "D114N", "D115N", "D116N",
"D122N", "D125N", "D131N", "D132N", "D134N", "D143N", "D145N", "D152N", "D155N", "D156N",
"D162N", "D165N", "D172N", "D174N", "D205N", "D212N", "D223N", "D225N", "D226N", "D243N",
"D244N", "D245N", "D246N", "D251N", "D252N", "D255N", "D261N", "D263N", "D265N", "D266N",
"D271N", "D274N", "D306N", "D311N", "D315N", "D325N", "D331N", "D332N", "D343N", "D346N",
"D351N", "D356N", "D364N", "D365N", "D371N", "D411N", "D412N", "D413N", "D423N", "D431N",
"D432N", "D445N", "D446N", "D452N", "D454N", "D455N", "D462N", "D464N", "D465N", "D466N",
"D503N", "D506N", "D516N", "D523N", "D526N", "D532N", "D546N", "D565N", "D606N", "D612N",
"D624N", "D627N", "D631N", "D632N", "D645N", "D654N", "D662N", "D664N", "D703N", "D712N",
"D723N", "D731N", "D732N", "D734N", "D743N", "D754N", "D023I", "D025I", "D026I", "D031I",
"D032I", "D036I", "D043I", "D047I", "D051I", "D053I", "D054I", "D065I", "D071I", "D072I",
"D073I", "D074I", "D114I", "D115I", "D116I", "D122I", "D125I", "D131I", "D132I", "D134I",
"D143I", "D145I", "D152I", "D155I", "D156I", "D162I", "D165I", "D172I", "D174I", "D205I",
"D212I", "D223I", "D225I", "D226I", "D243I", "D244I", "D245I", "D246I", "D251I", "D252I",
"D255I", "D261I", "D263I", "D265I", "D266I", "D271I", "D274I", "D306I", "D311I", "D315I",
"D325I", "D331I", "D332I", "D343I", "D346I", "D351I", "D356I", "D364I", "D365I", "D371I",
"D411I", "D412I", "D413I", "D423I", "D431I", "D432I", "D445I", "D446I", "D452I", "D454I",
"D455I", "D462I", "D464I", "D465I", "D466I", "D503I", "D506I", "D516I", "D523I", "D526I",
"D532I", "D546I", "D565I", "D606I", "D612I", "D624I", "D627I", "D631I", "D632I", "D645I",
"D654I", "D662I", "D664I", "D703I", "D712I", "D723I", "D731I", "D732I", "D734I", "D743I",
"D754I"
};
}
7 changes: 7 additions & 0 deletions Constants/Shx8800Pro/FREQ.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace SenhaixFreqWriter.Constants.Shx8800Pro;

public class Freq
{
public static int MaxFreq = 520;
public static int MinFreq = 100;
}
74 changes: 74 additions & 0 deletions Constants/Shx8800Pro/VFO_CHOICE.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using System.Collections.ObjectModel;

namespace SenhaixFreqWriter.Constants.Shx8800Pro;

public class VfoChoice
{
public static ObservableCollection<string> Qtdqt = new()
{
"OFF", "67.0", "69.3", "71.9", "74.4", "77.0", "79.7", "82.5", "85.4", "88.5",
"91.5", "94.8", "97.4", "100.0", "103.5", "107.2", "110.9", "114.8", "118.8", "123.0",
"127.3", "131.8", "136.5", "141.3", "146.2", "151.4", "156.7", "159.8", "162.2", "165.5",
"167.9", "171.3", "173.8", "177.3", "179.9", "183.5", "186.2", "189.9", "192.8", "196.6",
"199.5", "203.5", "206.5", "210.7", "218.1", "225.7", "229.1", "233.6", "241.8", "250.3",
"254.1", "D023N", "D025N", "D026N", "D031N", "D032N", "D036N", "D043N", "D047N", "D051N",
"D053N", "D054N", "D065N", "D071N", "D072N", "D073N", "D074N", "D114N", "D115N", "D116N",
"D122N", "D125N", "D131N", "D132N", "D134N", "D143N", "D145N", "D152N", "D155N", "D156N",
"D162N", "D165N", "D172N", "D174N", "D205N", "D212N", "D223N", "D225N", "D226N", "D243N",
"D244N", "D245N", "D246N", "D251N", "D252N", "D255N", "D261N", "D263N", "D265N", "D266N",
"D271N", "D274N", "D306N", "D311N", "D315N", "D325N", "D331N", "D332N", "D343N", "D346N",
"D351N", "D356N", "D364N", "D365N", "D371N", "D411N", "D412N", "D413N", "D423N", "D431N",
"D432N", "D445N", "D446N", "D452N", "D454N", "D455N", "D462N", "D464N", "D465N", "D466N",
"D503N", "D506N", "D516N", "D523N", "D526N", "D532N", "D546N", "D565N", "D606N", "D612N",
"D624N", "D627N", "D631N", "D632N", "D645N", "D654N", "D662N", "D664N", "D703N", "D712N",
"D723N", "D731N", "D732N", "D734N", "D743N", "D754N", "D023I", "D025I", "D026I", "D031I",
"D032I", "D036I", "D043I", "D047I", "D051I", "D053I", "D054I", "D065I", "D071I", "D072I",
"D073I", "D074I", "D114I", "D115I", "D116I", "D122I", "D125I", "D131I", "D132I", "D134I",
"D143I", "D145I", "D152I", "D155I", "D156I", "D162I", "D165I", "D172I", "D174I", "D205I",
"D212I", "D223I", "D225I", "D226I", "D243I", "D244I", "D245I", "D246I", "D251I", "D252I",
"D255I", "D261I", "D263I", "D265I", "D266I", "D271I", "D274I", "D306I", "D311I", "D315I",
"D325I", "D331I", "D332I", "D343I", "D346I", "D351I", "D356I", "D364I", "D365I", "D371I",
"D411I", "D412I", "D413I", "D423I", "D431I", "D432I", "D445I", "D446I", "D452I", "D454I",
"D455I", "D462I", "D464I", "D465I", "D466I", "D503I", "D506I", "D516I", "D523I", "D526I",
"D532I", "D546I", "D565I", "D606I", "D612I", "D624I", "D627I", "D631I", "D632I", "D645I",
"D654I", "D662I", "D664I", "D703I", "D712I", "D723I", "D731I", "D732I", "D734I", "D743I",
"D754I"
};

public static ObservableCollection<string> BusyLock = new()
{
"关", "开"
};

public static ObservableCollection<string> Direction = new()
{
"OFF", "+", "-"
};

public static ObservableCollection<string> SigGroup = new()
{
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12", "13", "14", "15"
};

public static ObservableCollection<string> Step = new()
{
"2.5 KHz", "5.0 KHz", "6.25 KHz", "10.0 KHz", "12.5 KHz", "20.0 KHz", "25.0 KHz", "50.0 KHz"
};

public static ObservableCollection<string> Bandwidth = new()
{
"宽", "窄"
};

public static ObservableCollection<string> Power = new()
{
"高", "中", "低"
};


public static ObservableCollection<string> Pttid = new()
{
"无", "发射开始", "发射结束", "两者"
};
}
92 changes: 92 additions & 0 deletions DataModels/Shx8800Pro/AppData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
using System;
using System.IO;
using System.Text;
using MsBox.Avalonia;
using Newtonsoft.Json;

namespace SenhaixFreqWriter.DataModels.Shx8800Pro;

public class AppData
{
[JsonIgnore] public static AppData Instance;

public string[] BankName = new string[30]
{
"区域一", "区域二", "区域三", "区域四", "区域五", "区域六", "区域七", "区域八", "区域九", "区域十",
"区域十一", "区域十二", "区域十三", "区域十四", "区域十五", "区域十六", "区域十七", "区域十八", "区域十九", "区域二十",
"区域二十一", "区域二十二", "区域二十三", "区域二十四", "区域二十五", "区域二十六", "区域二十七", "区域二十八", "区域二十九", "区域三十"
};//

public Channel[][] ChannelList = new Channel[8][];//
public Dtmf Dtmfs = new();//
public FmChannel Fms = new();//
public Function FunCfgs = new();//
public Mdc1200 Mdcs = new();//
public VfoInfos Vfos = new();//

public AppData()
{
for (var i = 0; i < 8; i++)
{
ChannelList[i] = new Channel[64];
for (var j = 0; j < 64; j++)
{
var rmp = new Channel();
rmp.Id = j + 1;
ChannelList[i][j] = rmp;
}
}
}

public static AppData GetInstance()
{
if (Instance != null) return Instance;

Instance = new AppData();
return Instance;
}

public static AppData ForceNewInstance()
{
Instance = new AppData();
return Instance;
}

public void SaveToFile(Stream s)
{
var serializer = new JsonSerializer();
serializer.Formatting = Formatting.Indented;
using (var streamWriter = new StreamWriter(s, Encoding.UTF8))
{
serializer.Serialize(streamWriter, Instance);
}
}


public static void CreatObjFromFile(Stream s)
{
using (var streamReader = new StreamReader(s, Encoding.UTF8))
{
var res = streamReader.ReadToEnd();
AppData tmp;
try
{
var jsonSerializer = new JsonSerializer();
var stringReader = new JsonTextReader(new StringReader(res));
tmp = jsonSerializer.Deserialize<AppData>(stringReader);
Instance.Dtmfs = tmp.Dtmfs;
Instance.FunCfgs = tmp.FunCfgs;
Instance.Fms = tmp.Fms;
Instance.Mdcs = tmp.Mdcs;
Instance.Vfos = tmp.Vfos;
Instance.BankName = tmp.BankName;
Instance.ChannelList = tmp.ChannelList;
}
catch (Exception e)
{
// DebugWindow.GetInstance().updateDebugContent(e.Message);
MessageBoxManager.GetMessageBoxStandard("注意", "无效的文件").ShowAsync();
}
}
}
}
63 changes: 63 additions & 0 deletions DataModels/Shx8800Pro/Channel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System.IO;
using System.Xml.Serialization;
using CommunityToolkit.Mvvm.ComponentModel;

namespace SenhaixFreqWriter.DataModels.Shx8800Pro;

public partial class Channel : ObservableObject
{
[ObservableProperty] private int _bandwide;//

[ObservableProperty]
// Useless member: id
private int _id; //

[XmlIgnore] [ObservableProperty] private bool _isVisable;

[ObservableProperty] private string _name = "";//
[ObservableProperty] private int _pttid;//
[ObservableProperty] private string _rxFreq = "";//
[ObservableProperty] private int _scanAdd;//
[ObservableProperty] private int _signalGroup;//
[ObservableProperty] private int _busyLock;
[ObservableProperty] private string _strRxCtsDcs = "OFF";//
[ObservableProperty] private string _strTxCtsDcs = "OFF";//
[ObservableProperty] private string _txFreq = "";//
[ObservableProperty] private int _txPower;//

public Channel()
{
}

public Channel(int id, string rxFreq, string rxCts, string txFreq, string txCts, int power, int bandwide,
int scanAdd, int busyLock, int pttid, int signal, string name)
{
_id = id;
_rxFreq = rxFreq;
_strRxCtsDcs = rxCts;
_txFreq = txFreq;
_strTxCtsDcs = txCts;
_txPower = power;
_bandwide = bandwide;
_scanAdd = scanAdd;
_pttid = pttid;
_signalGroup = signal;
_busyLock = busyLock;
_name = name;
}

public Channel DeepCopy()
{
Channel rel;
using (var ms = new MemoryStream())
{
var xml = new XmlSerializer(typeof(Channel));
xml.Serialize(ms, this);
ms.Seek(0, SeekOrigin.Begin);
rel = (Channel)xml.Deserialize(ms);
ms.Close();
}

return rel;
}
}
Loading

0 comments on commit f4fd034

Please sign in to comment.