jefffhaynes / XBee

A .NET library for XBee wireless controllers
MIT License
40 stars 17 forks source link

New to XBee and Added Supply Voltage measurement. #42

Closed PaulHeitkemper closed 6 years ago

PaulHeitkemper commented 6 years ago

I'm just getting into your API, and I like it. I've got a need to ask the modules for Supply Voltage (%V command) so I added it. Perhaps you'd like to roll it into the main API.

to XBeeNode.cs:

        /// <summary>
        ///     Gets the Supply Voltage in mV
        /// </summary>
        /// <returns></returns>
        public async Task<ushort> GetSupplyVoltageAsync()
        {
            var response = await ExecuteAtQueryAsync<PrimitiveResponseData<ushort>>(new SupplyVoltageCommand()).ConfigureAwait(false);
            return response.Value;
        }

to AtCommandResponseFrameContent.cs:

        [Subtype(nameof(AtCommand), SupplyVoltageCommand.Name, typeof(PrimitiveResponseData<ushort>), BindingMode = BindingMode.OneWay)]

New file SupplyVoltageCommand.cs

namespace XBee.Frames.AtCommands
{
    internal class SupplyVoltageCommand : AtCommand
    {
        public const string Name = "%V";

        public SupplyVoltageCommand() : base(Name)
        {
        }
    }
}
jefffhaynes commented 6 years ago

Sure, I’ll take a look this weekend

— Planning for failure is even dumber than regular planning


From: PaulHeitkemper notifications@github.com Sent: Wednesday, January 24, 2018 6:44:29 PM To: jefffhaynes/XBee Cc: Subscribed Subject: [jefffhaynes/XBee] New to XBee and Added Supply Voltage measurement. (#42)

I'm just getting into your API, and I like it. I've got a need to ask the modules for Supply Voltage (%V command) so I added it. Perhaps you'd like to roll it into the main API.

to XBeeNode.cs:

    /// <summary>
    ///     Gets the Supply Voltage
    /// </summary>
    /// <returns></returns>
    public async Task<ushort> GetSupplyVoltageAsync()
    {
        var response = await ExecuteAtQueryAsync<PrimitiveResponseData<ushort>>(new SupplyVoltageCommand()).ConfigureAwait(false);
        return response.Value;
    }

to AtCommandResponseFrameContent.cs:

    [Subtype(nameof(AtCommand), SupplyVoltageCommand.Name, typeof(PrimitiveResponseData<ushort>), BindingMode = BindingMode.OneWay)]

New file SupplyVoltageCommand.cs

namespace XBee.Frames.AtCommands { internal class SupplyVoltageCommand : AtCommand { public const string Name = "%V";

    public SupplyVoltageCommand() : base(Name)
    {
    }
}

}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/jefffhaynes/XBee/issues/42, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJSKRy3ZcZw4AWy6HCE3_b90pKvijo5mks5tN8BcgaJpZM4RsHHx.

PaulHeitkemper commented 6 years ago

Upon further review, I think adding that command at the XBeeNode level may be incorrect. I don't know if all modules support that command.

jefffhaynes commented 6 years ago

No worries, I was going to look into that. I’ve been out of the country and I’m just getting back but I’ll try to work on it soon.

— Planning for failure is even dumber than regular planning


From: PaulHeitkemper notifications@github.com Sent: Tuesday, February 6, 2018 7:54:08 PM To: jefffhaynes/XBee Cc: Jeff Haynes; Comment Subject: Re: [jefffhaynes/XBee] New to XBee and Added Supply Voltage measurement. (#42)

Upon further review, I think adding that command at the XBeeNode level may be incorrect. I don't know if all modules support that command.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/jefffhaynes/XBee/issues/42#issuecomment-363618229, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJSKR7afc3yXH8T_NPnZ9dfauj8TPm8Rks5tSPQwgaJpZM4RsHHx.

jefffhaynes commented 6 years ago

Pushed in XBee.Core.1.5.8. Take a look and let me know if it works for you.

jefffhaynes commented 6 years ago

Oh and it looks like it's supported in series 2 but not series 1.

jefffhaynes commented 6 years ago

Any command can be executed remotely. I don’t have it in front of me but basically you want to do GetNodeAsync, cast it to the correct series, and call the same method. I don’t think I have rssi querying but I can add it. Maybe submit another issue for that.

— Planning for failure is even dumber than regular planning


From: PaulHeitkemper notifications@github.com Sent: Tuesday, February 13, 2018 5:14:44 PM To: jefffhaynes/XBee Cc: Jeff Haynes; Comment Subject: Re: [jefffhaynes/XBee] New to XBee and Added Supply Voltage measurement. (#42)

Closed #42https://github.com/jefffhaynes/XBee/issues/42.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/jefffhaynes/XBee/issues/42#event-1472658169, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJSKR1SOcvQkI9JtTy32EReRvuZfXdx9ks5tUglUgaJpZM4RsHHx.