2023-10-03 13:15:17 +00:00
|
|
|
import { defineStore } from "pinia";
|
2023-10-22 13:44:05 +00:00
|
|
|
import { ref } from "vue";
|
2023-10-03 13:15:17 +00:00
|
|
|
|
|
|
|
export const useChatStore = defineStore("chatStore", () => {
|
2024-01-27 16:44:18 +00:00
|
|
|
var callsign_list = ref();
|
|
|
|
var sorted_chat_list = ref();
|
|
|
|
var newChatCallsign = ref();
|
|
|
|
var newChatMessage = ref();
|
|
|
|
|
2024-03-07 13:48:13 +00:00
|
|
|
/* ------------------------------------------------ */
|
2024-03-07 13:50:47 +00:00
|
|
|
// Scroll to bottom functions
|
2024-03-07 13:48:13 +00:00
|
|
|
const scrollTrigger = ref(0);
|
|
|
|
|
|
|
|
function triggerScrollToBottom() {
|
|
|
|
scrollTrigger.value++;
|
|
|
|
}
|
|
|
|
|
2024-02-03 12:55:30 +00:00
|
|
|
/* ------------------------------------------------ */
|
2024-01-27 16:44:18 +00:00
|
|
|
|
2023-10-03 13:15:17 +00:00
|
|
|
var chat_filter = ref([
|
|
|
|
{ type: "newchat" },
|
|
|
|
{ type: "received" },
|
|
|
|
{ type: "transmit" },
|
|
|
|
{ type: "ping-ack" },
|
|
|
|
{ type: "broadcast_received" },
|
|
|
|
{ type: "broadcast_transmit" },
|
|
|
|
//{ type: "request" },
|
|
|
|
//{ type: "response" },
|
|
|
|
]);
|
|
|
|
|
|
|
|
var selectedCallsign = ref();
|
2023-10-14 13:32:30 +00:00
|
|
|
// we need a default value in our ref because of our message info modal
|
|
|
|
var selectedMessageObject = ref({
|
2023-10-22 08:12:00 +00:00
|
|
|
command: "msg",
|
|
|
|
hmac_signed: false,
|
|
|
|
percent: 0,
|
|
|
|
is_new: false,
|
|
|
|
_id: "2ead6698",
|
|
|
|
timestamp: 1697289795,
|
|
|
|
dxcallsign: "DJ2LS-0",
|
|
|
|
dxgrid: "null",
|
|
|
|
msg: "test",
|
|
|
|
checksum: "",
|
|
|
|
type: "transmit",
|
|
|
|
status: "transmitting",
|
|
|
|
attempt: 1,
|
|
|
|
uuid: "2ead6698",
|
|
|
|
duration: 0,
|
|
|
|
nacks: 0,
|
|
|
|
speed_list: "null",
|
|
|
|
_attachments: {
|
|
|
|
"": {
|
|
|
|
content_type: "text",
|
|
|
|
data: "",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
var inputText = ref("");
|
2023-10-03 13:15:17 +00:00
|
|
|
var inputFile = ref();
|
2024-01-14 16:47:43 +00:00
|
|
|
var inputFileName = ref("-");
|
|
|
|
var inputFileType = ref("-");
|
|
|
|
var inputFileSize = ref("-");
|
2023-10-03 13:15:17 +00:00
|
|
|
|
|
|
|
var sorted_beacon_list = ref({});
|
|
|
|
var unsorted_beacon_list = ref({});
|
|
|
|
|
|
|
|
var chartSpeedPER0 = ref();
|
|
|
|
var chartSpeedPER25 = ref();
|
|
|
|
var chartSpeedPER75 = ref();
|
|
|
|
|
|
|
|
// var beaconDataArray = ref([-3, 10, 8, 5, 3, 0, -5, 10, 8, 5, 3, 0, -5, 10, 8, 5, 3, 0, -5, 10, 8, 5, 3, 0, -5])
|
|
|
|
// var beaconLabelArray = ref(['18:10', '19:00', '23:00', '01:13', '04:25', '08:15', '09:12', '18:10', '19:00', '23:00', '01:13', '04:25', '08:15', '09:12', '18:10', '19:00', '23:00', '01:13', '04:25', '08:15', '09:12', '01:13', '04:25', '08:15', '09:12'])
|
|
|
|
var beaconDataArray = ref([]);
|
|
|
|
var beaconLabelArray = ref([]);
|
|
|
|
|
2023-10-22 12:49:33 +00:00
|
|
|
var arq_speed_list_bpm = ref([]);
|
|
|
|
var arq_speed_list_timestamp = ref([]);
|
|
|
|
var arq_speed_list_snr = ref([]);
|
|
|
|
|
2023-10-03 13:15:17 +00:00
|
|
|
return {
|
|
|
|
selectedCallsign,
|
2024-01-27 16:44:18 +00:00
|
|
|
newChatCallsign,
|
|
|
|
newChatMessage,
|
2023-10-14 13:32:30 +00:00
|
|
|
selectedMessageObject,
|
2023-10-03 13:15:17 +00:00
|
|
|
inputText,
|
|
|
|
chat_filter,
|
|
|
|
callsign_list,
|
|
|
|
sorted_chat_list,
|
|
|
|
inputFileName,
|
|
|
|
inputFileSize,
|
|
|
|
inputFileType,
|
|
|
|
inputFile,
|
|
|
|
chartSpeedPER0,
|
|
|
|
chartSpeedPER25,
|
|
|
|
chartSpeedPER75,
|
|
|
|
beaconDataArray,
|
|
|
|
beaconLabelArray,
|
|
|
|
unsorted_beacon_list,
|
|
|
|
sorted_beacon_list,
|
2023-10-22 12:49:33 +00:00
|
|
|
arq_speed_list_bpm,
|
|
|
|
arq_speed_list_snr,
|
|
|
|
arq_speed_list_timestamp,
|
2024-03-07 13:48:13 +00:00
|
|
|
scrollTrigger,
|
|
|
|
triggerScrollToBottom,
|
2023-10-03 13:15:17 +00:00
|
|
|
};
|
2023-09-12 15:52:16 +00:00
|
|
|
});
|