Various serial protocols which are used in the Siemens Mobile Phones.
Find a file
Kirill Zhumarin 988d5cc655 0.0.9
2024-04-22 00:53:38 +03:00
src fix rgb 2024-04-22 00:53:30 +03:00
.editorconfig .editorconfig 2024-04-11 22:58:31 +03:00
.gitignore update 2024-04-11 22:46:16 +03:00
LICENSE Initial commit 2024-04-11 22:20:54 +03:00
package-lock.json 0.0.9 2024-04-22 00:53:38 +03:00
package.json 0.0.9 2024-04-22 00:53:38 +03:00
README.md fixes 2024-04-21 01:36:41 +03:00

NPM Version

Summary

Various serial protocols which are used in the Siemens Mobile Phones.

Install this package with npm:

npm i @sie-js/serial

BFC

Protocol for service operations with the phone.

import fs from 'fs';
import { SerialPort } from 'serialport';
import { BFC } from '@sie-js/serial';

let bfc = new BFC(port);
bfc.setVerbose(true);
await bfc.connect();
await bfc.setBestSpeed();

let displaysCnt = await bfc.getDisplayCount();
console.log(`Total displays: ${displaysCnt}`);

for (let i = 1; i <= displaysCnt; i++) {
  let displaysInfo = await bfc.getDisplayInfo(i);
  let displaysBuffer = await bfc.getDisplayBufferInfo(displaysInfo.clientId);
  console.log(displaysBuffer);

  console.time("read");

  let memory = Buffer.alloc(0);

  let bytesToRead = displaysBuffer.width * displaysBuffer.height * 2;
  let bufferCursor = displaysBuffer.addr;
  while (bytesToRead > 0) {
    let chunk = await bfc.readMemory(bufferCursor, Math.min(bytesToRead, 63 * 256));
    memory = Buffer.concat([memory, chunk]);
    bytesToRead -= chunk.length;
    bufferCursor += chunk.length;
  }

  fs.writeFileSync("/tmp/screen.bin", memory);

  console.timeEnd("read");
}

await bus.disconnect();

AtChannel

Working with classic AT commands.

import { SerialPort } from 'serialport';
import { AtChannel } from '@sie-js/serial';

let port = new SerialPort({ path: '/dev/ttyUSB0', baudRate: 115200 });

let atc = new AtChannel(port);
atc.start();
atc.setVerbose(true);

console.log(await atc.handshake());
console.log(await atc.sendCommandNumeric("AT+CGSN"));