I got SIB1 bit message from lteDLSCHDecode() function. But it is a {208 x 1 int 8} cell. How will I decode this to get BCCH-DL-SCH-Message.

19 次查看(过去 30 天)
I am getting SIB1 bit message it is a 1x1 cell array of size { 208x1 int 8} , can I store this SIB1 bit message as a HEX or PER file. So that I can use ASN.1 decoder on it to get BCCH-DL-SCH-Message from it I want to extract ,ECGI information consisting of mobile country code (MCC), mobile network code (MNC), tracking area code (TAC) and cell identity (CID).

回答(1 个)

Varun
Varun 2023-10-26
Hi Aritrik,
I understand that you are getting SIB1 bit message which is a 1x1 cell array of size { 208x1} and you want to know if it can be stored as a HEX or PER file so that you can use an ASN.1 decoder to parse the message and extract the desired information.
Yes, you can store the SIB1 bit message as a HEX or PER file. Both formats can be used with an ASN.1 decoder to extract the BCCH-DL-SCH-Message.
To store the SIB1 bit message as a HEX file, you can convert the integer values to their hexadecimal representation and save them in a file. Each integer value should be converted to a two-digit hexadecimal number. Please refer to the following code snippet:
% Example SIB1 bit message in a cell array (208 x 1)
SIB1_message = cell(208, 1);
% Fill the cell array with your SIB1 message (you can replace this with your actual data)
for i = 1:208
% Generate random SIB1 bit message (for demonstration)
SIB1_message{i} = randi([0 255]); % 8-bit random value
end
% Specify the file name for the HEX file
hexFileName = 'SIB1_message.hex';
% Create or open the HEX file for writing
hexFileID = fopen(hexFileName, 'w');
if hexFileID == -1
error('Failed to open the HEX file for writing.');
end
% Loop through the cell array and convert each element to HEX and write to the HEX file
for i = 1:208
% Convert to HEX string (two characters per element)
hexString = dec2hex(SIB1_message{i}, 2);
% Write to the HEX file
fprintf(hexFileID, ':%s\n', hexString);
end
% Write the end-of-file marker
fprintf(hexFileID, ':00000001FF\n');
% Close the HEX file
fclose(hexFileID);
In this code, we first create a cell array "SIB1_message"with random 8-bit values as placeholder. You should replace this with your actual SIB1 message. We then open a HEX file for writing, convert each value in the cell array to a HEX string, and write it to the HEX file using the "fprintf"function. Finally, we add the end-of-file marker as you showed in your previous example.
Here is the output i.e. generated "SIB1_message.hex" file:
:F9
:C9
:62
:EF
:FE
...
...
:F0
:2A
:88
:00000001FF
You can use an ASN.1 decoder to process the generated HEX file and extract the ECGI information as specified in your ASN.1 schema. The specific code for ASN.1 decoding will depend on the tool or library you are using for ASN.1 decoding in MATLAB.
Hope it helps.

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by