-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from particle-iot/feature/cellular-imei
Add new APIs to access device via control requests
- Loading branch information
Showing
12 changed files
with
490 additions
and
63 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function convertBufferToMacAddress(buffer) { | ||
if (!buffer) { | ||
return buffer; | ||
} | ||
|
||
const bytes = Array.from(buffer); | ||
return bytes.map(byte => byte.toString(16).padStart(2, '0')).join(':'); | ||
} | ||
|
||
module.exports = { | ||
convertBufferToMacAddress | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const addressUtil = require('./address-util'); | ||
const { expect } = require('../test/support'); | ||
|
||
describe('convertBufferToMacAddress', () => { | ||
it('should convert a buffer to MAC address', () => { | ||
const buffer = Buffer.from([0x00, 0x11, 0x22, 0x33, 0x44, 0x55]); // Buffer with MAC address bytes | ||
const expected = '00:11:22:33:44:55'; | ||
const result = addressUtil.convertBufferToMacAddress(buffer); | ||
expect(result).to.eql(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.