Various serial protocols which are used in the Siemens Mobile Phones.
Find a file
Kirill Zhumarin fcd2ef2041 .editorconfig
2024-04-11 22:58:31 +03:00
src initial commit 2024-04-11 22:25:15 +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.3 2024-04-11 22:52:09 +03:00
package.json 0.0.3 2024-04-11 22:52:09 +03:00
README.md Update README.md 2024-04-11 22:51:55 +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 bus = new BFC(port);
bus.setVerbose(true);
await bus.connect();
await bus.setSpeed(921600);

let bfc = bus.openChannel();

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"));